string function

Started by cameyo, June 13, 2022, 10:43:11 PM

Previous topic - Next topic

cameyo

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

HPW

#1
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">http://www.newlisp.org/downloads/newlis ... tml#string">http://www.newlisp.org/downloads/newlisp_manual.html#string



Regards

Hans-Peter
Hans-Peter

cameyo

#2
This is normal:
(string a b)
-> "1020"
(string "a""b")
-> "ab"

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

rrq

#3
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.

cameyo

#4
Ok. I am old...and often confused.

Thanks HPW and Ralph.