[racket] Delete Nth Term

From: Ashley Fowler (afowler2 at broncos.uncfsu.edu)
Date: Sun Oct 7 22:03:32 EDT 2012

I need help with making a function that deletes the nth term from a list.(list LS with its Nth element (with indexes starting at 0) deleted)
So far I have

(define (deleteNth N ls)
    (if (null? ls)
        ls
        (deleteNth (- N 1) (cdr ls))))

The results should be ...


(deleteNth 4 '()) returns ()
(deleteNth 0 '(a b c)) returns (b c)
(deleteNth 3 '(a b c)) returns (a b c)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121008/b3b84b7e/attachment.html>

Posted on the users mailing list.