Task

Invoke an object method where the name of the method to be invoked can be generated at run time.



Related tasks

 Respond to an unknown method call.
 Runtime evaluation


(task=
  ( oracle
  =   (predicate="is made of green cheese")
      (generateTruth=.str$(!arg " " !(its.predicate) "."))
      (generateLie=.str$(!arg " " !(its.predicate) "!"))
  )
& new$oracle:?SourceOfKnowledge
&   put
  $ "You may ask the Source of Eternal Wisdom ONE thing.
Enter \"Truth\" or \"Lie\" on the next line and press the <Enter> key.
"
&   whl
  ' ( get':?trueorlie:~Truth:~Lie
    & put$"Try again\n"
    )
& put$(str$("You want a " !trueorlie ". About what?" \n))
& get'(,STR):?something
& (SourceOfKnowledge..str$(generate !trueorlie))$!something
);
 