From: Drew Krause
Subject: huh? with lists of arrays
Date: 
Message-ID: <bIVFc.7513$yy1.3538@newsread2.news.atl.earthlink.net>
How can I work with arrays within a list, when my interpreter (clisp) 
behaves in the following way:

 > (arrayp mx1)
 > T
 > (arrayp mx2)
 > T
 > (loop for x in '(mx1 mx2) collect (arrayp x))
 > (nil nil)

Any help appreciated! Thanks!

From: Ari Johnson
Subject: Re: huh? with lists of arrays
Date: 
Message-ID: <RLVFc.9656$nc.1794@fed1read03>
Drew Krause wrote:
> How can I work with arrays within a list, when my interpreter (clisp) 
> behaves in the following way:
> 
>  > (arrayp mx1)
>  > T
>  > (arrayp mx2)
>  > T
>  > (loop for x in '(mx1 mx2) collect (arrayp x))
>  > (nil nil)
> 
> Any help appreciated! Thanks!

That's correct.  The symbols MX1 and MX2 are not arrays.  Try, instead 
of '(mx1 mx2), (list mx1 mx2)
From: Drew Krause
Subject: Re: huh? with lists of arrays
Date: 
Message-ID: <MMVFc.365$sD4.222@newsread3.news.atl.earthlink.net>
Thanks -- that was quick!

Ari Johnson wrote:

> Drew Krause wrote:
>
>> How can I work with arrays within a list, when my interpreter (clisp) 
>> behaves in the following way:
>>
>>  > (arrayp mx1)
>>  > T
>>  > (arrayp mx2)
>>  > T
>>  > (loop for x in '(mx1 mx2) collect (arrayp x))
>>  > (nil nil)
>>
>> Any help appreciated! Thanks!
>
>
> That's correct.  The symbols MX1 and MX2 are not arrays.  Try, instead 
> of '(mx1 mx2), (list mx1 mx2)
From: Kenny Tilton
Subject: Re: huh? with lists of arrays
Date: 
Message-ID: <40E8406A.4040402@nyc.rr.com>
[posted to cll also]

Drew Krause wrote:

> How can I work with arrays within a list, when my interpreter (clisp) 
> behaves in the following way:
> 
>  > (arrayp mx1)
>  > T
>  > (arrayp mx2)
>  > T
>  > (loop for x in '(mx1 mx2) collect (arrayp x))
>  > (nil nil)

This problem results from The Big Lie common to all Lisp introductions, 
in which example after example of operating on a list uses forms such as 
'(a b c) and '(1 2 3), as if that were how to make a list. Of course the 
first example is a lot simpler than (list 'a 'b 'c), so I understand why 
  TBL is so common. The long and the short of it is that '(mx1 mx2) is 
for this discussion like (list 'mx1 'mx2), ie, a list of those two 
symbols. You of course wanted a list of the two arrays bound to mx1 and 
mx2. Put another way, QUOTE (aka ') does not evaluate its argument, so 
you just get the symbols mx1 and mx2 (quoting a list quotes the list 
contents, however deeply nested).

btw, when faced with a stumper like this, I usually do something like:

    (loop for x in '(mx1 mx2) collect (type-of x))

If that result still leaves me stumped (because the type returned 
strikes me as something that is arrayp, which is not the case here) and 
I suspect I am missing a simple bug elsewhere, I might try:

    (loop for x in '(mx1 mx2)
        collect (list (type-of x) (subtypep (type-of x) 'array)))

Again, this case does not call for that sort of thing, but I thought I 
would highlight the availablity of TYPE-OF and SUBTYPEP.

kt


-- 
Home? http://tilton-technology.com
Cells? http://www.common-lisp.net/project/cells/
Cello? http://www.common-lisp.net/project/cello/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application