记一道有趣的CodeReview题目

这道题目是在千里码(不知道这野鸡网站现在还在不在),大意就是这段代码会因为某个特殊的随机种子而抛出异常,需要你找到这个随机种子。 如果只是想要过题 这也是我写这篇学习资料的初衷,如果只是想要过题的话这再简单不过了。根据题目的描述,是由于seed变量取了某个特殊值导致了异常。那么最直接的方法:遍历seed的所有可能取值不断try..catch,接着坐下来喝杯咖啡估计结果就出来了。我相信稍微有点编程基础的人都能够顺利解决,但是仅止步于此的话未免太可惜了。 [Read More]

Y Combinator (续前一篇Lambda)

这篇文章是对前一篇An Online Lambda Interpreter的续写,搞清楚 Y Combinator 这个概念的来龙去脉。当然这两篇文章里的 lambda 演算语法定义实际上并不是标准的定义,具体的标准定义与实现我在这个目录做了单独实现。 [Read More]

An Online Lambda Interpreter

在计算机装逼界我们经常能听到类似这样的对话 师妹:师兄,你说是不是所有非递归算法都能写成递归形式呀? 师兄:对啊,否则的话图灵机和lambda演算岂不是不等价了! 其实对于大部分人而言lambda演算这个概念并不算陌生,很多现代的编程语言(C++/Java/Python/…)都或多或少地支持一些函数式编程特性。因此当你在讨论匿名函数的时候,其实你已经在和lambda演算打交道了。可以这样说,是lambda演算构成了函数式编程的基石。 [Read More]

An Erlang Syntactic Sugar Library

Motivation 我大概是在2014年的时候认识Erlang的,并且深深爱上了这个为我解决许多工作难题的”微型操作系统”。但在和别人的交流中,我也听到一些对于Erlang的抱怨,其中最多的竟然是关于它的语法!直到有一天我发现一个开源日志库Lager,里面有一个技巧就是利用编译参数parse_transform对源代码按照自己的意愿进行转换。于是我去查阅了parse_transform的相关资料,并且写下了这个项目ESugar:一方面它作为DEMO展示了原来利用parse_transform我们还可以做许多很酷的事情;另一方面你也可以把它当做一个Erlang的语法糖库拿去使用或者扩展。 [Read More]

Test markdown

Each post also has a subtitle

You can write regular markdown here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to take 5 minutes to learn how to write in markdown - it’ll teach you how to transform regular text into bold/italics/headings/tables/etc. Here is some bold text Here is a... [Read More]
Tags: test

To be

... or not to be?

To be, or not to be–that is the question: Whether ‘tis nobler in the mind to suffer The slings and arrows of outrageous fortune Or to take arms against a sea of troubles And by opposing end them. To die, to sleep– No more–and by a sleep to say we... [Read More]

Dear diary

What is it with that Mary girl? Dragging me to school every day. As if I had a choice. What you don’t hear in those nursery rhymes is that she starves me if I don’t go to school with her; it’s the only way I can stay alive! I’m thinking... [Read More]

Soccer

Best sport ever!

From Wikipedia: Association football, more commonly known as football or soccer,[2] is a sport played between two teams of eleven players with a spherical ball. It is played by 250 million players in over 200 countries, making it the world’s most popular sport.[3][4][5][6] The game is played on a rectangular... [Read More]

Pirates arrrr

Piracy is typically an act of robbery or criminal violence at sea. The term can include acts committed on land, in the air, or in other major bodies of water or on a shore. It does not normally include crimes committed against persons traveling on the same vessel as the... [Read More]