Hi Bob

Here's how I'd write your function using for*/sum:

(define (count-primes-in-seq/2 f bound)
  (for*/sum ([n (in-range bound)]
             [k (in-value (f n))]
             #:when (and (positive? k) (prime? k)))
    1))

Performance is similar to your original.

Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFKxZVVj3Z8jdUA69yCuzX%2BLZ3bv__i7d-jW43RfX3QC4FmHcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to