当前位置:网站首页>The writing style of the construction and interpretation of the mini LISP interpreter
The writing style of the construction and interpretation of the mini LISP interpreter
2022-06-21 05:28:00 【ccat】
Today, I saw some readers complain that my book is to print out the source code for sale . I can understand this feeling , But in fact, this writing style is the result of repeated attempts , Instead of being lazy . The source code attached to the book , A lot of them use Scala To annotate Java . For example, yesterday my good friend asked me Java edition Env Type of get Why does the method use a try catch,
public Object get(String name) throws ParserException {
try {
return findIn(name);
} catch (ParserException notfound) {
return findOut(name);
}
}
This is actually on the next page Scala The version is very clean
def get(name: String): Try[Any] = {
findIn(name).orElse(findUp(name))
}.Java The implementation of the , Just to get as close as possible Scala Of Try[T] , This is closer to a getOrElse Not error handling . This contrast of different languages , In the process of my development and writing , It brings a lot of inspiration and fun , It is also the experience I want to share with readers .
I read alone , Sometimes not patient enough , Will often skip the text and gnaw the code , This also affects writing . The future is also a place for improvement .
When sorting out this code , My idea is more like the process of writing mathematical problems . A caption 、 Illustrations can certainly help understand , I will try to add in the future version , But in the end , Programming problems , It is still to be solved by writing code . These codes are repeatedly modified to the current state , Than github Is easier to read . I also removed some engineering code as much as possible . Of course , Generally speaking , Same function ,Java The implementation of is usually better than Scala More verbose . But there are some interesting details to show . and Scala Code for , If you remove the explicit type definitions of variables and functions , It must be much more beautiful , But if the reader follows that code , You will encounter many compiler warnings and even type derivation errors . This point , I actually hope that in the future scala Can be like haskell So the dimension type , After all scala 3 Even indentation syntax can be implemented , The attitude of developers is still very open .Haskell Style annotation types , Combining indentation Syntax , It will be very helpful for typesetting, printing and reading .
There are also some implementations in the book , At the same time Scala 2 and Scala 3 Version of , This is because Scala 3 Of FP The grammar has changed a lot , Closer to the Haskell The system of . By showing Scala 3 Version of , Can better explain why these designs are so .
The other is if the reader can read directly github in JISP and SISP Code for , Of course, it's also very happy for me . But the code is missing some information , Mainly Commit Records do not necessarily represent correctness 、 Clear build process , There are a lot of debug、parsec Upgrade and think 、 test 、 Trial and error and writing correction . In the future, I will try to build a clear process , Teaching Library with chapter division . Not yet , Because these three years Jaskell The library is still developing rapidly , I have basically made some revisions every month in recent years . Teaching demonstrations and documentation , It can only be solved by investing a lot of work , There is no shortcut. .
Last , Thank you for your comments and suggestions , You are my driving force .
边栏推荐
- Abnova 6-ketone-pgf1- α ELISA Kit instructions
- 基于SSH+MySQL的房屋销售租赁系统
- 基于JSP+Servlet+MySQL的鲜花销售系统
- Ue4/5 impactor on begin overlap and on end overlap trigger simultaneously for resolution
- Conscience recommends a seven day National Day holiday. Where is the least cheap place to go?
- Abbexa 一抗、二抗、蛋白质等生物试剂方案
- Individual template of the 13th National tournament of the Blue Bridge Cup ------ another year
- House sales and leasing system based on ssh+mysql
- Randomly create circular, triangular or rectangular objects, store them in the array, and calculate the area and perimeter of each shape
- C语言:随机输入每位同学中每门学科的成绩,要求每位同学的所有学科平均分从低到高排序求出每位同学的平均成绩后,再进行判断该同学的平均成绩是否达到及格。
猜你喜欢

Latex adds a strikeout (horizontal line) to the entire row of the table

Abbexa primary antibody, secondary antibody, protein and other biological reagent schemes

PhpMyAdmin (MySQL) common shell writing methods

单例模式详解

In the NLP field, what are the most practical and effective skills or ideas used in text classification, NER, QA, generation, relationship extraction, etc?

【毕业季】九年程序猿有话说

测试框架TestNG的使用(一):IDEA安装TestNG环境
![[graduation season] nine year program ape has something to say](/img/35/d0cfa14e435714e31e860c751576a6.png)
[graduation season] nine year program ape has something to say

Use of TestNG framework (I): idea installation TestNG environment

Steam education subject integrates the intelligent scene of AR
随机推荐
如何保证数据库和缓存双写一致性?
MYSQL 查询语句,替换结果
基于SSH+MySQL的房屋销售租赁系统
Abnova 6-ketone-pgf1- α ELISA Kit instructions
面试题_V1.0
Abnova chicken anti cotton mouse IgG (H & L) secondary antibody (HRP) protocol
Day code 300 lines learning notes day 16
Editing tutorial for canape A2L files
jmeter里面的json提取器和调试器的用法
Summary of acl2020 information extraction related papers
【基于Oauth2的api接口开发】3、自定义授权方式
Oracle笔记 之 update语法
Usage of JSON extractor and debugger in JMeter
Oracle数据库启停
Assembler: maximizing
迎接创客教育+互联网的黄金时代
软件研发团队效能提升从点滴做起
How to take anti extortion virus measures for enterprise servers
Public transport information management system based on ssm+mysql+layui+jsp
Nodejs learning record - NPM