Racket - Match Function -
i'm learning how use "match" function in racket i'm not sure how can work in contexts.
for example, problem have use match replace every occurrence of lambda in program word "lumbda".
> (lambda->lumbda '(lambda (lambda) lambda)) (lumbda (lambda) lambda)
it should change function "lambda" "lumbda", not variables. have no clue how go this.
try this:
(define (lambda->lumbda exp) (match exp [(list 'lambda args body) (list 'lumbda args body)] [_ (error "unknown expression")]))
for example:
(lambda->lumbda '(lambda (lambda) lambda)) => (lumbda (lambda) lambda)
Comments
Post a Comment