How does scramble function works? (Chapter 1 of The Seasoned Schemer)
According to the book, this is what the function definition is, The function scramble takes a non-empty tuple in which no argument is greater than its own index and returns a tuple of same length. Each number in the argument is treated as a backward index from its own position to a point earlier in tuple. The result at each position is obtained by counting backward from the current position according to this index. And these are some examples, ; Examples of scramble (scramble '(1 1 1 3 4 2 1 1 9 2)) ; '(1 1 1 1 1 4 1 1 1 9) (scramble '(1 2 3 4 5 6 7 8 9)) ; '(1 1 1 1 1 1 1 1 1) (scramble '(1 2
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.