[plt-scheme] eliminate expensive toys: please critique the solution

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Wed Feb 11 06:43:51 EST 2004

A few possible solutions:

Internal Define:

 (define (e-e thresh tl)
   (define (e-e-internal ...)
      ... )
   (e-e-internal empty thresh tl))


  (define (e-e thresh t1)
    (letrec ((e-e-internal ...))
       (e-e-internal ...))

Simple recursion:

  (define (e-e thresh t1)
     (cond [(empty? t1) (list)]
           [(> (first t1) thresh)
             (e-e thresh t1)]
           [else (cons (first t1)
                       (e-e thresh (rest t1)))]))

BTW, you could use better variable names.  t1 is
hardly descriptive.


Email: noelwelsh <at> yahoo <dot> com
Jabber: noelw <at> jabber <dot> org

Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.

Posted on the users mailing list.