如何在计划中重新创建应用程序 [英] How to recreate apply in scheme

查看:106
本文介绍了如何在计划中重新创建应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何在计划中创建函数apply?
一个my-apply函数,和它一样。

 (define(my-apply fn lst) 
(if(null?lst)

我不知道该从哪里出发或者如何开始。

解决方案

我认为 apply 是更基本的比 eval ,所以下面是作弊:

 (define( my-apply func args)
(eval`(,func,@ args)))

如果没有 eval ,我不认为你可以做到。


how would i create the function apply in scheme? A my-apply function that does the same thing as it.

 (define (my-apply fn lst)
 (if (null? lst)

I'm not sure where to go from here or how to start.

解决方案

I think apply is "more fundamental" than eval, so the following is cheating:

(define (my-apply func args)
  (eval `(,func ,@args)))

I don't think you can do it without eval.

这篇关于如何在计划中重新创建应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆