newLISP Fan Club

Forum => newLISP in the real world => Topic started by: cameyo on June 13, 2022, 10:43:11 PM

Title: string function
Post by: cameyo on June 13, 2022, 10:43:11 PM
Why this?
(setq a 10)
(setq b 20)
(string "'"a" '"b"")
-> "'10 '20"
Title: Re: string function
Post by: HPW on June 14, 2022, 09:16:54 AM
Hello,



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



http://www.newlisp.org/downloads/newlisp_manual.html#string



Regards

Hans-Peter
Title: Re: string function
Post by: cameyo on June 14, 2022, 11:06:25 PM
This is normal:
(string a b)
-> "1020"
(string "a""b")
-> "ab"

This is strange, but you just need to know:
(string ""a""b"")
-> "1020"
Title: Re: string function
Post by: rrq on June 15, 2022, 02:00:08 AM
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.
Title: Re: string function
Post by: cameyo on June 15, 2022, 10:20:05 AM
Ok. I am old...and often confused.

Thanks HPW and Ralph.