As of July 2020, many blocks in Snap! have now been converted into "hyperblocks". Roughly speaking, a hyperblock is a block which intuitively handles both list and scalar values. A scalar value is simply a value which is not a list.
Hyperblocks allow us to write shorter (and arguably easier to understand) code in some places where we might have used the map function. For example, the +, x, and letter of blocks are all now hyperblocks, allowing us to write some familiar examples without map:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Hyperblocks can also replace the combine function. For example, consider the code below, which combines the given Strings using the combine block.
Since join is a hyperblock, you can also just provide it a list, and it'll join all of the elements.
Just like with map and combine, it takes a lot of practice to realize what exactly hyperblocks are capable of. Hyperblocks cannot fully replace map and combine. For example, suppose you wanted to sum a list of numbers. Since the plus block always returns a list of numbers when you provide it with a list (i.e. its range is "list" when one of its inputs is "list"), there's no way to use the plus block to sum a list. Instead, you'll have to use combine as shown below:
Try this:
Suppose we have a list of strings like this:
acronym-of-list
block that returns the first letter of each string, all joined together. As an example, see the image below. You should not use map or combine when creating your block!
In other words, your solution must utilize hyperblocks!
You'll notice that the resulting acronym is a little ugly, i.e. "UCB" would probably be a better choice than "UoCB". You'll make a better acronym block later in this lab.