Skip to content

Instantly share code, notes, and snippets.

@serian
Created May 1, 2010 15:26
Show Gist options
  • Save serian/386417 to your computer and use it in GitHub Desktop.
Save serian/386417 to your computer and use it in GitHub Desktop.
scheme list truncate
;リストを指定された長さに切り詰める
;scheme
(define (list-truncate lst num)
(cond ((<= (length lst) num) lst)
(else
(let ((dummy (make-list num)))
(map (lambda (pre post)
pre)
lst dummy)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment