chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Implementing CL-style array literal syntax


From: John Cowan
Subject: [Chicken-users] Implementing CL-style array literal syntax
Date: Thu, 4 Jan 2007 15:10:24 -0500
User-agent: Mutt/1.3.28i

I'd like to add a CL-compatible syntax for simple multi-dimensional
arrays to Chicken as part of an egg.  Basically the syntax is #nA datum,
where n is a digit-string representing the rank of the array.  This is
required because just looking at a datum of ((1 2 3) (4 5 6)) does not
tell us whether this is a vector of two lists or a matrix of integers.

This can be done in Chicken using set-sharp-read-syntax! to control the
interpretation of #0 through #9 (the procedure must read the rest of
the digits, if any, and the datum by itself).  That isn't extensible,
though; it wouldn't allow someone to add #nR syntax to read numbers to
the arbitrary base n.  Furthermore, it collides with the interpreter's
#n syntax meaning "the value of the nth evaluated form".

What I'd like to see is a new set-parameterized-read-syntax procedure
which takes a character c and allows the reader to accept input of the
form #nc, where n is a digit string, and invoke a handler that takes
two arguments, the port and the integer value of n.

-- 
First known example of political correctness:   John Cowan
After Nurhachi had united all the other         http://www.ccil.org/~cowan
Jurchen tribes under the leadership of the      address@hidden
Manchus, his successor Abahai (1592-1643)
issued an order that the name Jurchen should       --S. Robert Ramsey,
be banned, and from then on, they were all           The Languages of China
to be called Manchus.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]