Loading [MathJax]/extensions/tex2jax.js

2010年7月15日木曜日

Split a list into two parts; the length of the first part is given

;; 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))
view raw p17.ss hosted with ❤ by GitHub

0 件のコメント:

コメントを投稿