Page 1 of 1

string function

Posted: Tue Jun 14, 2022 5:43 am
by cameyo
Why this?

Code: Select all

(setq a 10)
(setq b 20)
(string "'"a" '"b"")
-> "'10 '20"

Re: string function

Posted: Tue Jun 14, 2022 4:16 pm
by HPW
Hello,

Whats the question: The integer in the both symbols are converted to string and all together is concatinated.

http://www.newlisp.org/downloads/newlis ... tml#string

Regards
Hans-Peter

Re: string function

Posted: Wed Jun 15, 2022 6:06 am
by cameyo
This is normal:

Code: Select all

(string a b)
-> "1020"
(string "a""b")
-> "ab"
This is strange, but you just need to know:

Code: Select all

(string ""a""b"")
-> "1020"

Re: string function

Posted: Wed Jun 15, 2022 9:00 am
by ralph.ronnquist
I'm confused about why you appear confuse... of course (string ""a""b"") is the same as (string "" a "" b ""); the string function packs together the stringifying of its arguments ignoring any (optional) whitespace between them. No strangeness involved afaict.

Re: string function

Posted: Wed Jun 15, 2022 5:20 pm
by cameyo
Ok. I am old...and often confused.
Thanks HPW and Ralph.