- 2
- 0
- 约1.63千字
- 约 6页
- 2022-04-25 发布于北京
- 举报
Programming LanguagesDan GrossmanLet Expressions to Avoid Repeated ComputationAvoid repeated recursionConsider this code and the recursive calls it makesDon’t worry about calls to null, hd, and tl because they do a small constant amount of workfun bad_max (xs : int list) = if null xs then 0 (* horrible style; fix later *) else if null (tl xs) then hd xs else if hd xs bad_max (tl xs) then hd xs else bad_max (tl xs)let x = bad_max [50,49,…,1]let y = bad_max [1,2,…,50]Dan Grossman, Programming LanguagesFast vs. unusableif hd xs bad_max (tl xs)then hd xselse bad_max (tl xs)bm [50,…]bm [49,…]bm
您可能关注的文档
最近下载
- 方管、矩形管规格和理论重量参考表.pdf VIP
- 议论文写作入门指导+课件+2025-2026学年统编版高一语文必修上册.pptx VIP
- 医院全面提升医疗质量工作行动方案(2023-2025年)(共5篇).pdf VIP
- 蒙德GF4 系列使用手册.PDF
- GB_T 3923.1-2013 纺织品织物拉伸性能第1部分断裂强力和断裂伸长率的测定(条样法).pdf
- 2026年湖南有色新田岭钨业有限公司招聘备考题库及答案详解.docx VIP
- 剧本杀完整剧本 罪恶(4人封闭).docx VIP
- 英威腾CHF100A系列矢量通用型变频器说明书V1.2.pdf VIP
- 新代同动激光打标PC软体操作手册_1.6.0.pdf VIP
- 补办《入党志愿书》操作指南(含相关取证及决议材料模板、 党员身份审核登记表).doc VIP
原创力文档

文档评论(0)