What’s new in v8.1.1?

Here's another question / comment / bug report (?) regarding an item in the Snap 8.1 New features list:

Shouldn't untitled script pic (40) report the same result as untitled script pic (41) ?
For lists, at least (I am aware that PIPE works on non-list data as well).

E.g. untitled script pic (44) reports a list (1 4 9 ... 100), and so does untitled script pic (45).

But it's not always like that.

I tried untitled script pic (42) versus
untitled script pic (43). The PIPE version reports a string: #12345678910, whereas the MAP-version reports a list: (#1 .. #10).

Question: is it a bug, or intended behavior? (and if the latter: why?)

If you load an older version of Snap! you'll see the internals of the pipe command

As you can see - it uses
untitled script pic (68)
which ends up as this
untitled script pic (69)

So, if you want to map, you need to be explicit :slight_smile:
untitled script pic (70)

OK, thanks for explaining. And (I didn’t know) the JOIN function literally joins anything that’s within a list, including sublists of any depth.

I find the following a bit worrisome
untitled script pic (80)
untitled script pic (79)

Yes in one case random is in italics but this isn't good. When thinking about the textual equivalent of a Snap! script we now have to pay attention to italics?

@toontalk : What do you expect from people who think identifiers should be case-sensitive? This is just one more example of giving decorations semantic content. Having said that, the case of "random" as a tag probably won't come up very often in practice. (Well, unless people are making a-lists in which the data are blocks and the keys are strings that label the blocks.)

@qw23 : It's neither a bug nor a feature, but rather two features interacting in unexpected ways. As @cymplecy points out, the old library PIPE does the same thing. It's not a surprise that JOIN joins its inputs! And it's not a surprise that PIPE computes each expression once, giving it the entire data input to PIPE. And it's not a surprise that MAP computes the expression separately for each item of its input. But using JOIN with PIPE and MAP makes a surprise out of the combination. The more expected thing to do would be (PIPE (MAP (JOIN ...) ( )) ...).

Saying that a different way, PIPE isn't meant to be a substitute for MAP. If you want MAP you should ask for it. What PIPE does is a substitute for nested procedure calls. Something that might contribute to user confusion is that in some cases hyperblocks are a substitute for MAP.

We've had a real blizzard of new features lately, large and small. I'm not surprised that users are bumping into unexpected results. With luck that'll settle down as users become familiar with the new features. If a year from now we're still getting the same questions from bunches of users, we'll have to reconsider the UI.

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