I've made this to give a list of random unique numbers but I'm wondering if anyone has a more Snap!sh way of doing it
map(pick random(lower,upper)to(numbers from (lower)to(upper)))
bulitins
lmao
pick random is one block
the solution doesn't return unique numbers
ok
as @kinestheticlearning says - it doesn't produce a unique list of the number range
yep
or simpler
The insert X at random of list is definitely more Snap!ish
Came up with a more generic one based on @dardoro idea
which can take any list as its input and re-arrange it - not sure "jumble up" is the best name for it
It's a primitive in APL:
Did you reply to the wrong person?
Yeah, I guess. I just hit the first "reply" button I saw. Sorry.
9 posts were split to a new topic: Lists, empty lists, mutation, and their vicissitudes
This is an attempt to answer both snapenilk and Brian.
Semantically EQ(a, b) means that there is no way to tell the difference between a and b. It isn't different from EQUAL in languages that lack side-effects. Since in Lisp and Scheme there are no side effects on empty lists they are EQ. And in Lisp/Scheme there is no way to remove all the elements of a list to produce an empty list (as snapenilk asks).
One could define a programming language that insists the EQ be defined in terms of the internal implementation details but why constrain a language is such a way? It seems that Scheme underspecifies eq?
but does state "The empty list () is identical to itself wherever it appears." Also on the topic of Scheme it seems eqv?
is more like Snap's identical to
.
I brought up this discussion to suggest that the documentation highlights the fact that Snap!'s empty lists are very different from those of Scheme. As someone unfamiliar with side effects on empty lists I had troubles understanding add
and insert
. And it surprised me that two empty lists aren't identical (but given Snap!'s side effects on empty lists that is correct, just surprising).