recursion schemes

41 views
Skip to first unread message

Raoul Schorer

unread,
Jul 14, 2019, 11:21:14 PM7/14/19
to Racket Users
Hi,

I recently became interested in recursion schemes, and I noticed that almost all implementations are in typed languages. I understand the advantage of having an implementation using recursion at the type level, but why is it that there are so few material in untyped languages?

For instance, would a recursion schemes racket lib be useful or is there something I am missing? I noticed that there is no such lib, currently.

Thanks,
Raoul

江泽民

unread,
Jul 15, 2019, 2:54:25 AM7/15/19
to Racket Users
Actully racket pattern matching syntax has already supported recursion scheme(catamorphism):

(define (eval-expr e)
 
(match e
   
[`(+ ,(app eval-expr e0) ,(app eval-expr e1))
     (+ e0 e1)]
    [`
(- ,(app eval-expr e0) ,(app eval-expr e1))
     
(- e0 e1)]
   
[(? number?) e]
   
))


在 2019年7月15日星期一 UTC+8上午11:21:14,Raoul Schorer写道:
Reply all
Reply to author
Forward
0 new messages