为了计算方和圆的面积,我定义了以下类型: type Square = {width: float; length: float;} with
member this.area = this.width * this.length
member this.perimeter = (this.width + this.length) * 2.
type Circle = {r:
我想写Python的正则表达式搜索的Common Lisp的版本和替换,以文件的就地修改: import fileinput, re
for line in fileinput.input(inplace=1, backup='.bak'):
line = re.sub(r"foo", "bar", line, re.M)
print (line)
这是常见的Lisp代码我能想
我收集了大约十几种我定义的类型的结构化东西(比如说Component),其中每个都可以用“名称”来标识,而且努力理清一个惯用的Haskell实例化和检索方法。这些东西在我的应用程序中经常使用,因此概念上它们是一组全局常量或常量表,理想情况下这些常量将被初始化并保存以供快速检索。 我目前的做法,我不舒服,只是使用一个函数来从它的名字“计算”每个Component。 data Component =