Higher order functions?
-
Hi, I wanted to see if Higher-Order functions were a thing in Fuze, so I used the following test code:
function test(color) clear(color) update() return void function test2(f) f(fuzeblue) return void test2(test())
The idea is to pass test() as an input to test2(), however this didn't work.
Does anyone know the correct syntax for higher order functions? Or maybe whether they exist in Fuze?
-
If you want to use a value from a function you need to return that value
Eg return colour -
As far as I know the only type of
delegation
that FUZE currently supports is withsetTimer
(link). -
@PB____ Yes, but I believe delegation in general was something being planned, like having function names in an array, so we can just call the array element.
-
Function pointers do not exist in Fuze, therefore you cannot pass a funtion as a parameter to a function.
Please remember that while not any specific BASIC, Fuze is loosely based on BASIC. There are a lot of people that seem to want to have vastly complex things in Fuze but this is not what it is about. It's not C, C++, C# or Swift.
-
I would agree that FUZE at this point is not at all ready for advanced features like
implicit delegation
andlambda expressions
. I would think there are many different priorities that come before it. And it might never be ready, since it's purpose is recreational and educational, not professional.I do disagree with the reasoning that this is because it is in the
BASIC
family. Since there areBASIC
languages that do support those features. In the end, it's more about where you choose to go with this. -
I saw that Jaywalker had a hack that sort of does function references...
Here: https://fuzearena.com/forum/topic/642/function-references/4