Ziping & unziping variables

Can you make blocks similar to the ones in zip & unzip variables?

Two points:

  1. In general, if someone has already implemented something in Snap! itself, that means that it can be implemented with Snap! code. So why do you need it as a primitive? If we made every possibly useful block a primitive, there would be thousands of primitives (hash tables, polygons, polyspirals, speed up sounds, typed variables... those are just a few of the things that have come up before) and you couldn't find the one you want anyway. It used to be an absolute rule for us that if something can be done in Snap!, we won't add a primitive for it. As of 5.0 we started adding primitives for cases in which the Snap! implementation was very slow and needed to be very fast, such as MAP. But your blocks aren't slow in the Snap! project's implementation; they don't deal with very large data structures.

  2. About those specific blocks, there's no need for you to use variables at all for that purpose. The structure that your ZIP builds, which is called an association list by Lisp people or a dictionary by outsiders, handles your need without having to create a bunch of variables. (That is, instead of variables a, b, and c in that project, you just call ASSOC (a) (abc) supposing abc is the association list. ASSOC is in the List Utilities library.)

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