I have a true/false list (like this (#f #f #f #f #f #t)) and I want to loop through it, making an if statement and making appends.
But my map/if iterator does not work as I expected
I`m trying this:
(map (if (false? lst) "do this" "do that" ) lst)
In pseudo code I would have something like this
for each value in lst
if value
"do that"
else
"do this"
Remember that map
receives as parameters a list and a function that operates on each element. Try this:
(map (lambda (e)
(if (false? e)
"do this"
"do that"))
lst)
For example, if we define lst
as '(#f #f #f #f #f #t)
the result is:
'("do this" "do this" "do this" "do this" "do this" "do that")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.