From: kavenchuk
Subject: Recursive array declaration
Date: 
Message-ID: <1131916676.046907.141230@g47g2000cwa.googlegroups.com>
Need initialize big array of strings.
Some of the string is equal.
How do it without preliminary declaration this strings?
Such as "recursive array declaration":

CL-USER> (def-array-recursive my-array #2A(("first" "second" third")
                                           ("null" (aref my-array 0 1)
"zero")))
#2A(("first" "second" third")
    ("null" "second" "zero"))

or another

Thanks!

-- 
WBR, Yaroslav Kavenchuk.

From: Christophe Rhodes
Subject: Re: Recursive array declaration
Date: 
Message-ID: <sq7jbcutr3.fsf@cam.ac.uk>
"kavenchuk" <·········@jenty.by> writes:

> Need initialize big array of strings.
> Some of the string is equal.
> How do it without preliminary declaration this strings?
> Such as "recursive array declaration":
>
> CL-USER> (def-array-recursive my-array #2A(("first" "second" third")
>                                            ("null" (aref my-array 0 1)
> "zero")))
> #2A(("first" "second" third")
>     ("null" "second" "zero"))
>
> or another

You can create objects with moderately arbitrary internal structure
sharing using the #= and ## reader macros.  In your example,

#2A(("first" #1="second" "third")
    ("null" #1# "zero"))

But beware, this will make
  (eq (aref * 0 1) (aref * 1 1))
return true, which might not be what you mean.

Christophe
From: kavenchuk
Subject: Re: Recursive array declaration
Date: 
Message-ID: <1131962093.593012.304170@g44g2000cwa.googlegroups.com>
Thanks! It that is necessary.

But with the #= and ## reader macros is impossible make substitution of
high-order element:

[1]> #2A(("first" #1="second" "third")
         #2=("null" #1# "zero")
         #2#)

*** - LENGTH: #<READ-LABEL 2> is not a SEQUENCE

How it can be made?

Thanks!

-- 
WBR, Yaroslav Kavenchuk.
From: Christophe Rhodes
Subject: Re: Recursive array declaration
Date: 
Message-ID: <sq7jbb8ola.fsf@cam.ac.uk>
"kavenchuk" <·········@jenty.by> writes:

> Thanks! It that is necessary.
>
> But with the #= and ## reader macros is impossible make substitution of
> high-order element:
>
> [1]> #2A(("first" #1="second" "third")
>          #2=("null" #1# "zero")
>          #2#)
>
> *** - LENGTH: #<READ-LABEL 2> is not a SEQUENCE

That looks like a bug in whatever implementation you're using -- the
error checking appears to have come before the read substitution,
where it should come after.

Christophe
From: Carl Taylor
Subject: Re: Recursive array declaration
Date: 
Message-ID: <Jmaef.55883$qk4.48609@bgtnsc05-news.ops.worldnet.att.net>
kavenchuk wrote:
> Need initialize big array of strings.
> Some of the string is equal.
> How do it without preliminary declaration this strings?
> Such as "recursive array declaration":
>
> CL-USER> (def-array-recursive my-array #2A(("first" "second" third")
>                                           ("null" (aref my-array 0 1)
> "zero")))
> #2A(("first" "second" third")
>    ("null" "second" "zero"))

I have code that inserts an object into every occurrence of the deepest nest 
level of an array and outputs an array with the augmented last dimension.

For example:

If *aa* =

#2A(("a" "b" "c")
       ("d" "e" "f")
       ("g" "h" "i")
       ("j" "k" "l"))

after executing:

(insert-to-arrays-last-dim "X" 1 *aa*)

you get:

#2A(("a" "X" "b" "c")
       ("d" "X" "e" "f")
       ("g" "X" "h" "i")
       ("j" "X" "k" "l"))

Or nesting calls:

(insert-to-arrays-last-dim "X" 0
   (insert-to-arrays-last-dim "Y" 2 *aa*))

it would become:

#2A(("X" "a" "b" "Y" "c")
       ("X" "d" "e" "Y" "f")
       ("X" "g" "h" "Y" "i")
       ("X" "j" "k" "Y" "l"))

However, I'm not sure this would help with your problem. If it would I'll 
post the code.

Carl Taylor