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
;; P18 (**) Extract a slice from a list. | |
;; Given two indices, I and K, the slice is the list containing the elements between the I'th and K'th element of the original list (both limits included). Start counting the elements with 1. | |
;; Example: | |
;; * (slice '(a b c d e f g h i k) 3 7) | |
;; (C D E F G) | |
(require srfi/1) | |
(define (slice lst i k) | |
(drop (take lst k) (- i 1))) |
0 件のコメント:
コメントを投稿