l-99

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

commit 11863bd7888208e4616a36ba7061ffe8de7508e7
parent f9bc95b9cadce71c591ebe1de5333553e17724f4
Author: Jenny Doe <tng@soykaf.me>
Date:   Thu,  2 May 2019 14:31:18 +0200

added: p21.scm

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

diff --git a/p21.scm b/p21.scm @@ -0,0 +1,9 @@ +; (*) Insert an element at a given position into a list. +; Example: +; * (insert-at 'alfa '(a b c d) 2) +; (A ALFA B C D) + +(define (insert-at x ls n) + (if (= n 1) + (cons x ls) + (cons (car ls) (insert-at x (cdr ls) (- n 1)))))