JLyddon Posted March 11, 2016 Share Posted March 11, 2016 I have experience writing code in VEX and want to start writing some recursive functions. I've been searching thoroughly online, and found through this website that: The functions are in-lined automatically by the compiler, so recursion will not work. To write a recursive algorithm, you should use shader calls instead. So I have started looking into shader calls here and can see the Fibonacci sequence example. I am struggling to understand where to put this code for it to work. I've made a CVEX shader builder and put the code in here, but I get the error that "Invalid return type (cvex) for function fib." Any help or insight into what I might be doing wrong would be greatly appreciated. Would it be easier/faster/less effort to just do it in HDK? Thanks in advance printFib.hipnc Quote Link to comment Share on other sites More sharing options...
Shinjipierre Posted March 11, 2016 Share Posted March 11, 2016 Well, here's a way to compute the fibonacci sequence without recursion, just made it in a SOP wrangle as it's easier to check. printFib.hipnc Quote Link to comment Share on other sites More sharing options...
JLyddon Posted March 11, 2016 Author Share Posted March 11, 2016 Remi, thank you for your quick reply. I'm afraid the fibonacci sequence is merely an example of what I would like to achieve through recursion as a demonstration any further insight you have into solving this kind of problem would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.