# 6.7.2 released!

it seems like all the # for each item in ≡ feature requests haven't been implemented yet even though bh said "next release".

What did I say that about? I've been trying hard not to make such promises except about known bugs for which we have fixes. This is a maintenance release, not a new feature release.

https://forum.snap.berkeley.edu/t/refresh-problem-with-for-each-item-of-list/5755/4

Ack! Right you are. I made a new library, stashed it in my local copy of the repo, and then forgot why I'd done so. I've made a pull request for it. Thanks for reminding me.

I also made the library FOR EACH not substitute items into empty input slots, sad as that makes me, so that it conforms with the new behavior of the primitive FOR EACH.

run still does, so:

[scratchblocks] for each ((item) :: list) of @list { run ({... :: #bbbbbb} @addInput :: grey ring) with inputs: (item) :: control } :: list [/scratchblocks]

Thanks, but you're missing the point. It would defeat the object of the exercise to add more, and more complicated, code to get back implicit input substitution.

The reason we have implicit substitution in the HOFs (the work is done by RUN or CALL, but it's for the sake of the HOFs) is so that beginners can have the benefit of anonymous functions without having to think about anonymous functions. You say ⃞+3 and that just makes it obvious that something has to go in the empty box. And there hasn't been any complaint about that, except, as users take on harder challenges, that it doesn't work inside nested MAPs.

FOR EACH is a funny hybrid: It traverses a list, like a HOF, but it's also a loop, like FOR. So when we built it we put in two ways to get at the list item, implicit substitution like a HOF and an upvar like FOR. And that would all be entirely fine if text strings had to have punctuation around them, as in text languages. If you wanted an empty string you'd put "" in the input slot, and you wouldn't be surprised to get substitution into an empty slot. (I'm not suggesting this! I'm just doing a gedankenexperiment to make a point.) But in fact the meaning of empty slots is way overloaded. Besides input substitution and the empty text string, it also means 0 in numeric slots and False in Boolean slots. So people kept tripping over that, and finally I gave in.

So we now officially think of FOR EACH as being more like FOR than like a HOF.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.