September 20, 201114 yr Hey all, i am trying to find out how to get a result from a script - for this test, true / false, but i dont know how. //name of script is recursive add //script calls self If [Get (scriptparameter) ≥ 100] exit script[] End If New Record/ Request Perform Script ["recursive add"; Paramter: Get (scriptparameter) + 1] Exit Script [Result: Get(scriptresult)] my goal is to use scripts to test my custom functions but i am trying to figure out recursive scripts & tail recursive scripts . Also how to use the Get (scriptResult) in the correct context. -ian
September 20, 201114 yr Author thing i figured out my question after some more tests; Exit Script [Result: get (foundcount) = 100 ]
September 20, 201114 yr Author how would this stand in for a recursive call though? Exit Script[ Result: Get ( ScriptResult) ] i guess i just need to write code & test test test huh?
September 21, 201114 yr how to get a result from a script Use the Get (ScriptResult) function. my goal is to use scripts to test my custom functions It 's not necessary to call a script recursively in order to test a recursive algorithm - you can use Loop.
September 21, 201114 yr Author Comment; I was going based on a mention by JBante -- He gave me some ideas about scripting before writing your custom function. He can better explain what i am trying to do.. Here is an excerpt from a tweet; In the example from fmforums, I'd do that Perform Script/Exit Script sequence in place of the self-call by the custom function; Next step after a recursive script call might be Exit Script[Result: Get ( ScriptResult )], to stand-in for the recursive function call. ** This was from my original question: ques: i am sorry , but i understand coding in an ide from many years ago. NOw you are teaching me something very new, which i would love to learn. -ian Os it just a bunch of "set Variable" statements . loops & calculations? ans: It's mostly Set Variable [] statements. The Case() becomes an If[]/Else If[] series, the Let()s become a series of Set Variable[], the $variables become $$variables, the ~letVariables become $variables, and the recursive custom function calls become recursive script calls followed by something using Get ( ScriptResult ) — Exit Script [Result: Get ( ScriptResult )] in the case of a tail recursive function. He doesn't explain himself as elaborately as i would like, but he definately has some good ideas or what i think may be good to adopt if you will. -ian
September 21, 201114 yr Author And JBante's response to the above : Not every recursive algorithm can be represented as a loop. A recursive script is a more faithful analog for prototyping a custom function
September 21, 201114 yr I am not into having a conversation here with a third person in another thread.
Create an account or sign in to comment