> From: Raul Miller <[email protected]>

> Sent: Fri, November 27, 2009 11:27:47 AM
> 
> Anyways, K is stylistically somewhat similar to J, though its
> architecture also leans somewhat in the direction of a language
> like Scheme.  And so I thought you might have been referring to
> it.

> From: Dan Bron <[email protected]>
> Sent: Fri, November 27, 2009 11:41:53 AM
> 
> Raul is referring to the K language.  K is another member of the APL (Array
> Programming Language) family.   K, like J, is terse, high-level,
> functional, array-oriented programming language.  But it is also, like
> Lisp, a list processor.  K's native type is the list; so, whereas in J a
> 2D array and a list-of-lists are two totally different beasts, in K they
> are identical (similarly for higher dimensional arrays).  
> 
> As a result, unsurprising to any Lisp programmer, K is also a champion tree
> processor and a K program always exists in the context of a tree.  J being
> a Turing-complete programming language, can obviously also process trees,
> but both J and the J programmer are happier if the data is rectangular (in
> general, orthotopic).  This is particularly true since J's type system is
> fixed, so one cannot add a "tree type" or e.g. overload operators to have
> a different meaning for trees.

This casual use of terms like "Lisp-like", "list", "rectangular"
may lead to some confusion.

In Lisp (CL or Scheme for the purpose of this discussion), a *list* is
very specific sequence of "cons" (dotted pairs). For example,
a list (a b c) is in cons notation (a . (b . (c . NIL))), which also
represents how it is stored in memory. It is not a random-access structure.

To represent a random-access structure, Lisp uses (rectangular) arrays, 

http://groups.csail.mit.edu/mac/projects/s48/0.57/manual/s48manual_41.html

in particular the one-dimensional arrays are *vectors*. 
A corresponding vector is #(a b c).

http://docs.plt-scheme.org/reference/vectors.html

Elements of vectors may themselves be vectors, thus forming higher-dimensional
ragged (jagged) arrays. E.g. a matrix with different length rows.

Now, to provide parallels... 

J uses (rectangular) arrays, whereas the elements may be boxed, 
which makes it possible to store arrays in them. This is a
mechanism of creating boxed ragged arrays. Array of rank 1 is
called "list", which corresponds to Lisp vector.

http://www.jsoftware.com/help/dictionary/dicta.htm

K uses vectors (one-dimensional, not arbitrary-dimensional arrays), whose
elements can be either primitives or vectors. There is no separate boxed
distinction, which makes it similar to APL2. Nesting vectors produces the
effect of ragged arrays. K uses "list" to mean a Lisp vector.
K has no strict equivalent of higher dimensional arrays (like in J or Lisp).

https://code.kx.com/trac/wiki/QforMortals/lists

Neither J or K has an equivalent of Lisp cons, thus no Lisp lists.


      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to