L-99
まだ、doで何とかなる。 ;;; ;;; P03 (*) Find the K'th element of a list. ;;; The first element in the list is number 1. ;;; Example: ;;; * (element-at '(a b c d e) 3) ;;; C (defun element-at (list index) (do ((l list (cdr l)) (i 1 (1+ i))) …
doで実装。一つ手前のcons cellをresultへ保持。 ;;; ;;; P02 (*) Find the last but one box of a list. ;;; Example: ;;; * (my-but-last '(a b c d)) ;;; (C D) (defun my-but-last (list) (let ((result nil)) (do ((l list (cdr l))) ((not (consp (cdr…
PAIP読書会で知り合ったid:g000001さんから、L-99を勧められたので挑戦してみる。 取りあえず1問目から。doで実装してみる。 ;;; ;;; P01 (*) Find the last box of a list. ;;; Example: ;;; * (my-last '(a b c d)) ;;; (D) (defun my-last (list) (do ((l…