Recursion in Hops

I want recursion to be possible. Because we can define a method by hops.
So I did this. The hops component’s path it this file. Recursive classic case, factorial.


Of course, it failed and took away a lot of memory.
As far as I am concerned, creating a document in hops can be done on the first run and not just after the hops component is created, which may make recursion possible in Grasshopper.

Recursion will usually come with some kind of terminal condition, in your example it’s just an infinite recursion, so of course it took a bunch of memory and failed.
Use anemone if you want recursion.

But I have a terminal condition. If input integer is less than one, will return one. If not, will minus one and put it into the next. The value will be reduced to less than 1.

that’s not exactly terminal condition, it’s just a dispatch.
I haven’t read up on the exact implementation of hops, but my guess is it’s just continuously loading the document hops is pointed to to figure out what’s in it and what input/output to display.

how it works:

Behind the scenes, the Hops client passes the Grasshopper definition you specify to a headless instance of Rhino and Grasshopper server.