• 2024-09-14sicp每日一题[2.9]
    Exercise2.9Thewidthofanintervalishalfofthedifferencebetweenitsupperandlowerbounds.Thewidthisameasureoftheuncertaintyofthenumberspecifiedbytheinterval.Forsomearithmeticoperationsthewidthoftheresultofcombiningtwo
  • 2024-09-13sicp每日一题[2.8]
    Exercise2.8>UsingreasoninganalogoustoAlyssa's,describehowthedifferenceoftwointervalsmaybecomputed.Defineacorrespondingsubtractionprocedure,calledsub-interval.这道题目也比较简单,只要注意到区间之差的下界是被减区间的下界减去另一个区间的上
  • 2024-09-13sicp每日一题[2.7]
    2.7Alyssa’sprogramisincompletebecauseshehasnotspecifiedtheimplementationoftheintervalabstraction.Hereisadefinitionoftheintervalconstructor:(define(make-intervalab)(consab))Defineselectorsupper-boundandlower-boundtoco
  • 2024-09-12sicp每日一题[2.6]
    Exercise2.6Incaserepresentingpairsasprocedureswasn'tmind-bogglingenough,considerthat,inalanguagethatcanmanipulateprocedures,wecangetbywithoutnumbers(atleastinsofarasnonnegativeintegersareconcerned)byimplementing0a
  • 2024-09-11sicp每日一题[2.5]
    Exercise2.5Showthatwecanrepresentpairsofnonnegativeintegersusingonlynumbersandarithmeticoperationsifwerepresentthepairaandbastheintegerthatistheproduct2a3b.Givethecorrespondingdefinitionsoftheprocedurescons,car,a
  • 2024-09-10sicp每日一题[2.4]
    Exercise2.4Hereisanalternativeproceduralrepresentationofpairs.Forthisrepresentation,verifythat(car(consxy))yieldsxforanyobjectsxandy.(define(consxy)(lambda(m)(mxy)))(define(carz)(z(lambda(pq)p)))Whatistheco
  • 2024-09-09sicp每日一题[2.3]
    Exercise2.3Implementarepresentationforrectanglesinaplane.(Hint:YoumaywanttomakeuseofExercise2.2.)Intermsofyourconstructorsandselectors,createproceduresthatcomputetheperimeterandtheareaofagivenrectangle.Nowimplemen
  • 2024-09-08sicp每日一题[2.2]
    Exercise2.2Considertheproblemofrepresentinglinesegmentsinaplane.Eachsegmentisrepresentedasapairofpoints:astartingpointandanendingpoint.Defineaconstructormake-segmentandselectorsstart-segmentandend-segmentthatdefinet
  • 2024-09-06sicp每日一题[1.46]
    Exercise1.46Severalofthenumericalmethodsdescribedinthischapterareinstancesofanextremelygeneralcomputationalstrategyknownasiterativeimprovement.Iterativeimprovementsaysthattocomputesomething,westartwithaninitialguessfor
  • 2024-09-05sicp每日一题[1.45]
    Exercise1.45WesawinSection1.3.3thatattemptingtocomputesquarerootsbynaivelyfindingafixedpointofy->x/ydoesnotconverge,andthatthiscanbefixedbyaveragedamping.Thesamemethodworksforfindingcuberootsasfixedpointsof
  • 2024-09-04sicp每日一题[1.44]
    Exercise1.44Theideaofsmoothingafunctionisanimportantconceptinsignalprocessing.Iffisafunctionanddxissomesmallnumber,thenthesmoothedversionoffisthefunctionwhosevalueatapointxistheaverageoff(x-dx),f(x),andf(x+
  • 2024-09-03sicp每日一题[1.43]
    Exercise1.43Iffisanumericalfunctionandnisapositiveinteger,thenwecanformthenthrepeatedapplicationoff,whichisdefinedtobethefunctionwhosevalueatxisf(f(...(f(x))...)).Forexample,iffisthefunctionx->x+1,
  • 2024-09-02sicp每日一题[1.41]
    Exercise1.41Defineaproceduredoublethattakesaprocedureofoneargumentasargumentandreturnsaprocedurethatappliestheoriginalproceduretwice.Forexample,ifincisaprocedurethatadds1toitsargument,then(doubleinc)shouldbeapr
  • 2024-01-13NUS CS1101S:SICP JavaScript 描述:四、元语言抽象
    原文:4MetalinguisticAbstraction译者:飞龙协议:CCBY-NC-SA4.0...魔法就在于文字——Abracadabra,开门,以及其他——但一个故事中的魔法词在另一个故事中并不神奇。真正的魔法是理解哪些词起作用,何时起作用,以及为什么起作用;诀窍就是学会这个诀窍。...而这些词是由我们字母表
  • 2024-01-13NUS CS1101S:SICP JavaScript 描述:五、使用寄存器机进行计算
    原文:5ComputingwithRegisterMachines译者:飞龙协议:CCBY-NC-SA4.0我的目标是表明天堂机器不是一种神圣的生命体,而是一种钟表(相信钟表有灵魂属性的人将制造者的荣耀归功于作品),因为几乎所有多种运动都是由一种最简单和物质力量引起的,就像钟表的所有运动都是由单一重力引起
  • 2024-01-13NUS CS1101S:SICP JavaScript 描述:前言、序言和致谢
    前言原文:Foreword译者:飞龙协议:CCBY-NC-SA4.0我有幸在我还是学生的时候见到了了不起的AlanPerlis,并和他交谈了几次。他和我共同深爱和尊重两种非常不同的编程语言:Lisp和APL。跟随他的脚步是一项艰巨的任务,尽管他开辟了一条优秀的道路。尽管如此,我想重新审视他在这本书
  • 2024-01-13NUS CS1101S:SICP JavaScript 描述:三、模块化、对象和状态
    原文:3Modularity,Objects,andState译者:飞龙协议:CCBY-NC-SA4.0变化中安宁(即使它在变化,它仍然保持不变。)——赫拉克利特变化越大,越是相同。——阿方斯·卡尔前面的章节介绍了构成程序的基本元素。我们看到了原始函数和原始数据是如何组合成复合实体的,我们也了解
  • 2023-05-15SICP:元循环求值器(Python实现)
    求值器完整实现代码我已经上传到了GitHub仓库:TinySCM,感兴趣的童鞋可以前往查看。这里顺便强烈推荐UCBerkeley的同名课程CS61A。在这个层次结构的最底层是对象语言。对象语言只涉及特定的域,而不涉及对象语言本身(比如它们的文法规则,或其中的其体句子)。如要涉及它们,则要有一种元
  • 2023-03-23SICP:求值和环境模型(Python实现)
    绪论我们在第一章引进复合过程时,采用了求值的代换模型定义了将过程应用于实参(arguments)的意义:将一个复合过程应用于一些实参,也就意味着用实参替换过程体里对应的形参(for
  • 2023-01-23SICP:复数的直角和极坐标的表示(Python实现)
    绪论我们已经介绍过数据抽象,这是一种构造系统的方法学,它能够使程序中的大部分描述与其所操作的数据对象的具体表示无关,比如一个有理数程序的设计与有理数的实现相分离。这
  • 2023-01-10scip
    WhyStructureandInterpretationofComputerProgramsmattersBrianHarveyUniversityofCalifornia,BerkeleyIn2011,tocelebratethe150thanniversaryof
  • 2023-01-04SICP:符号求导、集合表示和Huffman树(Python实现)
    绪论到目前为止,我们已经使用过的所有复合数据,最终都是从数值出发构造起来的(比如我们在上一篇博客《SICP2.2:层次性数据和闭包性质(Python实现)》所介绍的链表和树就基于
  • 2022-11-19SICP 笔记
    SICP笔记记录学习《算机的程序的构造和解释》的笔记。环境配置SICP里面使用的语言是一种LISP的变体Scheme。使用DrRacket作为IDE来进行试验,DrRacket有针对S