문제

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.
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top