[plt-scheme] What am I doing wrong?

From: Michael Coffin (mhcoffin at gmail.com)
Date: Sat Jul 26 16:07:47 EDT 2008

I'm probably doing something really dumb. When I run this program:

#lang scheme

(define (counts lst)
  (let ([tbl (make-hasheq)])
    (for ((item (in-list lst)))
         (hash-set! tbl item (add1 (hash-ref tbl item 0))))
    tbl))

(define x '(2 2 3 3 2))
(define c (counts x))
(define c> (counts (sort x >)))
(define c< (counts (sort x <)))

(for/or (((k v) (in-hash c))) (= v 2))
(for/or (((k v) (in-hash c<)))  (= v 2))
(for/or (((k v) (in-hash c>)))  (= v 2))

the result is

Welcome to DrScheme, version 4.0.2 [3m].
Language: Module.
#t
#t
#f
>

Why does the last loop evaluate to #f?

-mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080726/2a334dd2/attachment.html>

Posted on the users mailing list.