Created
May 1, 2010 15:26
-
-
Save serian/386417 to your computer and use it in GitHub Desktop.
scheme list truncate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;リストを指定された長さに切り詰める | |
;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