AutoXenon Posted October 21, 2022 Posted October 21, 2022 While AutoIt does treat function as first-class variables and can be passed/returned, it does not allow creation of anonymous function, so it is not possible to do partial application. I could sort-of create a Y operator that takes two arguments, but that's not quite the same as sequential application: ; Local $factorial = Y(fac) ; does not work as autoit is eagerly evaluated and do not allow anonymous function definition Local $result = Y(fac,6) msgbox(0,"",Y(fac,6)) func fac($func, $num) return $num > 1 ? $num*$func($func,$num-1) : 1 endfunc func Y($func,$arg) return $func($func,$arg) endfunc I'm wondering if it's possible to do better using Eval() or Execute(), but they are effectively just inline macros and do not allow for parameter substitution. Perhaps wrapping Eval into a string interpreter may do?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now