add1 function from scheme to R5RS

2019-07-21 00:37发布

问题:

I've written some code but it's not working because the add1 function I used in Scheme is not working with R5RS. What can replace add1 in R5RS?

回答1:

The procedure add1 is very simple, you can implement it yourself:

(define (add1 x)
  (+ x 1))


回答2:

late answer but an alternative is (making use of lambdas)..

(define add1 
    (lambda (x)
        (+ x 1)))