Question

For example,

let procedure string-to-task "print ?"
(run procedure "hello")

There a couple reasons one would want to do this:

  1. Tasks don't need to be recompiled, whereas strings sometimes do (especially when using a lot of them).
  2. You can't pass in arguments when trying to run a string.
Was it helpful?

Solution

You sure can! Using this one weird only-obvious-in-retrospect trick:

to-report string-to-task [s]
  report runresult (word "task [" s "]")
end

Note that this will return either a reporter task or a command task, depending on the contents of the input string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top