Talk:Best shuffle: Difference between revisions

(→‎Common Lisp: new section)
(→‎Common Lisp: more code)
Line 174:
(coerce (mapcar 'cdr (sort tagged #'> :key 'car)) 'string)))
 
(defun compare-string (seq sqe)
(map 'list 'shuffle '("abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"))
(format t "~S ~S (~S)~%" seq sqe (count T (mapcar (lambda (x y) (equalp x y))
("rbcarabdaaa" "wassee" "ekl" "rrrrrgr" "up" "a")</lang>
(loop for char across seq collect char)
(loop for char across sqe collect char)))))
(maplet 'list 'shuffle((input '("abracadabra" "seesaw" "elk" "grrrrrr" "up" "a")))
(map 'nil 'compare-string input (map 'list 'shuffle input)))
"abracadabra" "rabrbadcaaa" (3)
"seesaw" "aeswse" (1)
"elk" "kle" (1)
"grrrrrr" "rgrrrrr" (5)
"up" "pu" (0)
"a" "a" (1)
NIL</lang>
:--[[User:EMBee|eMBee]] 07:21, 14 October 2011 (UTC)
Anonymous user