Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Scheme/Racket

Name: Anonymous 2012-11-19 14:07

Can someone explain this shit to me?


CODE
(define insertion-sort
  (lambda (lst)
    (if (null? lst)
        '()
        (insert (car lst)
                (insertion-sort (cdr lst))))))

(define insert
  (lambda (elt sorted-lst)
    (if (null? sorted-lst)
        (list elt)
        (if (<= elt (car sorted-lst))
            (cons elt sorted-lst)
            (cons (car sorted-lst)
                  (insert elt (cdr sorted-lst))))))))
 

 RESULT
(insertion-sort '(5 9 8 4 2))
(2 4 5 8 9)

Name: Anonymous 2012-11-20 10:32

>>12
Symta:
f l @ . $ ! [-] a - + / 54adsfasdfasdfadsf

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List