From: Sylvain Sham Dargent
Subject: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8csl6k$oe2$1@kopp.stud.ntnu.no>
well, the context is simple :

In a dialog box, I have to list boxes.

I would like to update a text tile accorind to the setting from the DB.

I've written so far :

    (set_tile "key_reference_of_the_text_box" (nth
value_of_the_first_list_tile (read (strcat "second_list_" (nth
value_of_the_second_list_til first_list)))))

where:

first_list is defined as following:
    (setq first_list (list "a" "b"))

second_list are:
    (setq second_list_a (list "a1" "a2"))
    (setq second_list_b (list "b1" "b2"))

The main problem is that ACAD answer from
    (read (strcat "second_list_" (nth value_of_the_second_list_til
first_list)))  -> second_list_a  (if I choose A is the dialog box in the
first list)

BUT can't anderstand the whole complete line

Here is the error message
error: bad argument type: consp  SECOND_LIST_A

Any help would be great, I not I will Have to write tousands of "IF"
statements.

From: Rahul Jain
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8csmsg$ie7$1@joe.rice.edu>
In article <············@kopp.stud.ntnu.no> posted on Monday, April 10,
2000  8:36 AM, "Sylvain Sham Dargent"
<···············@energy.sintef.no> wrote:
> well, the context is simple :
> 
> In a dialog box, I have to list boxes.
> 
> I would like to update a text tile accorind to the setting from the DB.
> 
> I've written so far :
> 
>     (set_tile "key_reference_of_the_text_box" (nth
> value_of_the_first_list_tile (read (strcat "second_list_" (nth
> value_of_the_second_list_til first_list)))))


Those variable names are, honestly, the worst I have ever seen... I'd
suggest you make them shorter so that the code is more compact and more
readable. I'll be glad to try and help once you've done that.
e.g.

(defun do-this (lis1 lis2)
    (let ((both-lis (append lis1 lis2)))
         (do-something-with-both-lis ...)
         (reverse both-lis)))

To a lisp-person, that's much easier to understand.

-- 
-> -\-=-=-=-=-=-=-=-=-=-/^\-=-=-=<*><*>=-=-=-/^\-=-=-=-=-=-=-=-=-=-/- <-
-> -/-=-=-=-=-=-=-=-=-=/ {  Rahul -<>- Jain   } \=-=-=-=-=-=-=-=-=-\- <-
-> -\- "I never could get the hang of Thursdays." - HHGTTG by DNA -/- <-
-> -/- http://photino.sid.rice.edu/ -=- ·················@usa.net -\- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   Version 11.423.999.210020101.23.50110101.042
   (c)1996-2000, All rights reserved. Disclaimer available upon request.
From: Erik Naggum
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <3164366538827789@naggum.no>
* Rahul Jain <·····@rice.edu>
| (defun do-this (lis1 lis2)
|     (let ((both-lis (append lis1 lis2)))
|          (do-something-with-both-lis ...)
|          (reverse both-lis)))
| 
| To a lisp-person, that's much easier to understand.

  really?  I wonder what a "lis" is.  does lisp return t on it?  :)

#:Erik
From: Rahul Jain
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8cst2p$p4h$1@joe.rice.edu>
In article <················@naggum.no> posted on Monday, April
10, 2000  9:42 AM, Erik Naggum <····@naggum.no> wrote:
> * Rahul Jain <·····@rice.edu>
> | (defun do-this (lis1 lis2)
> |     (let ((both-lis (append lis1 lis2)))
> |          (do-something-with-both-lis ...)
> |          (reverse both-lis)))
> | 
> | To a lisp-person, that's much easier to understand.
> 
>   really?  I wonder what a "lis" is.  does lisp return t on it?  :)
> 
> #:Erik

Of course, if it was a real example, I'd have included some
documentation on what the function does to the params :)

-- 
-> -\-=-=-=-=-=-=-=-=-=-/^\-=-=-=<*><*>=-=-=-/^\-=-=-=-=-=-=-=-=-=-/- <-
-> -/-=-=-=-=-=-=-=-=-=/ {  Rahul -<>- Jain   } \=-=-=-=-=-=-=-=-=-\- <-
-> -\- "I never could get the hang of Thursdays." - HHGTTG by DNA -/- <-
-> -/- http://photino.sid.rice.edu/ -=- ·················@usa.net -\- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   Version 11.423.999.210020101.23.50110101.042
   (c)1996-2000, All rights reserved. Disclaimer available upon request.
From: Sylvain Sham Dargent
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8ct29m$end$1@kopp.stud.ntnu.no>
Here is some code, hope more understandable by Guru LISP expected gentlemen
:

(set_tile "bk_stup_textlabel" (nth subcomp_selected (read (strcat
"list_subcomp_" (nth comp_selected list_comp)))))


Doesn't work, even if

(read (strcat "list_subcomp_" (nth comp_selected list_comp)))

retrun the good string

Erik Naggum wrote in message <················@naggum.no>...
>* Rahul Jain <·····@rice.edu>
>| (defun do-this (lis1 lis2)
>|     (let ((both-lis (append lis1 lis2)))
>|          (do-something-with-both-lis ...)
>|          (reverse both-lis)))
>|
>| To a lisp-person, that's much easier to understand.
>
>  really?  I wonder what a "lis" is.  does lisp return t on it?  :)
>
>#:Erik
From: Sylvain Sham Dargent
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8cssem$6qq$1@kopp.stud.ntnu.no>
Those names were just to understand to what the parameters refer.

I could provide with the program, which will defenitely not be meaningfull
at all for you, unfortunately.

The may problem here seems that ACAD can't manage a SETQ function if too
much READ and STRCAT are involved within the code.

But it can't, so it seems that the problem comes from my program.

Would you please help any way ?

Thanks


Rahul Jain wrote in message <············@joe.rice.edu>...
>In article <············@kopp.stud.ntnu.no> posted on Monday, April 10,
>2000  8:36 AM, "Sylvain Sham Dargent"
><···············@energy.sintef.no> wrote:
>> well, the context is simple :
>>
>> In a dialog box, I have to list boxes.
>>
>> I would like to update a text tile accorind to the setting from the DB.
>>
>> I've written so far :
>>
>>     (set_tile "key_reference_of_the_text_box" (nth
>> value_of_the_first_list_tile (read (strcat "second_list_" (nth
>> value_of_the_second_list_til first_list)))))
>
>
>Those variable names are, honestly, the worst I have ever seen... I'd
>suggest you make them shorter so that the code is more compact and more
>readable. I'll be glad to try and help once you've done that.
>e.g.
>
>(defun do-this (lis1 lis2)
>    (let ((both-lis (append lis1 lis2)))
>         (do-something-with-both-lis ...)
>         (reverse both-lis)))
>
>To a lisp-person, that's much easier to understand.
>
>--
>-> -\-=-=-=-=-=-=-=-=-=-/^\-=-=-=<*><*>=-=-=-/^\-=-=-=-=-=-=-=-=-=-/- <-
>-> -/-=-=-=-=-=-=-=-=-=/ {  Rahul -<>- Jain   } \=-=-=-=-=-=-=-=-=-\- <-
>-> -\- "I never could get the hang of Thursdays." - HHGTTG by DNA -/- <-
>-> -/- http://photino.sid.rice.edu/ -=- ·················@usa.net -\- <-
>|--|--------|--------------|----|-------------|------|---------|-----|-|
>   Version 11.423.999.210020101.23.50110101.042
>   (c)1996-2000, All rights reserved. Disclaimer available upon request.
>
From: Tim Moore
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8csvho$84i$0@216.39.145.192>
On Mon, 10 Apr 2000, Sylvain Sham Dargent wrote:

> well, the context is simple :
> 
> In a dialog box, I have to list boxes.
> 
> I would like to update a text tile accorind to the setting from the DB.
> 
> I've written so far :
> 
>     (set_tile "key_reference_of_the_text_box" (nth
> value_of_the_first_list_tile (read (strcat "second_list_" (nth
> value_of_the_second_list_til first_list)))))
> 
> where:
> 
> first_list is defined as following:
>     (setq first_list (list "a" "b"))
> 
> second_list are:
>     (setq second_list_a (list "a1" "a2"))
>     (setq second_list_b (list "b1" "b2"))
>
Ouch!!
> The main problem is that ACAD answer from
>     (read (strcat "second_list_" (nth value_of_the_second_list_til
> first_list)))  -> second_list_a  (if I choose A is the dialog box in the
> first list)
> 
I'm not sure how read is working for you in this context, but assuming you
can just read from a string in your dialect.... You can quickly get your
code to work with something like:
(set_tile "key_reference_of_the_text_box"
	  (nth value_of_the_first_list_tile
	       (symbol-value (read (strcat "second_list_"
			     (nth value_of_the_second_list_tile 
                                  first_list))))))

But this is so, so, so gross!!!  You could improve things a bit by getting
rid of the second_list_ variables and storing their values in a 2
dimensional array.

> BUT can't anderstand the whole complete line
> 
> Here is the error message
> error: bad argument type: consp  SECOND_LIST_A
> 
> Any help would be great, I not I will Have to write tousands of "IF"
> statements.

Is ACAD the AOL of the Lisp world? :):):)
Tim
From: Sylvain Sham Dargent
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8ct273$ekq$1@kopp.stud.ntnu.no>
Tim Moore wrote in message <············@216.39.145.192>...
>
>
>On Mon, 10 Apr 2000, Sylvain Sham Dargent wrote:
>
>> well, the context is simple :
>>
>> In a dialog box, I have to list boxes.
>>
>> I would like to update a text tile accorind to the setting from the DB.
>>
>> I've written so far :
>>
>>     (set_tile "key_reference_of_the_text_box" (nth
>> value_of_the_first_list_tile (read (strcat "second_list_" (nth
>> value_of_the_second_list_til first_list)))))
>>
>> where:
>>
>> first_list is defined as following:
>>     (setq first_list (list "a" "b"))
>>
>> second_list are:
>>     (setq second_list_a (list "a1" "a2"))
>>     (setq second_list_b (list "b1" "b2"))
>>
>Ouch!!

Yes I agree.

>> The main problem is that ACAD answer from
>>     (read (strcat "second_list_" (nth value_of_the_second_list_til
>> first_list)))  -> second_list_a  (if I choose A is the dialog box in the
>> first list)
>>
>I'm not sure how read is working for you in this context, but assuming you
>can just read from a string in your dialect.... You can quickly get your
>code to work with something like:
>(set_tile "key_reference_of_the_text_box"
>   (nth value_of_the_first_list_tile
>        (symbol-value (read (strcat "second_list_"
>      (nth value_of_the_second_list_tile
>                                  first_list))))))
>

What is the SYMBOL-VALUE you used there ? Is that LISP routine ?


>But this is so, so, so gross!!!  You could improve things a bit by getting
>rid of the second_list_ variables and storing their values in a 2
>dimensional array.
>


As well, is a 2D array something like a list defined that way:
((A A1 A2) (B B1 B2)) ?

>> BUT can't anderstand the whole complete line
>>
>> Here is the error message
>> error: bad argument type: consp  SECOND_LIST_A
>>
>> Any help would be great, I not I will Have to write tousands of "IF"
>> statements.
>
>Is ACAD the AOL of the Lisp world? :):):)
>Tim
>

Yes, I use Lisp a the programmimg language for developping some custermised
routines.

Hope you will have some time to get me started with this. I have some many
list that I'm already horrified to code some hundreds of IF statements, as:
(cond
    (= value_of_the_first_list_tile 0)  ;corresponding to the choice A

            (cond
                (= value_of_the_second_list_tile 0) ; corresponding to A1
choice

                        etc...

It would be a nightmare.


Sylvain.

>
From: Tim Moore
Subject: Re: list problem and NTH, READ, STRCAT
Date: 
Message-ID: <8ct6ii$opi$0@216.39.145.192>
On Mon, 10 Apr 2000, Sylvain Sham Dargent wrote:

> 
> Tim Moore wrote in message <············@216.39.145.192>...
> >> The main problem is that ACAD answer from
> >>     (read (strcat "second_list_" (nth value_of_the_second_list_til
> >> first_list)))  -> second_list_a  (if I choose A is the dialog box in the
> >> first list)
> >>
> >I'm not sure how read is working for you in this context, but assuming you
> >can just read from a string in your dialect.... You can quickly get your
> >code to work with something like:
> >(set_tile "key_reference_of_the_text_box"
> >   (nth value_of_the_first_list_tile
> >        (symbol-value (read (strcat "second_list_"
> >      (nth value_of_the_second_list_tile
> >                                  first_list))))))
> >
> 
> What is the SYMBOL-VALUE you used there ? Is that LISP routine ?
> 
Yes.  Wait... Are you working in AutoLisp (i.e., does ACAD mean AutoCad)?
If so, my answer probably won't help much.  This is the Common Lisp
hangout.
> 
> >But this is so, so, so gross!!!  You could improve things a bit by getting
> >rid of the second_list_ variables and storing their values in a 2
> >dimensional array.
> >
> 
> 
> As well, is a 2D array something like a list defined that way:
> ((A A1 A2) (B B1 B2)) ?
You can implement lists that way if your dialect of Lisp (Autolisp?)
doesn't support arrays.  Best to ask in an AutoCad newsgroup if that's
what you're using.

Tim