gusl: (Default)
[personal profile] gusl
< gusl > I have a function 'fun' to which I want to pass the name of another
       function 'f'. The name of 'f' is to be printed and then 'f' is to be
       called.								[00:40]
< gusl > I'm wondering whether I want to pass the name of the function... or
       whether it's possible to pass the function itself, and get 'fun' to
       compute its name.						[00:41]
< gusl > I thought about using quote, but realized that it can't help
       me... since it's not a quasiquote				[00:43]


I'm not very hopeful of a solution along these lines... Fortunately, it's rare than I miss Lisp features (at least ever since I stopped using Java).

---

UPDATE: eval saved the day! It's still a bit cumbersome, since I need to call 'parse'.
eval(parse(text="square(5)"))
eval(parse(text="square"))(5)


Also, the #R channel has a bot named "eval"!
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags