Id of list returning a deep copy and scattered other identify reporters

I asked in a previous thread about how to get a copy (e.g completely separate copy) of a list and @jens pointed out to use


which works great but I don't think it's right that this block makes a copy if it's a list but in all other cases it just returns the identify of its input.

Also, there is an unlabelled identity block in the list library and another one in the big nums library.

I feel this is no way to run a railroad :slight_smile:

There's obviously many ways to change things around to make things more consistent but I think that at least the library identity blocks could be deprecated in the manual and add note to point towards main id of block.

I personally would remove the copy list facility from the id block as its an auto-magical step too far and have a separate list library block called deep copy

And/or add an operator copy block to the sqrt block in addition to the id option

Okay, so, the trouble with having ID as an option in the SQRT block is that its input is of type Number, so you can't type arbitrary text into it. I would have made it a separate block, myself. In the case of the Bignums library, that's the whole reason why it needs an identity block in the first place: Since the library also implements exact rationals and complex numbers, you need to be able to use things like 3/4 or 4+7i as inputs to (any of) the numeric functions. That green identity function block doesn't have a name because I thought it should as much as possible blend in, not call attention to itself, because it's really just a workaround and you oughta be able to type any kind of number directly into a Number input slot.

As for the red identity function block in the list utility library, it's a helper for MULTIMAP, again to solve a syntactic problem, but a different one, namely there's otherwise no good way to get an empty input slot into the INPUT LIST: form of a CALL inside a MAP. Eventually when we work out the details of how to hide helper procedures of a library that one will (effectively) go away.

So, that answers the part about why there's more than one identity function. As to why ID copies a list, I think you think that we specially implemented that as a special case. But actually it was a serendipitous result of how the hyperblock feature works in general. When you say triples script pic it doesn't take the square root of the list; it takes the square roots of the three numbers in the list. And the same is true for any of the other functions in that block's menu, including ID. So you're not taking ID of the list; you're taking ID of each item of the list individually.

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