Talk:Imaginary function
If you look at it in the right (wrong?) way, you could say Haskell already fulfils this. After all, functions are pure and automatically curried, so Haskell's syntax for applying a function f to zero arguments is simply f. Which means
apply f = f thunk f = f
;) --Ørjan (talk) 19:59, 12 December 2012 (UTC)
- So, apply and thunk are actually both equivalent to id then?
- -- Chibiningen (talk) 17:28, 11 January 2021 (UTC)
Non-0ary apply/thunk
This got me thinking, could one also extend the apply/thubk to include arguments. So, thunk(apply(add, 1, 2), 1, 2) = add. Of course, for this to be in any way feasible, add/mul/wtc. couldn't just return a number/whatever type they're returning, as otherwise e.g. thunk(4, 2, 2) could have several different results.
For cases where arguments are same for both apply and thunk, lazy evaluation could allow for this, e.g. thunk(f(a,b), c,d)) would see if a=c and d=d, and if they do, return f.
Otherwise, possibly you could have a restriction that apply must be bijective, although that would limit quite a lot what you could do. </Random musings> --EzoLang (talk) 10:25, 28 May 2015 (UTC)