About Map/Keep/Combine

Hi everybody,
Happy to share this research article on the power of the Snap! Map/Keep/Combine trio as a tool for teaching Mathematics and CS.
Have fun !

The fourth bullet should say "un membre d'une liste." A number, for example, isn't a list, but can be an item in a list. :~)

Eh? That can't work, can it?

Thank you @bh.
It's done.

Nathalie

Yes, it works, with the examples I tested.

Did I miss something ?

Weird. It shouldn't work! The domain of OR is Booleans, not lists, so when you give it two lists as inputs it should preferably give an error message but failing that, since it evaluates its input expressions left to right, it should report the first input.

Oh. I get it. OR has become a hyperblock! Originally Jens said we couldn't do that because of its left-to-right evaluation. So if you give it two lists as inputs, it ORs them termwise. Here are some experiments:
untitled script pic





untitled script pic (6)
And the pièce de résistence:

because reporter IF has become hyperized too.

Was this how you understood it? I thought you were making the common kid mistake of reading the blocks as if they were English: "If x or y is empty..." (Or "si x ou y est vide..."!)

I got really confused because the first of my experiments is inconsistent with the termwise behavior:
untitled script pic


I guess that's a bug, but I'm not sure which should be changed!

In Tri par sélection using KEEP means that it won't work for lists including equal elements. You should only remove one copy.

In footnote 80, two things: (1) There's no such thing as the University of Berkeley. It's "the University of California, Berkeley." Like "the University of Paris, Vincennes." (2) A "Teaching Professor Emeritus" is different from a "Professor Emeritus." I'm not sure how to translate "Teaching Professor" to French; is there such a position in French universities? It means a full-time teaching position, with no time for (or requirement of) research. It's a lower-status position.

... oh, duh, speaking of hyperblocks, I only just now realized that you don't need opérateur_d_ordre_superieur at all, because the × block does that all by itself! :~)

Hi @bh,
Of course I don't. I just did it to explain to the readers the way I coded it in Python.

@bh, I fixed this.

I don't understand this. How ?

Thank you @bh for your Remove one copy script. But it seems that I don't need it because I came back to some tests and my Tri by selection script works :

Oops, I can't read! I thought you were keeping items not the same value as the number you're removing, but you did it by finding just one index.

It feels strange, by the way, to remove an item, knowing its position, by comparing every item's position against it. The non-functional approach lets you just point directly at that item and remove it by mutation. Maybe we should invent a block ALL BUT ITEM (n) OF (list) to handle this situation?

No! It's super easy to make now.

Or

I used the temp variable to make sure that I'm not modifying the original list.

INDEX != 5, not INDEX = 5.

Anyway, the first way is O(n) whatever the index is. The second way doesn't have that problem, but it's uglier.

You're right, I was thinking the opposite.

I agree that the second way is uglier.

Instead you can do this

What about in a custom block? You can't have an input make a copy of its contents.