[plt-scheme] Help with programming

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Apr 22 12:29:52 EDT 2010

Is this your homework assignment?

Robby

On Thu, Apr 22, 2010 at 11:19 AM, Joe Burk <joshwbfantasy at yahoo.com> wrote:

> Hey everyone, I'm a bit new to scheme and I'm looking for some help.
> Hopefully you guys can assist me. I was given these few questions and I have
> no clue where to start. So if anyone could answer them they would be of much
> help. Thanks.
>
> Consider the following functions:
>
> (define get-evens
>   (lambda (lst)
>     (cond ((null? lst) '())
>              ((even? (car lst)) (cons (car lst) (get-evens (cdr lst))))
>              (else (get-evens (cdr lst))))))
>
> (define get-odds
>   (lambda (lst)
>     (cond ((null? lst) '())
>              ((odd? (car lst)) (cons (car lst) (get-odds (cdr lst))))
>              (else (get-odds (cdr lst))))))
>
> (define get>2
>   (lambda (lst)
>     (cond ((null? lst) '())
>              ((> (car lst) 2) (cons (car lst) (get>2 (cdr lst))))
>              (else (get>2 (cdr lst))))))
>
> 1. Write another function that accepts a test as one of its arguments, and
> which can then behave like each of the above functions. Starting with:
>
>  (define extract
>    (lambda (test? lst)
>
>
> 2. Use extract to define get-evens, get-odds, and get>2
>
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100422/049689bb/attachment.html>

Posted on the users mailing list.