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

doing for loops assignment

Name: Anonymous 2010-10-24 12:10

I'm in a programming class and we have an assignment about for loops where we gotta shuffle a deck of cards. Can someone show me how to do this please? in return, tits

Name: Anonymous 2010-10-25 17:11

(define shuffle-list
   (lambda (l c)
     (if (zero? c)
     l
     (let-values ([(a b)
               (let ([half (floor (/ (length l) 2))])
             (values
              (let loop ([l l][n half])
                (if (zero? n)
                null
                (cons (car l) (loop (cdr l) (sub1 n)))))
              (list-tail l half)))])
       (shuffle-list
        (let loop ([a a][b b][l null])
          (cond
           [(null? a) (append (reverse b) l)]
           [(null? b) (append (reverse a) l)]
           [(zero? (random 2))
        (loop (cdr a) b (cons (car a) l))]
           [else
        (loop a (cdr b) (cons (car b) l))]))
        (sub1 c)))))))

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