File:Bloodwar.jpg
Summary
Blood War Booster Pack
Licensing
gollark: I actually stole this particular quicksort from a r/haskell post talking about it.
gollark: ```lisp (let (partition_rec xs pred acc) (cond ((= xs '()) acc) (true (partition_rec (tail xs) pred (cond ((pred (head xs)) (list (cons (head xs) (head acc)) (snd acc))) (true (list (head acc) (cons (head xs) (snd acc)))) ))) )) (let (qsort xs cont) (cond ((= xs '()) (cont '())) (true (do (let h (head xs)) (let t (tail xs)) (let part_result (partition_rec t (lambda (x) (< x h)) '(() ()))) (qsort (head part_result) (lambda (ls) (qsort (snd part_result) (lambda (rs) (cont (+ ls (list h) rs)))))) )) ))```These all have to be done tail recursively or it could overflow.
gollark: Continuation passing style quicksort in a hilariously slow interpreter.
gollark: It manages *1* second, which is great.
gollark: When writing osmarkslisp™, I cared about performance to the extent that it would sort a list of 200 integers in under 5 seconds.
This article is issued from Dandwiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.