l-99

solutions to l-99 (slow)
Log | Files | Refs | Feed

commit 53dfba5d66ba31aa72a2b742df51358a0c654aa2
parent 7affc18246ac28b2ed759cf03d8941d2a944f4b7
Author: Jenny Doe <tng@soykaf.me>
Date:   Thu, 28 Mar 2019 15:24:27 +0100

added: p16.scm

Diffstat:
Ap16.scm | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/p16.scm b/p16.scm @@ -0,0 +1,12 @@ +; (**) Drop every N'th element from a list. +; Example: +; * (drop '(a b c d e f g h i k) 3) +; (A B D E G H K) + +(define (drop ls n) + (let f ((ls ls) (x (- n 1))) + (if (null? ls) + '() + (if (zero? x) + (drop (cdr ls) n) + (cons (car ls) (f (cdr ls) (- x 1)))))))