首页 \ 问答 \ 使用lambda的方案(scheme using lambda)

使用lambda的方案(scheme using lambda)

我在方案中有一段使用几个lambdas的代码。 它基本上返回一个中间的数字。

(define foo
  (lambda (x)
    (letrec
      ((h (lambda (y z)
        (cond
          ((null? y) 'undefined)
          ((null? (cdr y)) (car z))
          (else (h (cddr y) (cdr z)))))))
  ((lambda (y) (h y y)) x))))

我必须重写代码,所以它不使用任何lambda。 我怎么做?


I have a piece of code in scheme that uses several lambdas. It basically returns a number that's in the middle.

(define foo
  (lambda (x)
    (letrec
      ((h (lambda (y z)
        (cond
          ((null? y) 'undefined)
          ((null? (cdr y)) (car z))
          (else (h (cddr y) (cdr z)))))))
  ((lambda (y) (h y y)) x))))

I have to rewrite the code so it doesn't use any lambda. How do I do that?


原文:https://stackoverflow.com/questions/10860734
更新时间:2021-12-07 14:12

最满意答案

我会尝试: data: 'url=' + JSON.stringify(['www.google.com','www.yahoo.com']),


I would try: data: 'url=' + JSON.stringify(['www.google.com','www.yahoo.com']),

相关问答

更多
  • 尝试异步加载脚本时会出现一些常见错误。 这段代码应该有效: function loadScript(src, callback) { var s, r; s = document.createElement('script'); s.src = src; s.onload = s.onreadystatechange = function () { /** * LOAD/READYSTATE LOGIC * execute if the script hasn't been ...
  • 您不能使用标准的Ajax跨域。 浏览器强制执行“相同域”策略。 您必须使用JSONP。 http://en.wikipedia.org/wiki/JSONP 在此页面中搜索“jsonp”以开始使用jQuery与jSONP: http : //api.jquery.com/jQuery.ajax/ 一个更简单的解决方案可能就是这样: var recURL='http://mysite/com/recommend.php?url=' + encodeURIComponent(document.URL); ...
  • 转到页面。 打开开发人员工具(在chrome中使用ctrl + shift + j)并将代码粘贴到控制台中以查看错误。 $ in in var leadStories = $(".cnnTransSubHead").text(); 来自jQuery,提供的链接没有加载到页面中的jQuery。 在任何现代浏览器上,您应该能够在没有jQuery的情况下获得相同的结果: var leadStories = document.getElementsByClassName('cnnTransSubHead') ...
  • 更改 document.onmouseup=new Function("isdrag=false"); 至 document.onmouseup = function() {isdrag=false}; 原因:当您将所有代码包装在外部功能块中以创建书签时,“var isdrag”的范围将从窗口级别更改,并成为该外部函数的本地。 另一方面, new Function("isdrag=false")在窗口级别创建一个新函数,转义当前作用域,新创建的函数中的“isdrag”无法访问您认为正在访问的“var i ...
  • 我会尝试: data: 'url=' + JSON.stringify(['www.google.com','www.yahoo.com']), I would try: data: 'url=' + JSON.stringify(['www.google.com','www.yahoo.com']),
  • 我怀疑如果你在浏览器中查看javascript控制台,你会发现它拒绝了跨站点请求。 Asana API目前不支持CORS (虽然我们计划将来使用),因此通常的规则适用:您只能向同一主机发出请求:端口作为当前网站。 I suspect that if you check the javascript console in your browser you'll see that it's rejecting the cross-site request. The Asana API doesn't curre ...
  • 我决定遵循使用iframe的有点实现,这似乎是阻止css和js mashup以及搞乱问题的最佳选择...... I decided to follow the bitly implementation of using an iframe which seemed to be the best possible option to prevent the css and js mashup and mess up issues...
  • 对于空白页问题,您不应该返回false ,并且由于您使用的是自动调用匿名函数,因此您只需删除 return语句即可。 函数默认情况下,当函数体上没有return语句时,它们返回undefined值,这将阻止导航到空白页面。 例如: javascript:(function () { return false; })(); 将显示一个空白页面,其中包含返回值的字符串表示形式,在这种情况下为“false”。 javascript:(function () {})(); 浏览器无法导航。 之后我有几点评论: ...
  • 将脚本添加到网页的正确方法是: var scriptNode = document.createElement('script'); scriptNode.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(scriptNode); 请尝试一下,它适用于IE8。 The correct way to add a script to a web page would be: var scriptNode ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)