On Wed, Nov 10, 2010 at 12:13 AM, John Clements
<cleme...@brinckerhoff.org> wrote:
> ;; NOW I'M A STUDENT:
>
> ;; only-long-strings : (listof string) -> (listof string)
> ;; return a list containing the strings longer than 2 chars
> (define/noloop (only-long-strings l)
>  (cond [(empty? l) empty]
>        [else (cond [(< 2 (string-length (first l)))
>                     (cons (first l)
>                           (only-long-strings (rest l)))]
>                    [else (only-long-strings l)])]))

gosh, students do suck.  I guess you teach them to use cond because
it's a generalized if.  But then they proceed to use it just like if:
always two conditions per (verbose) cond! :p

then again, may be someone who had previous exposure to lesser languages...
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to