PLT Scheme 4.0 is out!
Typed Scheme is fun:
#lang typed-scheme (define-struct: Nothing ()) (define-struct: (a) Just ([v : a])) (define-type-alias (Maybe a) (U Nothing (Just a))) (: find (Number (Listof Number) -> (Maybe Number))) (define (find v l) (cond [(null? l) (make-Nothing)] [(= v (car l)) (make-Just v)] [else (find v (cdr l))])) |
Though I couldn’t even deconstruct a value returned by this function & docs are very scarce. And I really doubt the idea, but nevertheless it’s fun =)
June 17th, 2008 at 2331
Here’s an example of how to deconstruct such a value:
Thanks for trying Typed Scheme!
June 18th, 2008 at 1238
Oh, I’ll try that.
Thanks.