Gauche ユーザガイドの6.4 ペアとリストを読みながら実行した結果

gosh> (cons 'a 'b)
(a . b)
gosh> (cons 'a 'b)
(a . b)
gosh> (acons 'a 'b 'c)
((a . b) . c)
gosh> (make-list 10 1)
(1 1 1 1 1 1 1 1 1 1)
gosh> (list 1 2 3)
(1 2 3)
gosh> (list* 1 2 3)
(1 2 . 3)
gosh> (list-copy '(a b (c d)))
(a b (c d))
gosh> (car '(a b))
a
gosh> (cdr '(a b))
(b)
gosh> (set-car! '(a . b) 'c)
#
gosh> (let ((a '(a . b))) (set-car! a 'c) a)
(c . b)
gosh> (let ((a '(a . b))) (set-cdr! a 'c) a)
(a . c)
gosh> (caddr '(a b c d e f))
c
gosh> (car (cdr (cdr '(a b c d e f))))
c
gosh> (length '(a b c))
3
gosh> (list-tail '(a b c d) 3)
(d)
gosh> (list-tail '(a b c d) 0)
(a b c d)
gosh> (list-tail '(a b c d) 1)
(b c d)
gosh> (list-ref '(a b c d) 1)
b
gosh> (last-pair '(a . b))
(a . b)
gosh> (last-pair '(a b))
(b)
gosh> (append '(a b c) '(1 2))
(a b c 1 2)
gosh> (append! '(a b c) '(1 2))
(a b c 1 2)
gosh> (reverse '(a b c 1 2 3))
(3 2 1 c b a)
gosh> (reverse! '(a b c 1 2 3))
(3 2 1 c b a)
gosh> (memq 'a '(a b c))
(a b c)
gosh> (memq 'b '(a b c))
(b c)
gosh> (memq 'd '(a b c))
#f
gosh> (assoc 'a '(a b c))
#f
gosh> (assoc 'a '((a 1) (b 2) (c 3)))
(a 1)

コメント

人気の投稿