如何在Scheme中的列表中使用lambdas(How to use lambdas from a list in Scheme)
我在查找如何使用Scheme中列表中包含的lambda时遇到了一些麻烦。 例如,我有以下代码:
(define abc '((lambda (x) (* x x))))
我想从列表中取出第一个lambda并将其应用于某些数字。 这是我到目前为止:
(map (car abc) '(1 2 3))
但是,我收到以下错误:
;The object (lambda (x) (* x x)) is not applicable.
但是当我直接使用lambda尝试相同的东西时,它的工作原理是:
(map (lambda (x) (* x x)) '(1 2 3)) ;Value 15: (1 4 9)
有人能帮我理解我做错了吗?
I'm having some trouble figuring out how to use lambdas that are contained within lists in Scheme. For example, I have the following code:
(define abc '((lambda (x) (* x x))))
I would like to take the first lambda from the list and apply it to some numbers. Here is what I have so far:
(map (car abc) '(1 2 3))
However, I get the following error:
;The object (lambda (x) (* x x)) is not applicable.
But when I try the same thing directly using just the lambda, it works:
(map (lambda (x) (* x x)) '(1 2 3)) ;Value 15: (1 4 9)
Can someone help me understand what I am doing wrong?
原文:https://stackoverflow.com/questions/36808259
满意答案
您正在推送
--header
或-H
参数下的所有内容。 逐个使用。 像这个:-H "Authorization: OAuth" -H "oauth_nonce: XXXXXXe8558d961bd398f1" -H "oauth_timestamp: 1395304620"
Derp... server's system clock was out of sync (couple if minutes into ze future) so after setting it back to the here and now, requests are working again.
相关问答
更多Twitter API simplexml_load_string停止工作(Twitter API simplexml_load_string stop working)
Python Tweepy for Twitter API返回'错误401:未授权'(Python Tweepy for Twitter API returns 'error 401 : Unauthorized')
我的Twitter php脚本停止工作了!(My Twitter php script stopped working!)
Twitter搜索API:通过HTTParty“未经授权”但通过Curl成功(Twitter search API: “Unauthorized” through HTTParty but successful via Curl)
麻烦通过Python Twitter工具授权Twitter Streaming API(Troubles authorizing Twitter Streaming API through Python Twitter Tools)
Twitter的直播API未经授权(android)(Twitter's live streaming API unauthorized(android))
Twitter OAuth request_token停止工作(Twitter OAuth request_token stopped working)
Twitter返回未经授权的用户时间表,但不搜索(Twitter returns unauthorized for user timeline but not search)
tmhOauth twitter api停止使用update_with_media调用(tmhOauth twitter api stopped working with update_with_media call)
Twitter API停止工作(未经授权)(Twitter API stopped working (Unauthorized))
相关文章
更多Python 列表(list)操作
FreeMarker集合(List、Map)
A Great List of Windows Tools
Become a Master Designer: Rule Three: Contrast, Contrast, Contrast
源码解读Mybatis List列表In查询实现的注意事项
Solr4.2迁移到新项目下异常:java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.
Map、List集合类的清空使用clear还是重新new呢
hibernate 对list修改
List用完后需要赋null吗
java List排序一
最新问答
更多您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!