SASA
March 13, 2020, 8:07pm
1
Is reentrancecy allowed? I want to run a user defined “program” in which a “function” might call itself. It would be nice if I can implement this with a procedure block that can call itself rather than having to implement a stack but I’m not sure is this is possible…
TIMAI2
March 13, 2020, 8:14pm
2
It may depend on the content of the procedure but this works
SASA
March 13, 2020, 8:26pm
3
Excellent - I’ll give it a whirl - thanks
ABG
March 13, 2020, 8:35pm
4
Here's another example ...
This is a set of procedures you can use to sort lists and tables, using your own test criterion for greater/lesser comparison. It is based on the merge sort algorithm, which runs at n*log(n) speed. The procedure blocks should be draggable directly into your Blocks Editor workspace.
[blocks] [merge] merge_sort.aia (4.9 KB) [merge_sort] [merge_sort_sample_call] [output] [precedes] [randoms] [segment]
The logic:
function merge_sort(list m)
// Base case. A list of zero or one elements is sort…
system
Closed
March 20, 2020, 8:44pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.