Racket language programming
Budget: $10 – $30 USD
So I have to write a church-compiling code:
churchify recursively walks the AST and converts each expression in the input language to an equivalent (when converted back via each church->XYZ) expression in the output language
(define (churchify e)
;(match e
;[_ 'todo]))
(match e
; Let
[`(let ([,x ,rhs]) ,body)
(churchify `((lambda (,x) ,body) ,rhs))]
; Curry Lambdas
[`(lambda () ,body)
`(lambda (_) ,(churchify body))]
[`(lambda (,x) ,body)
`(lambda (,x) ,(churchify body))]
[`(lambda (,x ,ys ...) ,body)
`(lambda (,x) ,(churchify `(lambda ,ys ,body)))]
there are certain test cases that the code needs to pass.
three of those test cases pass.
there are 19 in total
command: python3 tester.py -a -v
thank you.
churchify recursively walks the AST and converts each expression in the input language to an equivalent (when converted back via each church->XYZ) expression in the output language
(define (churchify e)
;(match e
;[_ 'todo]))
(match e
; Let
[`(let ([,x ,rhs]) ,body)
(churchify `((lambda (,x) ,body) ,rhs))]
; Curry Lambdas
[`(lambda () ,body)
`(lambda (_) ,(churchify body))]
[`(lambda (,x) ,body)
`(lambda (,x) ,(churchify body))]
[`(lambda (,x ,ys ...) ,body)
`(lambda (,x) ,(churchify `(lambda ,ys ,body)))]
there are certain test cases that the code needs to pass.
three of those test cases pass.
there are 19 in total
command: python3 tester.py -a -v
thank you.