Recursion
SAN
Posts: 29
Sir,
I want to write a programme with a recursive function - means a user defined function with parameters and return value and recursion.
Is it possible in PBasic language ?
Which processor I should use for that ?
I want to write a programme with a recursive function - means a user defined function with parameters and return value and recursion.
Is it possible in PBasic language ?
Which processor I should use for that ?
Comments
The BS2 doesn't support parameters or return values, recursion or no. I don't think any version of BASIC does, but I haven't looked.
The Propeller supports recursion, but it too is limited in the number of levels although the Propeller can certainly support many more recursive calls than the BS2. I think you'll run into the same problem with pretty much any microcontroller.
The Spin language used on the Propeller will do what you want. It directly supports recursion, parameters, and return values as well as local variables. Have a look at the Propeller Manual and/or the Propeller Education Kit tutorials. There's 32K bytes of memory available for your compiled program, global variables, and the stack which uses all the space from the end of your program to the end of the 32K bytes of memory.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
--Rich
Remember, the root of "recurse" is "curse"! [noparse]:D[/noparse]
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
In Propller chip if I load my program into EEPROM then the 32KB RAM will be free for recurssion ?
All recursive algorithms can be converted to iterative algorithms, and vice versa. It may not be as elegant to do it the other way, but it is mathematically possible.