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
;; P17 (*) Split a list into two parts; the length of the first part is given. | |
;; Do not use any predefined predicates. | |
;; Example: | |
;; * (split '(a b c d e f g h i k) 3) | |
;; ( (A B C) (D E F G H I K)) | |
#lang racket | |
(provide (all-defined-out)) | |
(require srfi/1) | |
(define (split pos lst) | |
(take lst pos)) | |
(define (split-after pos lst) | |
(drop lst pos)) |
0 件のコメント:
コメントを投稿