newLISP Fan Club

Forum => newLISP in the real world => Topic started by: axtens on April 09, 2009, 10:13:24 AM

Title: (join (args)) and mixed data types?
Post by: axtens on April 09, 2009, 10:13:24 AM
G'day everyone



Pardon my naivete, but I'm having trouble with (join (args)) in that I'm expecting to get a string out of it, but it fails when items in the args are non-string.



For example
(define (tracer)
(begin
(set 'str (join (args)))
(append-file "trace.log" str)
(print str)
)
)

(tracer 1 0.2 "do" " " "not")


Out of that I get the following error message
ERR: string expected : 1
called from user defined function tracer


How do I make (tracer) sufficiently generic such that it can handle anything (or almost anything) that it receives in the args list?



Kind regards,

Bruce.
Title:
Post by: Kazimir Majorinc on April 09, 2009, 10:32:10 AM
Try something in the style of



(set 'str (join (map string (args))))