axiom-developer
[Top][All Lists]
Advanced

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

RE: [Axiom-developer] RE: Boot vs. Lisp


From: Bill Page
Subject: RE: [Axiom-developer] RE: Boot vs. Lisp
Date: Wed, 2 Nov 2005 10:49:59 -0500

On November 2, 2005 3:58 AM Juergen Weiss wrote:

> ... 
> 4. Destructuring setq and destructuring comparisons
> 
> One of the highlights in BOOT is the possibility
> to use destructuring setqs and destructuring comparisons.
> This is extremly handy. Some random examples:
> 
>   for [[.,arg], :.] in singles while null tuple repeat
>     if arg is ['Tuple,.] then tuple := arg
> 
>   a is [=op,b,t1] =>
> 
> Without this feature the code will get almost unintelligible.
> And this feature is used in almost every line of code.
> ...

Of course ANSI lisp includes 'destructuring-bind' and other
operators which support this kind of thing.

http://www.cs.queensu.ca/software_docs/gnudev/gcl-ansi/gcl_443.html#SEC443
http://www.bookshelf.jp/texi/onlisp/onlisp_19.html

"Destructuring is a generalization of assignment. The
operators setq and setf do assignments to individual
variables. Destructuring combines assignment with access:
instead of giving a single variable as the first argument,
we give a pattern of variables, which are each assigned
the value occurring in the corresponding position in some
structure."

--------

So if Axiom adopts ANSI lisp, some of these advantages might
disappear. But in general I think the boot syntax is preferrable
in the context of Axiom.

Does SPAD inherit much of this kind of destructuring?

In Axiom for example I know that I can write a multiple
assignment like this:

(1) -> [a,b] := [1,2]

   (1)  [1,2]
                            Type: List PositiveInteger
(2) -> a

   (2)  1
                                 Type: PositiveInteger
(3) -> b

   (3)  2
                                 Type: PositiveInteger

-------

Are more sophisticated forms of destructuring also possible?

Regards,
Bill Page.






reply via email to

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