i made a couple utility blocks, i’d love to hear feedback/optimizations for these!
![]()
![]()
![]()
What’s sad is I can’t drag and drop… (mobile) can you give a link to a shared project with them?
here ya go
try downloading it, then opening the file in snap. (I think it’s file → open → computer)
added some more blocks:
count (<> @>) in @list :: lists reporter
indices of (<> @>) in @list :: lists reporter
@arrowLeft keep items (<> @>) and map (() @>) over @list :: lists reporter
@turnForward keep items (<> @>) and map (() @>) over @list :: lists
for each ((item)) ((index)) in @list {
} @loopArrow :: lists
@arrowLeft swap (1 v) & ([last] v) in @list :: lists reporter
@turnForward swap (1 v) & ([last] v) in @list :: lists
also i removed the
blocks cus they aren’t really needed at all
You have
I would recommend that when writing tools to be used functionally (not mutating inputs), you implement them functionally:
or, even cooler,
You can download the images (tap and hold it) and then go to file > import in snap to select the image. It’ll be loaded as a costume, but you can tap and hold it and select get blocks".
Hi, i’ve noticed a little bug here :
you can also: (I don’t see this in the manual, idk if it’s a bug, Brian might be able to tell us about this.)
Another way, the catch and throw:
It isn’t a bug I’m pretty sure. Regardless, the more “official” way to do this is using stop [this block V].
I had forgotten about that one !
i would’ve gone with something like this, but I found it difficult to interpret each possibility for the index input, since you can choose an actual index, “last”, “parent”, “all”, and keys when using objects
Yeah that’s harder… I keep running into behaviors of primitives that I understand but find unhelpful, e.g., NUMBERS FROM counting backwards and ITEM ___ OF taking an empty list in the first input to mean reporting the entire list. :~(
I think the ‘worse’ definition is faster.
I think the ‘worse’ definition is faster.
Oh, I’m sure. I never think much about efficiency; I try to make the code readable. But try this:
the recursive definition is very elegant! I am trying to change that definition to make the dropdown options and the key-value pair feature work, but how does the parent option work?
some updates:
- fixed the switch-case block, per loucheman’s report and sathvikrias’ suggestion of
stop this block - made the index-selector inputs on the list blocks use a text input for keys support
- fixed an issue where the definitions for the mutating and non-mutating
swap items in listblocks were, ironically, swapped
were, ironically, swapped
:~D
but how does the parent option work?
If applied to a table that includes a key of “…” [name chosen so no translation is needed between (human) languages] whose value is another table, it reports that other table.







