add1 function from scheme to R5RS

自古美人都是妖i 提交于 2019-12-10 23:25:13

问题


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)))


来源:https://stackoverflow.com/questions/13292094/add1-function-from-scheme-to-r5rs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!