Weird conflict between Map and custom recursive block

Hi! I was experimenting with flexible item selection notation for lists, and I started off by making a block that would decode such notation. I finished the first step (separating shallow selection groups), and I was going to work on making it recursive (i.e., allow the newly created groups to be split further alongside some other adjustments; this would coexist with the recursion I used to identify the parent groups if the user had wrapped everything in unnecessary grouping symbols). However, while using map, I kept getting errors, so I fooled around a bit with how I composed map and my W.I.P. normalize index block together, and I got a different error. I think I’ve somewhat figured out what’s going on. map is evaluating the lambda and replacing the ring with it. But why?? Could someone please tell me what my mistake is, if any?

I’ve attached my block and some example errors.

normalize index script pic

Custom block

item of normalized index list script pic

map lambda evaluation script pic

Unexpected error

infinite recursion script pic

This one just loops infinitely, even though it shouldn’t.

Okay, so, first of all, Snap! can already do what I think you want:

Second, I can’t read your code without getting a headache, but I’m quite sure that you can do what you want without using continuations, internal definitions, and giving a procedure itself as an input.

Third, I don’t see a use of MAP anywhere in your code.

Could you show us what output you expect from your example call to your block?