Hello,

The example in the documentation for using #:result with for/fold, here: 
https://docs.racket-lang.org/reference/for.html?q=for%2Ffold#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%2Ffold%29%29
works in normal racket, but not typed racket.

I suppose that isn't really a bug, but something simply left out, and a 
user can simply implement the macro themselves?

Additionally, regarding occurrence typing:

This works:

> (for ([x (in-list '("123" "432" "234"))])
    (define num (string->number x))
    (unless num
      (error "Not a number"))
    (display (format "~s" (* num 2))))
246864468

But this doesn't typecheck:

> (for ([x (in-list '("123" "432" "234"))])
    (define num (string->number x))
    (unless num
      (error "Not a number"))
    (define double (* num 2))
    (display (format "~s" double)))
. Type Checker: type mismatch
  expected: Number
  given: (U Complex False) in: num

Am I missing something here?

I'm running the code in DrRacket, using v7.1.

Regards,
Hashim.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to