カードを作る
ハートの1
gosh> (string-append "h" (number->string 1)) "h1"
ハートの1から13
gosh> (define (make-heart i) (string-append "h" (number->string i))) make-heart gosh> (use srfi-1) #<undef> gosh> (iota 13 1 1) (1 2 3 4 5 6 7 8 9 10 11 12 13) gosh> (define (make-heart i) (string-append "h" (number->string i)) ) make-heart gosh> (map make-heart (iota 13 1 1)) ("h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9" "h10" "h11" "h12" "h13")
すべてのカードを作る
gosh> (define (make-spade i) (string-append "s" (number->string i))) make-spade gosh> (define (make-dia i) (string-append "d" (number->string i))) make-dia gosh> (define (make-club i) (string-append "c" (number->string i))) make-club gosh> (define cards (append (map make-spade (iota 13 1 1)) (map make-dia (iota 13 1 1)) (map make-club (iota 13 1 1)) (map make-heat (iota 13 1 1))) ) *** ERROR: unbound variable: make-heat Stack Trace: _______________________________________ 0 (map make-heat (iota 13 1 1)) At line 14 of "(stdin)" gosh> (define cards (append (map make-spade (iota 13 1 1)) (map make-dia (iota 13 1 1)) (map make-club (iota 13 1 1)) (map make-heart (iota 13 1 1))) ) cards gosh> cards ("s1" "s2" "s3" "s4" "s5" "s6" "s7" "s8" "s9" "s10" "s11" "s12" "s13" "d1" "d2" "d3" "d4" "d5" "d6" "d7" "d8" "d9" "d10" "d11" "d12" "d13" "c1" "c2" "c3" "c4" "c5" "c6" "c7" "c8" "c9" "c10" "c11" "c12" "c13" "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9" "h10" "h11" "h12" "h13")