in racket, trying print multiple expressions in "cond" statement below,
(let ((var `(make)) (exp '(1 2))) (cond [(number? 2) `(hi ,var) `(bye ,exp)]))
but "bye" statement returned/printed on screen.the first "hi" not evalauted @ all. how return/print both ?
you "returned/printed" 2 different things:
if want things returned, should use multiple values,
(values 1 2)
(or can return list 2 values cheap hack in case don't know multiple values).if want print stuff, use
print
twice (ordisplay
, orwrite
, orprintf
etc etc).
if you're complete newbie, it's neither of these right solution you.
Comments
Post a Comment