On Oct 7, 2012, at 10:03 PM, Ashley Fowler wrote:
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) (cd
uot;cond: bad syntax (clause is not a
> test-value pair) in: ls"
> From: Matthias Felleisen [matth...@ccs.neu.edu]
> Sent: Monday, October 08, 2012 9:51 AM
> To: Ashley Fowler
> Cc: users@racket-lang.org
> Subject: Re: [racket] Delete Nth Term
>
>
> 3 versions,
n: ls"
From: Matthias Felleisen [matth...@ccs.neu.edu]
Sent: Monday, October 08, 2012 9:51 AM
To: Ashley Fowler
Cc: users@racket-lang.org
Subject: Re: [racket] Delete Nth Term
3 versions, all pass the test suite. Now write the function
pick-one-of-three : [List X X X] ->
3 versions, all pass the test suite. Now write the function
pick-one-of-three : [List X X X] -> X
and turn in.
#lang racket
(require rackunit)
;; Nat [Listof X] -> [Listof X]
;; delete the n-th item from l, if there is one
(module+
test
(check-equal? (deleteNth 4 '()) '())
(ch
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 '()) r
5 matches
Mail list logo