Artyom,

> (provide/contract
>    [interp  (-> AE? number?)])
>
> ;; interpret an arithmetical expression yielding a number
> (define (interp exp)
>   ;; type-case is very much like a "case ... of" in Haskell/ML
>   (type-case AE exp
>     (num (n) n)
>     (plus (l r) (+ (interp l) (interp r)))
>     (sub (l r) (- (interp l) (interp r)))))
>

It also looks like clojure condp.

Emeka

>
> Contracts work only between module boundaries though.
>
> Cheers,
> Artyom Shalkhakov.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to