9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul+plan9@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Google finally announces their lightweight OS
Date: Fri, 10 Jul 2009 12:14:21 -0700	[thread overview]
Message-ID: <20090710191421.B68AD5B62@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Fri, 10 Jul 2009 08:14:30 EDT." <645036de3a4d7f47bc309adbc9b94c5b@quanstro.net>

On Fri, 10 Jul 2009 08:14:30 EDT erik quanstrom <quanstro@quanstro.net>  wrote:
> > there has also been a lot of discussion in the past 1-2 months about
> > K, a successor to APL, in #plan9. you might ask there; i may have
> > missed a more recent development.
>
> could someone please explain to the ignorant, what
> is interesting about apl?  the last surge of interest i
> recall in the language was in 1983.  ibm offered an
> rom for the mga (monochrome graphics adapter)
> that substituted the odd apl characters for the
> equally-odd pc character set's bucky-bit characters.

Ken Iverson's 1979 Turing Award lecture, "Notation as a Toool
of thought" is a good place to start.  Htmlized version at
    http://www.jsoftware.com/papers/tot.htm
Google for p444-iverson.pdf for the original.

If you watched the Game of Life in APL video I pointed to,
you saw how the presenter develops the program. This is very
much like how one builds up a shell pipeline (both are
loopless as there are a lot of similarities between streams
and arrays).

APL and its successor languages such as j/k/q are not just
for number crunching.  I mostly use k or q for scripting.
Here is a quick example of piecewise development in q.  A
year ago I wanted a simple inverted index program so this is
what I implemented.

I first created a sample table "dt" where each row contains a
document id and a term.

q)dt
d1 t1
d1 t2
d2 t1
d2 t3
d3 t1
d3 t2
d3 t3

Then dt[;0] is the doc-id column, dt[;1] is the term column.
The following gives me row indices that have the same terms.

q)group dt[;1]
t1| 0 2 4	/t1 appears in rows 0 2 and 4
t2| 1 5		/etc
t3| 3 6

What I really want is doc-ids with the same term.

q) dt[;0] @ group dt[;1]
t1| `d1`d2`d3
t2| `d1`d3
t3| `d2`d3

Given this associative table I can find out which documents
contain t2. I first name the table idx.

q) idx: dt[;0] @ group dt[;1]
q) idx[`t2]
d1 d3

Now I have the data in the form I want and can implement
fancier things on top. But how do I get the data in?  If I
have a file foo where each line contains a space separated
doc-id and term, I can initialize dt from it.

q)dt:("SS";" ")0:`:foo

Code to read a bunch of files and create lines of <doc-id
term> not shown.  This was fast enough for a few tens of MB
of data I was interested in.

See code.kx.com for syntax etc.  It has a wealth of
information on Q including tutorials.  You can download a
copy for your own use.

[Note that there is another Q language, an equational
language. UNlike this Q it is open source but not an array
language]



  parent reply	other threads:[~2009-07-10 19:14 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10  6:32 Akshat Kumar
2009-07-10 12:02 ` Anthony Sorace
2009-07-10 12:14   ` erik quanstrom
2009-07-10 12:52     ` Robert Raschke
2009-07-10 17:11       ` Ethan Grammatikidis
2009-07-10 19:54       ` Richard Miller
2009-07-10 19:14     ` Bakul Shah [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-07-08  7:48 Aharon Robbins
2009-07-08  8:48 ` tlaronde
2009-07-08  9:02   ` Richard Miller
2009-07-08  9:23     ` tlaronde
2009-07-08  9:41       ` Richard Miller
2009-07-08 10:33         ` Uriel
2009-07-08 12:39         ` erik quanstrom
2009-07-08  9:28     ` Anselm R Garbe
2009-07-08 10:22     ` Uriel
2009-07-08 10:40       ` Richard Miller
2009-07-08 11:05         ` Uriel
2009-07-08 11:34           ` Anselm R Garbe
2009-07-08 12:07     ` erik quanstrom
2009-07-08 15:07     ` David Leimbach
2009-07-08 16:15     ` Balwinder S Dheeman
2009-07-08 16:27       ` erik quanstrom
2009-07-08 16:56         ` Devon H. O'Dell
2009-07-08 19:34           ` erik quanstrom
2009-07-08 19:41             ` Devon H. O'Dell
2009-07-08 19:47               ` erik quanstrom
2009-07-08 19:56               ` Uriel
2009-07-08 20:44                 ` Noah Evans
2009-07-08 21:14                 ` Dan Cross
2009-07-08 21:23                   ` Devon H. O'Dell
2009-07-08 19:50           ` Uriel
2009-07-08 19:56             ` Devon H. O'Dell
2009-07-08 20:04               ` Uriel
2009-07-08 20:10                 ` Devon H. O'Dell
2009-07-08 20:19                   ` ron minnich
2009-07-08 20:25                 ` Benjamin Huntsman
2009-07-08 20:30                   ` Devon H. O'Dell
2009-07-08 20:44                     ` Benjamin Huntsman
2009-07-08 20:32                 ` John Floren
2009-07-08 22:21                   ` Jason Catena
2009-07-08 22:41                     ` Venkatesh Srinivas
2009-07-09  4:10                     ` erik quanstrom
2009-07-09  5:43                       ` Jason Catena
2009-07-09 17:48                         ` Micah Stetson
2009-07-09 17:50                           ` Devon H. O'Dell
2009-07-09 17:50                           ` erik quanstrom
2009-07-09 19:47                           ` Jason Catena
2009-07-09 20:29                             ` tlaronde
2009-07-09 20:58                               ` Jason Catena
2009-07-09 21:34                               ` erik quanstrom
2009-07-09 21:44                                 ` Jack Johnson
2009-07-10  4:21                                   ` Bakul Shah
2009-07-09 21:59                                 ` Jason Catena
2009-07-09 22:18                                   ` erik quanstrom
2009-07-10  6:32                                     ` tlaronde
2009-07-09 12:45                       ` Eric Van Hensbergen
2009-07-09 15:24                       ` David Leimbach
2009-07-08 20:11             ` ron minnich
2009-07-08 20:43             ` Francisco J Ballesteros
2009-07-08 20:59               ` Devon H. O'Dell
2009-07-08 21:04                 ` Francisco J Ballesteros
2009-07-08 17:34         ` Dan Cross
2009-07-08 17:52           ` ron minnich
2009-07-08 19:30             ` erik quanstrom
2009-07-08 19:40               ` Devon H. O'Dell
2009-07-08 20:09               ` ron minnich
2009-07-08 16:12   ` Balwinder S Dheeman
2009-07-08  9:04 ` Charles Forsyth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090710191421.B68AD5B62@mail.bitblocks.com \
    --to=bakul+plan9@bitblocks.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).