Deep Map Over List Block!

This is my first ever project using recursive calls that I wrote! I'm very proud to present my new block: The DEEP map over list! The block is basically MAP, but it applies to EVERY item in the list. Check it out here: Snap! 6.9.2 Build Your Own Blocks I'm kind of surprised it wasn't that hard to make. I've been trying to make this for so long, and I NEVER thought of using recursive calls (Because usually I crash Snap! when using them). I thought of using DIMENSIONS OF, but I couldn't figure out how to make it work. Also, I managed to not crash Snap! while making this block. Yay!

That's great! I'm really happy for you; cracking recursion is a big deal.

Channeling Jens for a paragraph, this is why he occasionally rants about people putting a ton of effort into JS Function hacks, when there's so much for them to learn in Snap! itself. 20 years from now, when you're programming in some language that hasn't been invented yet, obscure details you've learned about how Snap! is implemented will be useless to you, but recursion and processing of lists as trees (which is what you've done here) will still be just as valuable as they are today.

If you're crashing Snap! by using recursion, it's because you don't understand about base cases. Recursion works by turning a problem into a simpler subproblem. But you can't do that forever; there has to be some version of the problem that you can solve without using a recursive call. So for example,

computes the factorial of 3 by first computing the factorial of 2 and multiplying that result by 3. But when it works its way down to the factorial of 0, it just knows the answer. If 3! required knowing 2!, which required knowing 1!, which required knowing 0!, which required knowing (-1)!, which required knowing (-2)!, and so on forever, the recursion wouldn't work.

In your project, the base case of the recursion is handled by the IF (IS (ITEM) A LIST? block; if ITEM isn't a list, you don't make a recursive call.

So now go back to one of those Snap!-crasher projects and debug it. :~)

Two minor things you should know: The official name for what you're calling "complete map" is "deep map." And in the base case of your recursion, you don't have to put the item into a list and call MAP on it; you can say CALL (RING) WITH INPUT(S) (ITEM).

I think I put all of them in the trash.

I'll change the name

I tried that but it gave me some error.

If every recursive procedure has to have a base case, what is the base case of the "move away from other clones" custom block from the Jens' "hourglass/mosaic" project?

Yeah, it's hard to see, but the base case is that this clone isn't touching any of its neighbors (i.e., isn't touching anything). This will happen eventually because the total area of all the clones is way less than the area of the bottom half of the hourglass, so after a lot of jostling around, all the grains of sand have enough space around them.

Your deep map project no longer exist ?

I'm was merged with the link. It's fixed now.

thank you

can you add a small database and an example into the project plz.