jumble   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

;; jumble returns a randomized version of lst
(define jumble
   (lambda (lst)
      (let loop ((lstb '())
     (lsta (map (lambda (val) val) lst)))
   (if (null? lsta)
       lstb
       (let* ((rand (random (length lsta)))
        (val (list-ref lsta rand)))
    (loop (cons val lstb) (delete-at-index rand lsta)))))))


Back to Index