mark.warren
2020-4-17 08:15:44
If I want to call a method on each of a list of objects I know I can do (for-each (λ (node) (send node set-visited #f)) nodes-list)
Is there any way I could use apply? I can’t see any way it could work.
sorawee
2020-4-17 10:01:29
apply
calls a function once, but the argument list can be dynamically created. I think what you have is perfectly fine already
sorawee
2020-4-17 10:02:13
Another way to write your code is to use for
:
(for ([node (in-list nodes-list)])
(send node set-visited #f))
mark.warren
2020-4-17 10:04:23
@sorawee Thanks, I thought that might be the case. I like the alternative.
wanpeebaw
2020-4-17 14:19:43
Found an interesting book. https://letoverlambda.com/index.cl\|https://letoverlambda.com/index.cl