gogotanaka / hilbert

:dancers: Implement mathematics.
http://hilbert-lang.org/
553 stars 36 forks source link

Cannot recursively evaluate a function #79

Open ruurd opened 9 years ago

ruurd commented 9 years ago
Enjoy! -> f(x)=x^2
x ** 2
Enjoy! -> f(4) 
16.0
Enjoy! -> f(f(f(4)))
I'm so sorry, something wrong. Please feel free to report this.   
Enjoy! -> f(f(4))
I'm so sorry, something wrong. Please feel free to report this.
Enjoy! -> f(16)
256.0
jackmaney commented 9 years ago

For that matter, composition of functions in general doesn't work well:

Hi guys,thank you for using Hilbert.
You need to execute "postulate zfc_analysis" if you wanna do real analysis.

Enjoy! -> postulate zfc_analysis
success! :)
Enjoy! -> f(x) = x^2
x ** 2
Enjoy! -> g(x) = x + 1
1 + x
Enjoy! -> f(g(2))
I'm so sorry, something wrong. Please feel free to report this.

It's also worth pointing out that there's a significant pause before the ambiguous "I'm so sorry, something wrong" error message.

gogotanaka commented 9 years ago

@jackmaney @ruurd Thank you so much! I'm sorry for delay.. That's true, function in Hilbert is not first class, but we should do..

Basically Hilbert aim to be pure logic programing language so it's difficult to handle higher-order function.

But I'll try it.