Ideas for custom blocks

i need some ideas for some custom blocks to add to snapexLib.
you dont have to make the block i just need some ideas.

this is snapexLib by the way

Here's a much better way to write this block

This is sarcasm, right?

cool blocks!

i found something weird here: it give me an error...

snapexlib script pic

image

the bug occurs when the say block tries to run

No...

You could write blocks sharing a common theme.

A yet undeveloped theme in Snap! would be: "sets". A set is like a list, but the order of its elements doesn't matter; neither do repeats of the same element. So e.g. {1; 2} = {2; 1} = {1; 2; 2}. Like with a list, anything can be an element of a set, such as characters, strings, numbers, lists, functions, other sets ...: e.g.: {"a"; "word"; -56.45; (1, 2, "many"); IF () THEN () ELSE; {1; 2}}. There is exactly one empty set: {}.

For inspiration on which blocks to create you may want to look to other programming languages or, even better: Set (abstract data type) - Wikipedia.
If I were you, I would implement a set as a Snap! list, at least to start with.

A general tip: start by defining what the block should do, make a comment of it within the definition, e.g.:

snapexlib script pic

Have fun!

If you delete everything from the list, how do you get anything from the list?

Heh, I didn't test it. Here's a (hopefully) working script.

I think the map needs to be replaced with keep

You're right. I just made the script on my phone, and I wasn't really paying attention to the blocks.

What's the point of deleting and replacing the elements? So that you can use IS IDENTICAL TO on the result? I would just REPORT (KEEP ...)

I would report as well, but I am modifying a block from their library. The reason I'm deleting all, then adding the items back is to preserve the watcher.

Snappierly:

  1. That only works if list is a variable, and
  2. That sets it to a new list.

yes?it still removes all instances from that list

No, keep creates a new list; it does not modify the first list.
(What does yes?it mean?)

yes but it sets the original variable not the local one

You've really gotten into metaprogramming! It seems to be your first-choice solution to all problems.