E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
sicp
【
SICP
练习】150 练习4.6
练习4-6原文Exercise4.6.Letexpressionsarederivedexpressions,because(let(()…()))isequivalentto((lambda(…)))Implementasyntactictransformationlet->combinationthatreducesevaluatingletexpressionstoevaluatingcom
NoMasp
·
2015-04-01 08:00
lambda
lisp
eval
let
expr
【
SICP
练习】149 练习4.5
练习4-5原文Exercise4.5.Schemeallowsanadditionalsyntaxforcondclauses,(=>).Ifevaluatestoatruevalue,thenisevaluated.Itsvaluemustbeaprocedureofoneargument;thisprocedureistheninvokedonthevalueofthe,andtheresul
NoMasp
·
2015-03-31 17:00
for
value
Argument
syntax
cond
【
SICP
练习】148 练习4.4
练习4-4原文Exercise4.4.Recallthedefinitionsofthespecialformsandandorfromchapter1:●and:Theexpressionsareevaluatedfromlefttoright.Ifanyexpressionevaluatestofalse,falseisreturned;anyremainingexpressionsareno
NoMasp
·
2015-03-31 13:00
expression
CHAPTER
Forms
【
SICP
练习】147 练习4.3
练习4-3原文Exercise4.3.Rewriteevalsothatthedispatchisdoneindata-directedstyle.Comparethiswiththedatadirecteddifferentiationprocedureofexercise2.73.(Youmayusethecarofacompoundexpressionasthetypeoftheexpres
NoMasp
·
2015-03-29 19:00
rewrite
Data
eval
compare
car
【
SICP
练习】146 练习4.2
练习4-2原文Exercise4.2.LouisReasonerplanstoreorderthecondclausesinevalsothattheclauseforprocedureapplicationsappearsbeforetheclauseforassignments.Hearguesthatthiswillmaketheinterpretermoreefficient:Sincep
NoMasp
·
2015-03-29 19:00
BEFORE
for
eval
cond
applications
【
SICP
练习】145 练习4.1
练习4-1原文Exercise4.1.Noticethatwecannottellwhetherthemetacircularevaluatorevaluatesoperandsfromlefttorightorfromrighttoleft.ItsevaluationorderisinheritedfromtheunderlyingLisp:Iftheargumentstoconsinlist-
NoMasp
·
2015-03-29 16:00
【
SICP
练习】144 练习3.82
练习3-82原文Exercise3.82.Redoexercise3.5onMonteCarlointegrationintermsofstreams.Thestreamversionofestimate-integralwillnothaveanargumenttellinghowmanytrialstoperform.Instead,itwillproduceastreamofestimate
NoMasp
·
2015-03-29 15:00
Stream
version
redo
integration
Argument
【
SICP
练习】143 练习3.81
练习3-81原文Exercise3.81.Exercise3.6discussedgeneralizingtherandom-numbergeneratortoallowonetoresettherandom-numbersequencesoastoproducerepeatablesequencesof“random”numbers.Produceastreamformulationofthis
NoMasp
·
2015-03-29 15:00
reset
sequence
Random
number
generator
【
SICP
练习】142 练习3.77
练习3-77原文Exercise3.77.Theintegralprocedureusedabovewasanalogoustothe“implicit”definitionoftheinfinitestreamofintegersinsection3.5.2.Alternatively,wecangiveadefinitionofintegralthatismorelikeintegers-st
NoMasp
·
2015-03-29 11:00
Stream
procedure
section
Definition
infinite
【
SICP
练习】141 练习3.72
练习3-72原文Exercise3.72.Inasimilarwaytoexercise3.71generateastreamofallnumbersthatcanbewrittenasthesumoftwosquaresinthreedifferentways(showinghowtheycanbesowritten).代码(define(squarex)(*xx)) (define(sum-s
NoMasp
·
2015-03-29 11:00
代码
Stream
SUM
generate
written
【
SICP
练习】140 练习3.71
练习3-71原文代码(define(Ramanujans)(define(stream-cadrs)(stream-car(stream-cdrs)))(define(stream-cddrs)(stream-cdr(stream-cdrs)))(let((scar(stream-cars))(scadr(stream-cadrs)))(if(=(sum-triplescar)(sum-tripl
NoMasp
·
2015-03-29 11:00
Stream
define
【
SICP
练习】139 练习3.70
练习3-70原文代码(define(merge-weighteds1s2weight)(cond((stream-null?s1)s2)((stream-null?s2)s1)(else(let((cars1(stream-cars1))(cars2(stream-cars2)))(cond((<(weightcars1)(weightcars2))(cons-streamcars1(merge-
NoMasp
·
2015-03-29 10:00
【
SICP
练习】138 练习3.69
练习3-69原文代码 (define(triplesstu)(cons-stream(list(stream-cars)(stream-cart)(stream-caru))(interleave(stream-map(lambda(x)(cons(stream-cars)x))(stream-cdr(pairstu)))(triples(stream-cdrs)(stream-cdrt)(str
NoMasp
·
2015-03-29 10:00
Stream
map
lambda
define
car
【
SICP
练习】137 练习3.68
练习3-68原文Exercise3.68.LouisReasonerthinksthatbuildingastreamofpairsfromthreepartsisunnecessarilycomplicated.Insteadofseparatingthepair(S0,T0)fromtherestofthepairsinthefirstrow,heproposestoworkwiththewh
NoMasp
·
2015-03-29 10:00
Stream
REST
SICP
building
pairs
【
SICP
练习】136 练习3.67
练习3-67原文Exercise3.67.Modifythepairsproceduresothat(pairsintegersintegers)willproducethestreamofallpairsofintegers(i,j)(withouttheconditioni
NoMasp
·
2015-03-29 10:00
Stream
Condition
procedure
hint
pairs
【
SICP
练习】135 练习3.66
练习3-66原文Exercise3.66.Examinethestream(pairsintegersintegers).Canyoumakeanygeneralcommentsabouttheorderinwhichthepairsareplacedintothestream?Forexample,abouthowmanypairsprecedethepair(1,100)?thepair(99
NoMasp
·
2015-03-29 10:00
Stream
for
into
EXAMINE
pairs
【
SICP
练习】134 练习3.65
练习3-65原文Exercise3.65.Usetheseriesln2=1-1/2+1/3-1/4+……tocomputethreesequencesofapproximationstothenaturallogarithmof2,inthesamewaywedidabovefor.Howrapidlydothesesequencesconverge?代码(define(ln2-summands
NoMasp
·
2015-03-28 23:00
for
SICP
lisp
series
compute
【
SICP
练习】133 练习3.64
练习3-64原文Exercise3.64.Writeaprocedurestream-limitthattakesasargumentsastreamandanumber(thetolerance).Itshouldexaminethestreamuntilitfindstwosuccessiveelementsthatdifferinabsolutevaluebylessthanthetoler
NoMasp
·
2015-03-28 23:00
Stream
local
limit
arguments
EXAMINE
【
SICP
练习】132 练习3.63
练习3-63原文Exercise3.63.LouisReasoneraskswhythesqrt-streamprocedurewasnotwritteninthefollowingmorestraightforwardway,withoutthelocalvariableguesses:(define(sqrt-streamx)(cons-stream1.0(stream-map(lambda(
NoMasp
·
2015-03-28 23:00
div
for
power
define
series
【
SICP
练习】131 练习3.62
练习3-62原文Exercise3.62.Usetheresultsofexercises3.60and3.61todefineaprocedurediv-seriesthatdividestwopowerseries.Div-seriesshouldworkforanytwoseries,providedthatthedenominatorseriesbeginswithanonzerocons
NoMasp
·
2015-03-28 22:00
div
for
power
define
series
【
SICP
练习】130 练习3.61
练习3-61原文代码(define(reciprocal-seriess)(cons-stream1(scale-stream(mul-series(stream-cdrs)(reciprocal-seriess))-1)))感谢访问,希望对您有所帮助。欢迎关注或收藏、评论或点赞。为使本文得到斧正和提问,转载请注明出处:http://blog.csdn.net/nomasp
NoMasp
·
2015-03-28 22:00
Stream
scale
define
series
【
SICP
练习】129 练习3.60
练习3-60原文Exercise3.60.Withpowerseriesrepresentedasstreamsofcoefficientsasinexercise3.59,addingseriesisimplementedbyadd-streams.Completethedefinitionofthefollowingprocedureformultiplyingseries:(define(m
NoMasp
·
2015-03-28 22:00
for
power
complete
series
Definition
【
SICP
练习】128 练习3.59
练习3-59原文代码a)(define(integrate-seriess)(stream-map*(stream-map/onesintegers)s))b)(definesine-series(cons-stream0(integrate-seriescosine-series))) (definecosine-series(cons-stream1(integrate-series(scal
NoMasp
·
2015-03-28 22:00
Stream
map
define
num
series
【
SICP
练习】127 练习3.58
练习3-58原文Exercise3.58.Giveaninterpretationofthestreamcomputedbythefollowingprocedure:(define(expandnumdenradix)(cons-stream(quotient(*numradix)den)(expand(remainder(*numradix)den)denradix)))(Quotientis
NoMasp
·
2015-03-28 22:00
Stream
procedure
expand
define
num
【
SICP
练习】126 练习3.57
练习3-57原文Exercise3.57.HowmanyadditionsareperformedwhenwecomputethenthFibonaccinumberusingthedefinitionoffibsbasedontheadd-streamsprocedure?Showthatthenumberofadditionswouldbeexponentiallygreaterifwehad
NoMasp
·
2015-03-28 22:00
using
streams
compute
Definition
nth
【
SICP
练习】125 练习3.56
练习3-56原文Exercise3.56.Afamousproblem,firstraisedbyR.Hamming,istoenumerate,inascendingorderwithnorepetitions,allpositiveintegerswithnoprimefactorsotherthan2,3,or5.Oneobviouswaytodothisistosimplytesteach
NoMasp
·
2015-03-28 22:00
Stream
lambda
SICP
enumerate
raised
【
SICP
练习】124 练习3.55
练习3-55原文Exercise3.55.Defineaprocedurepartial-sumsthattakesasargumentastreamSandreturnsthestreamwhoseelementsareS0,S0+S1,S0+S1+S2,….Forexample,(partial-sumsintegers)shouldbethestream1,3,6,10,15,….代码(de
NoMasp
·
2015-03-28 22:00
Stream
for
sh
Argument
define
【
SICP
练习】123 练习3.54
练习3-54原文Exercise3.54.Defineaproceduremul-streams,analogoustoadd-streams,thatproducestheelementwiseproductofitstwoinputstreams.Usethistogetherwiththestreamofintegerstocompletethefollowingdefinitionofth
NoMasp
·
2015-03-28 22:00
Stream
add
streams
define
product
【
SICP
练习】122 练习3.53
练习3-53原文Exercise3.53.Withoutrunningtheprogram,describetheelementsofthestreamdefinedby(defines(cons-stream1(add-streamsss)))分析s是一串2的幂。也就是1、2、4、8、16、32……
NoMasp
·
2015-03-28 22:00
Stream
program
streams
defined
define
【
SICP
练习】121 练习3.52
练习3-52原文Exercise3.52.Considerthesequenceofexpressions(definesum0) (define(accumx)(set!sum(+xsum))sum) (defineseq(stream-mapaccum(stream-enumerate-interval120))) (definey(stream-filtereven?seq)) (def
NoMasp
·
2015-03-28 21:00
Stream
set
sequence
define
interval
【
SICP
练习】120 练习3.51
练习3-51原文Exercise3.51.Inordertotakeacloserlookatdelayedevaluation,wewillusethefollowingprocedure,whichsimplyreturnsitsargumentafterprintingit:(define(showx)(display-linex)x)Whatdoestheinterpreterprinti
NoMasp
·
2015-03-28 21:00
display
AFTER
Argument
line
define
【
SICP
练习】119 练习3.50
练习3-50原文Exercise3.50.Completethefollowingdefinition,whichgeneralizesstream-maptoallowproceduresthattakemultiplearguments,analogoustomapinsection2.2.3,footnote12.(define(stream-mapproc.argstreams)(if((
NoMasp
·
2015-03-28 21:00
Stream
arguments
define
complete
Definition
【
SICP
归纳】6 副作用与环境模型
虽说叫做副作用显得不太好听,但在Lisp中副作用还是非常重要的。而相对于所有状态都必须显式地操作和传递额外参数的方式,如果引进赋值和将状态隐藏在局部变量中,那么就可以用更加模块化的方式来构造系统。正如你所知道的,不用任何赋值的程序设计称为函数式程序设计。相反,广泛采用赋值的程序设计称为命令式程序设计。在C等命令式程序设计语言中,我们往往都要仔细考虑变量赋值的顺序,尤其是在循环中,但在函数式程序设计
NoMasp
·
2015-03-28 10:00
参数
命令
操作
环境
隐藏
【
SICP
练习】118 练习3.45【待完成】
练习3-45原文Exercise3.45.LouisReasonerthinksourbank-accountsystemisunnecessarilycomplexanderror-pronenowthatdepositsandwithdrawalsaren’tautomaticallyserialized.Hesuggeststhatmake-accountand-serializershou
NoMasp
·
2015-03-26 20:00
error
System
Complex
account
【
SICP
练习】117 练习3.44
练习3-44原文Exercise3.44.Considertheproblemoftransferringanamountfromoneaccounttoanother.BenBitdiddleclaimsthatthiscanbeaccomplishedwiththefollowingprocedure,eveniftherearemultiplepeopleconcurrentlytransf
NoMasp
·
2015-03-26 19:00
Scheme
lambda
lisp
SICP
【
SICP
练习】116 练习3.42
练习3-42原文Exercise3.42.BenBitdiddlesuggeststhatit’sawasteoftimetocreateanewserializedprocedureinresponsetoeverywithdrawanddepositmessage.Hesaysthatmake-accountcouldbechangedsothatthecallstoprotectedared
NoMasp
·
2015-03-26 19:00
Scheme
lambda
SICP
lisp
【
SICP
练习】115 练习3.41
练习3-41原文Exercise3.41.BenBitdiddleworriesthatitwouldbebettertoimplementthebankaccountasfollows(wherethecommentedlinehasbeenchanged):(define(make-accountbalance)(define(withdrawamount)(if(>=balanceamoun
NoMasp
·
2015-03-26 19:00
balance
line
define
account
wi
【
SICP
练习】114 练习3.38-3.39
练习3-38原文Exercise3.38.SupposethatPeter,Paul,andMaryshareajointbankaccountthatinitiallycontains100.Concurrently,Peterdeposits10,Paulwithdraws20,andMarywithdrawshalfthemoneyintheaccount,byexecutingthefol
NoMasp
·
2015-03-26 14:00
Scheme
lambda
lisp
SICP
eval
【
SICP
练习】113 练习3.33
练习3-33原文Exercise3.33.Usingprimitivemultiplier,adder,andconstantconstraints,defineaprocedureaveragerthattakesthreeconnectorsa,b,andcasinputsandestablishestheconstraintthatthevalueofcistheaverageoftheva
NoMasp
·
2015-03-26 12:00
c
using
CONSTRAINT
constant
define
【
SICP
练习】112 练习3.28
练习3-28原文Exercise3.28.Defineanor-gateasaprimitivefunctionbox.Youror-gateconstructorshouldbesimilartoand-gate.代码(define(or-gateinput-1input-2output)(define(or-action-procedure)(let((new-value(logical-or
NoMasp
·
2015-03-26 12:00
代码
action
define
output
Primitive
【
SICP
练习】111 练习3.24
练习3-24原文Exercise3.24.Inthetableimplementationsabove,thekeysaretestedforequalityusingequal?(calledbyassoc).Thisisnotalwaystheappropriatetest.Forinstance,wemighthaveatablewithnumerickeysinwhichwedon’tne
NoMasp
·
2015-03-26 12:00
lambda
SICP
lisp
make-table
【
SICP
练习】110 练习3.23
练习3-23原文Exercise3.23.Adeque(“double-endedqueue”)isasequenceinwhichitemscanbeinsertedanddeletedateitherthefrontortherear.Operationsondequesaretheconstructormake-deque,thepredicateempty-deque?,selectors
NoMasp
·
2015-03-26 11:00
Queue
lambda
SICP
lisp
deque
scheme中if作为特殊形式而不是普通过程的原
SICP
的练习1.6中试图将scheme中的if写成cond的形式:C++(define(new-ifpredicatethen-clauseelse-clause)(cond(predicatethen-clause
ahxxx2
·
2015-03-26 11:13
【
SICP
练习】109 练习3.22
练习3-22原文Exercise3.22.Insteadofrepresentingaqueueasapairofpointers,wecanbuildaqueueasaprocedurewithlocalstate.Thelocalstatewillconsistofpointerstothebeginningandtheendofanordinarylist.Thus,themake-queu
NoMasp
·
2015-03-25 11:00
Queue
lambda
lisp
SICP
state
【
SICP
练习】108 练习3.21
练习3-21原文Exercise3.21.BenBitdiddledecidestotestthequeueimplementationdescribedabove.HetypesintheprocedurestotheLispinterpreterandproceedstotrythemout:(defineq1(make-queue)) (insert-queue!q1'a) ((a)a)
NoMasp
·
2015-03-25 11:00
lambda
SICP
lisp
implementation
【
SICP
练习】107 练习3.8
练习3-8原文Exercise3.8.Whenwedefinedtheevaluationmodelinsection1.1.3,wesaidthatthefirststepinevaluatinganexpressionistoevaluateitssubexpressions.Butweneverspecifiedtheorderinwhichthesubexpressionsshouldbe
NoMasp
·
2015-03-25 10:00
Model
lambda
SICP
expression
evaluate
【
SICP
归纳】5 泛型运算符
关于数据抽象,有两个很重要的思想。一是在构建一些水平的抽象障碍在这个系统中。用某些对象来代换这些单独使用的抽象屏障。二是当需要使用某种形式的数据对象时,往往可以由其他人来将其实现,而我们并不需要知道具体操作。这都是在数据抽象方面非常强大的编程方法。但是这还不足以完成一个真正复杂的系统。在这里的问题出在“其他人”,作者常举的例子是Georges。归结来说,有很多人都工作在这个系统上,但所有的这些设计
NoMasp
·
2015-03-23 20:00
编程
数据
方法
操作
系统
【
SICP
归纳】4 模式匹配和以规则为基础的代换
在书中符号数据一节中,作者写了关于微积分的演算规则的程序。这是一个很程序化的程序,我们所做的是在讲这些(数学)规则翻译成计算机语言。因为它有程序化的行为和结构,那么存在其他的方法使书写这个程序更加清晰吗?这些规则都具有左右两侧。左侧是我们想要采取的导数的表达式,有右边则是其的替代。用可以匹配的模式,和能够代换的框架,可以得到新的表达式。所以这意味着模式是对源表达式的匹配,并且规则的应用的结果是去产
NoMasp
·
2015-03-23 20:00
模式
应用
模式匹配
结构
代换
抽象的构件
在我读
SICP
的过程中,我开始感叹这本书选择Lisp作为表现语言是十
王子亭
·
2015-03-16 00:00
抽象
sicp
【
SICP
归纳】3 层次性数据和符号数据
后来才知道让Lisp输出图形化界面是更高层次的工程,想想还是先把
SICP
搞定。上一篇博文中我们谈到了复合数据,关于它有两个重点。第一,数据抽象,这也就意味
NoMasp
·
2015-03-15 15:00
数据
闭包
抽象
层次
元语言
上一页
36
37
38
39
40
41
42
43
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他