Thanks for the compliment, but I am still interested in how the WL program
worked.


On Fri, Sep 13, 2013 at 8:29 AM, Richard Gaylord <[email protected]>wrote:

> that is definitely awesome code!
>
> On Friday, September 13, 2013, Roger Hui wrote:
>
> > Much of the code in the previous J programs/expressions has to do with
> > transforming between representations.  The following is a fairer
> comparison
> > between the WL program and an equivalent J program.
> >
> > Society is table of pairs, each pair an integer representing a person's
> > name and another representing a person in the first person's social
> > network.  Thus:
> >
> >    p=: _2 ]\ 1 5 1 7 4 1 4 2 5 2 5 7 6 2 7 8 8 5
> >    p
> > 1 5
> > 1 7
> > 4 1
> > 4 2
> > 5 2
> > 5 7
> > 6 2
> > 7 8
> > 8 5
> >
> > To modify p so that anyone in another's network includes that person in
> > their network:
> >
> >    p , |."1 p
> > 1 5
> > 1 7
> > 4 1
> > 4 2
> > 5 2
> > 5 7
> > 6 2
> > 7 8
> > 8 5
> > 5 1
> > 7 1
> > 1 4
> > 2 4
> > 2 5
> > 7 5
> > 2 6
> > 8 7
> > 5 8
> >
> > If you want it sorted:
> >
> >    /:~ p , |."1 p
> > 1 4
> > 1 5
> > 1 7
> > 2 4
> > 2 5
> > 2 6
> > 4 1
> > 4 2
> > 5 1
> > 5 2
> > 5 7
> > 5 8
> > 6 2
> > 7 1
> > 7 5
> > 7 8
> > 8 5
> > 8 7
> >
> > Therefore:
> >
> > WL:
> >
> > symSoc = society /.
> >  {a_Integer, b_} :> {a, Union[b, Cases[society, {x_, {___, a, ___}} :>
> x]]}
> >
> >
> > J:
> >
> > p,|."1 p
> > /:~p,|."1 p
> >
> > ​
> > ​
> >
> >
> >
> >
> >
> > On Thu, Sep 12, 2013 at 9:51 PM, Roger Hui <[email protected]
> <javascript:;>
> > >wrote:
> >
> > > 0. Do you care to explain how this WL program works?
> > > ​
> > > symSoc = society /.
> > >  {a_Integer, b_} :> {a, Union[b, Cases[society, {x_, {___, a, ___}} :>
> > x]]}
> > >
> > > 1. How well does it perform if "society" has 10 million members?
> > >
> > >
> > >
> > >
> > > On Thu, Sep 12, 2013 at 9:37 PM, Richard Gaylord <[email protected]
> > >wrote:
> > >
> > >> roger:
> > >>
> > >> thanks very much for your response. the code in my lecture notes does
> > >> include the case where each person is a member of his network.
> > >>
> > >> when i look at your code , i realize that i would be best to keep
> using
> > >> the
> > >> Wolfram language (WL) rather than learn to master J as you have (of
> > course
> > >> that's understandable since you created J ). i am too set in my
> > >> programming
> > >> ways to learn a new  language at this point unless it offers me
> > something
> > >> very substantially better than WL.
> > >>
> > >> also, i happen to truly love WL and have been a WL evangelist for 25
> > >> years,
> > >> using it in my four books and teaching WL with great pleasure to over
> a
> > >> thousand students at university in a variety of fields (physics,
> > >> chemistry,
> > >> biology, sociology and economics/business) and in industry and
> > government,
> > >> how WL works in 6.5 hrs. of lecture (sometimes given in four 90 minute
> > >> classroom increments and sometimes in one day-long lecture).
> > >>
> > >> you know, i first learned WL
> > >>
> > >> - which has been unfortunately been called Mathematica which is the
> > >> software that is built upon WL because stephen wolfram took 25 years
> > >> before
> > >> announcing this spring the imminent release of WL as a stand-alone app
> > to
> > >> run on computers and mobile devices (as J already does) -
> > >>
> > >> by reading "Life; Nasty, Brutish and Short" and thereby learning array
> > >> processing. and implementing it in WL while also incorporating
> anonymous
> > >> functions (J was not yet created)  and nested function calls and
> > >> eventually
> > >> rules and pattern matching. To this day, i consider consider myself an
> > >> APL'er by nature who delights in the creation of unreadable one-liner
> > code
> > >> LOL. but i do it in WL which is far easier for me to read and work
> with
> > >> (and i actually first became aware of APL through stephen's
> Mathematica
> > >> book).
> > >>
> > >> i also recall returning to the US from an APL meeting in Toronto
> (where
> > i
> > >> gave a tutorial on WL) sitting next to Arthur Whitney  on the plane,
> > >> running side-by-side comparisons of the speed of my writing  and
> running
> > >> pieces of code in WL with Arthur's doing the same with his just
> created
> > K
> > >> language on our respective MacBooks.
> > >>
> > >> As a scientist (i'm a theoretical condensed soft matter physicist), i
> > have
> > >> available a community of well over a million users of Mathematica to
> > teach
> > >> WL to and to learn from and that's too great resource for me to not
> use
> > >> (if
> > >> i could get them each to buy at least one of my books, i'd be
> > financially
> > >> set LOL).
> > >>
> > >> so i guess i'll continue to use WL and to wear my custom-made black WL
> > >> icon
> > >> logo T-shirt.
> > >>
> > >> richard
> > >>
> > >>
> > >> On Thu, Sep 12, 2013 at 7:53 PM, Roger Hui <[email protected]
> > >> >wrote:
> > >>
> > >> > If we modify the input slightly, by requiring that each person is a
> > >> member
> > >> > of his own network (i.e. the reflexive closure), then the
> computation
> > >> can
> > >> > be more concise:
> > >> >
> > >> >    c=: 0;1 5 7;2 ;3;4 1 2;5 2 7;6 2;7 8;8 5
> > >> >    c
> > >> > ┌─┬─────┬─┬─┬─────┬─────┬───┬───┬───┐
> > >> > │0│1 5 7│2│3│4 1 2│5 2 7│6 2│7 8│8 5│
> > >> > └─┴─────┴─┴─┴─────┴─────┴───┴───┴───┘
> > >> >    <@~././ |: (,|."1) (I.#&>c),.;c
> > >> > ┌─┬───────┬───────┬─┬─────┬─────────┬───┬───────┬─────┐
> > >> > │0│1 5 7 4│2 4 5 6│3│4 1 2│5 2 7 1 8│6 2│7 8 1 5│8 5 7│
> > >> > └─┴───────┴───────┴─┴─────┴─────────┴───┴───────┴─────┘
> > >> >
> > >> >
> > >> >
> > >> >
> >
>
>
> --
>
> *"Those who would sacrifice freedom for security deserve neither." -
> Benjamin Franklin*
>
>
> *"I think that the very notion that equations are a good approach to
> describing the natural world is a little bizarre."
>  - Stephen Wolfram*
>
> *
> *
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to