Applying a symbol as a procedure

后端 未结 3 1032
囚心锁ツ
囚心锁ツ 2021-01-21 19:32

Suppose I have a simple symbol:

> \'+
+

Is there any way I can apply that symbol as a procedure:

> ((do-something-with \'         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-21 19:52

    Newbie too so hope I've understood your question correctly...

    Functions are first class objects in scheme so you don't need eval:

    1 ]=> (define plus +)
    
    ;Value: plus
    
    1 ]=> (plus 2 3)
    
    ;Value: 5
    

    HTH

    Update: Ignore this and see the comments!

提交回复
热议问题