lisp语言是最好的语言

This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’.

本文是对 Emmet Boudreau的文章“我们应该将Lisp用于数据科学”的 回应

Below, unless otherwise stated, lisp refers to Common Lisp; in general, lisp refers to the lisp family of languages, just like the C-family of languages. There are functional lisps like Clojure and Scheme, and there are general purpose lisps such as Common Lisp and Racket.

以下,除非另有说明,否则lisp指的是Common Lisp; 通常,lisp指的是 lisp语言家族 ,就像 C语言家族 一样 有诸如Clojure和Scheme之类的功能性lipps,还有诸如Common Lisp和Racket之类的通用lisps。

The primary hurdle to using Lisp for Data Science, I believe, is the non-infix syntax common in mathematics.

我相信,使用Lisp进行数据科学的主要障碍是数学中常见的非中缀语法。

[Edit: Added note about parentheses balancing wrt paredit, and mentioned slima for atom. A redone note about formatting lisp code. Mention of PAIP. Thanks to comments at r/lisp!]

[ 编辑:添加了有关括号与wrt paredit平衡的注释,并提到了原子的slima。 关于格式化Lisp代码的重做说明。 提及PAIP。 感谢r / lisp的评论 !]

但是,有什么要学习的语法吗? (But, is there anything to learn from its syntax?)

Lisp base syntax follows prefix notation and “everything is a list” convention. In this notation, the first element of the list is the operator while the remaining elements are the operands.

Lisp基本语法遵循前缀表示法,并且“一切都是列表”约定。 在此表示法中,列表的第一个元素是运算符,而其余元素是操作数。

To some, the lack of commas in lisp can feel cleaner than their presence in non-lisps. YMMV.

在某些情况下,与没有口吻的人相比,没有口吻的人感觉更干净。 YMMV。

Further, lisp symbols can actually be *anything*.

此外,lisp符号实际上可以是*任何*。

Syme examples of lisp symbols
Lisp符号的Syme示例

The lisp reader is also, by default, case insensitive; so you don’t need to bother about whether something is called “fooBar” or “foobar” or “FOOBar”. It’s usually just “foo-bar”. Hyphens also feel more natural than underscores. In daily language, we rarely use — at least I don’t — underscores; but hyphens just feel more natural while writing compound-words.

默认情况下,lisp阅读器也不区分大小写; 因此,您不必为某个东西叫做“ fooBar”还是“ foobar”还是“ FOOBar”而烦恼。 通常只是“ foo-bar”。 连字符也比下划线更自然。 在日常语言中,我们很少使用-至少我不使用-下划线; 但是连字在写复合词时会感觉更自然。

All of that is significantly subjective. Where lisp shines is when it is used in conjunction with a structured editing mode like the paredit mode.

所有这些都是主观的。 Lisp的亮点是与结构化编辑模式(如paredit模式)结合使用。

演示地址

Paredit mode demonstration (jump to 0:35)
演示模式演示(跳至0:35)

The alternative in other languages happens to be

其他语言的替代品恰好是

  1. Hold your mouse and place the cursor at the start of the code block.按住鼠标并将光标置于代码块的开头。
  2. Drag your mouse to the end of the code block将鼠标拖到代码块的末尾
  3. Ctrl+XCtrl + X
  4. Ctrl+VCtrl + V

That’s about 100–300% more effortful than if you know paredit. And if you are gonna be alive for more than a decade, paredit is definitely worth the learning! Plus, did you notice that you do not need to count parentheses? The editor keeps track of it for you! Even for non-lisps, there are equivalent modes like smartparens-strict-mode you could help yourself with.

这比您知道paredit时要省力100–300%。 而且,如果您要活着超过十年,那么paredit绝对值得学习! 另外,您是否注意到您不需要计算括号? 编辑器会为您跟踪它! 即使对于非嘴唇,也可以使用smartparens-strict-mode等等效模式来帮助自己。

But is this something unique to lisp? No, in fact, there is a related open issue for julia. So, if you did understand the power of paredit, do try smartparens-strict-mode or equivalent with other languages!

但这是Lisp独有的东西吗? 不,事实上, 茱莉亚 有一个 相关的公开问题 因此,如果您确实了解paredit的功能,请尝试使用smartparens-strict-mode或其他语言的等效语言!

Idiomatic lisp code looks nothing unreadable the way the other article states. Here’s the same code, completed and formatted.

惯用的Lisp代码看起来没有其他文章所述的方式不易理解。 这是相同的代码,已完成并格式化。

Better formatted lisp with paren-face-mode (with slightly different building blocks)
使用paren-face-mode格式更好的lisp(具有稍微不同的构建块)

On the extensibility of lisp syntax

关于Lisp语法的可扩展性

Lisp is characterized by its extreme extensibility. You can extend the reader. You can introduce new syntax.

Lisp的特点是具有极高的可扩展性。 您可以扩展阅读器。 您可以引入新的语法。

I’d also consider it to be objective that the prefix lisp syntax isn’t particularly well suited to sharing mathematical code.

我还认为前缀Lisp语法不是特别适合共享数学代码是客观的。

Math infix vs prefix
数学中缀与前缀

In almost all written mathematics, the prefix syntax in code and paper/text-book takes away the overhead of checking whether you typed the expression correctly. I, as a lisper, don’t find the former syntax to be “harder” than the latter; if anything, it states exactly what is to be done — namely, we have to add 5, x, and another expression. However, that isn’t how I find mathematics written in books!

在几乎所有的书面数学中,代码和纸质/教科书中的前缀语法消除了检查是否正确键入表达式的开销。 我作为一个傻子,没有发现前一种语法比后者更“硬”。 如果有的话,它确切说明了要执行的操作-即,我们必须添加5,x和另一个表达式。 但是,这不是我发现书本中写的数学的方法!

But lisp is extensible. There is a library called cmu-infix that introduces the required mathematical syntax; so the following is perfectly valid lisp code once you use it.

但是Lisp是可扩展的。 有一个名为cmu-infix的库,它引入了所需的数学语法。 因此,以下是使用后完全正确的Lisp代码。

infix notation in lisp using cmu-infix
使用cmu-infix的Lisp中的中缀表示法

And that is hardly different from the math syntax above!

这与上面的数学语法几乎没有什么不同!

However, in 2020, in my opinion, cmu-infix needs more polishing, particularly to deal with array slicing. And, it’d be great to have superscripts to mean power too, just very like usual mathematics!

但是,我认为,到2020年,cmu-infix需要更多地抛光,尤其是要处理阵列切片时。 而且,也很像上一门数学一样,有上标也能表示幂!

Quicklisp和Ultralisp (Quicklisp, and Ultralisp)

Where I found myself significanly disagreeing with the author was on quicklisp. Quicklisp is one of the best package management I’ve known, thanks to its guarantee that “all packages build together”. So, as long as you haven’t moded your lisp system, loading a library is as simple as (ql:quickload “library”). This is actually a dist system, akin to what one’d find with the linux package system apt. There are almost monthly updates to quicklisp, and if something does break due to the upgrade, you simply go back to a known working dist.

我发现自己明显不同意作者的观点是在quicklisp上。 Quicklisp是我所知最好的软件包管理之一,这要归功于它保证“所有软件包都可以一起构建”。 因此,只要您没有设置Lisp系统的模式,加载库就和(ql:quickload“ library”)一样简单。 这实际上是一个dist系统,类似于linux软件包apt中的系统。 quicklisp几乎每月都有更新,并且如果由于升级而导致某些问题确实中断了,您只需回到已知的工作区即可。

Quicklisp works with ABCL, Allegro CL, Clasp, Clozure CL, CLISP, CMUCL, ECL, LispWorks, MKCL, SBCL, and Scieneer CL, on Linux, Mac OS X, and Windows.

Quicklisp可与ABCL , 快板CL , 扣 , Clozure CL , CLISP , CMUCL , ECL , LispWorks , MKCL , SBCL和Scieneer CL ,在Linux,Mac OS X和Windows。

So, I don’t really get the author’s point about using a quicklisp compatible compiler. It’s just ubiquitous!

因此,我并没有真正理解作者使用与quicklisp兼容的编译器的观点。 随处可见!

The monthly update cycle can, indeed, be painful for projects in active development; for which, there happens to be ultralisp, that updates every 5 min!

实际上,每月更新周期对于正在积极开发的项目可能确实很痛苦; 为此,每5分钟更新一次Ultralisp !

Of course, there are facilities like qlot to help manage dependencies, if quicklisp dists ever happen to be insufficient for you.

当然,如果quicklisp dists碰巧不足以帮助您解决问题,则可以使用qlot之类的工具来帮助管理依赖项。

还有什么? (What else?)

While macros are one thing, I don’t tend to find them of as much use as SLIME.

虽然宏是一回事,但我并不倾向于发现它们的用途与SLIME一样多。

Your usual development cycle consists of

您通常的开发周期包括

  1. Write/Edit code.编写/编辑代码。
  2. (Optionally) Compile.(可选)编译。
  3. Run and debug.运行和调试。

I’ve found myself waiting for 10 sec on the smallest of changes while working on a largish python system. SLIME is a god-send in that it takes this waiting period to under 1 sec, unless perhaps you are doing something in the base of your system.

我发现自己在使用大型python系统时,等待最小变化的时间为10秒。 SLIME是一个天赐良机,因为它将等待时间缩短到1秒以内,除非您可能正在系统基础上做某事。

演示地址

An excelllent demonstration of SLIME
SLIME的出色示范

Are there alternatives in other languages? Sorta yes. In python, if you fire up a REPL inside emacs, it is connected to python buffers; however, the lack of a lisp like package system limits this to single file workflows. For julia, there is julia-snail.

是否有其他语言的替代品? 排序是的。 在python中,如果您在emacs中启动REPL,它将连接到python缓冲区; 但是,缺少像Lisp这样的软件包系统,将其局限于单个文件工作流程。 对于茱莉亚,有茱莉亚蜗牛 。

What about jupyter notebooks? Consider SLIME to be the next step in the jupyter-notebooks evolution :p. Okay, one place where jupyter notebooks (can) shine is when you need to display images and graphs to management folks. Though, emacs-ers do have the awesome org-mode for the same, that does allow inline latex and images, and multiple language blocks in a single file. YMMV.

那么Jupyter笔记本呢? 认为SLIME是jupyter-notebooks进化的下一步:p。 好吧,当您需要向管理人员显示图像和图形时,jupyter笔记本(可以)发光的一个地方。 尽管emacs-ers确实具有出色的org-org模式,但确实允许内联乳胶和图像以及单个文件中的多种语言块。 YMMV。

看到? 您学到了很多东西,却没有真正学过一口气。 (See? You learnt so many things without actually learning a lisp?)

Well, I’d say you are already about one-third way on your path to learning lisp. May be help yourself learning the full thing!

好吧,我想说您已经走近了学习口齿不清的道路上的三分之一。 可能会帮助您学习完整的东西!

那图书馆呢? (What about libraries?)

In theory, it is entirely possible to write SBCL that is almost as performant as C. For instance, one of my past-times has been working on a library called numericals that gets at least as fast as numpy using SBCL.

从理论上讲,完全有可能编写出与C 几乎一样性能的SBCL。例如,我过去的一个时光一直在研究一个称为“ 数值”的库,使用SBCL至少可以得到与numpy一样快的速度。

A comparison of SBCL against numpy
SBCL与numpy的比较

While, not tested for performance by me, there are much more complete libraries like clml for machine learning.

虽然没有经过我的性能测试,但还有更多完整的库(例如clml)可用于机器学习。

Depending on your use case, you might also find py4cl2 suitable for you. py4cl brings python libraries to common lisp, with quite a few limitations; check if those limitations apply to you!

根据您的用例,您可能还会发现适合您的py4cl2 。 py4cl将python库带到了常见的lisp中,但有很多限制; 检查这些限制是否适用于您!

In practice, in fact, lisp was never a go to language for machine learning! Lisp has been the language of the pre-ML AI — Norvig’s Paradigm of Artificial Intelligence is a great read for anyone interested in what AI was before the dawn of Machine Learning.

实际上,实际上,lisp绝不是机器学习的语言! Lisp一直是ML之前的AI的语言-对于在机器学习曙光之前对AI感兴趣的人来说, Norvig的《人工智能范式》是一本好书。

That said, the take home message is: structured editing, quicklisp-like package system, and SLIME. If lisp does interest you, take a look at some of its defacto libraries — the Getting Started sections of cl-who, cl-ppcre, fiveam, iterate and alexandria in very particular.

也就是说,带回家的消息是:结构化编辑,类似quicklisp的打包系统和SLIME。 如果lisp引起您的兴趣,请查看 其一些事实上的库 -cl-who,cl-ppcre,fiveam,iterate和alexandria的入门部分。

The bonus of working with lisp is that, if your needs are met by the ANSI standard, or perhaps some well solidified defacto libraries, then you can avoid yourself the pain of upgrading your projects due to “language upgrades”. ANSI standardization was complete in 1994; and quite a few projects from the pre-2000s can still run in ANSI-conforming implementations in 2020.

使用lisp的好处是,如果ANSI标准或某些可靠的事实库满足了您的需求,那么您可以避免由于“语言升级”而导致的项目升级麻烦。 ANSI标准化工作于1994年完成; 而且2000年以前的许多项目仍可以在2020年以符合ANSI的实施方式运行。

If Common Lisp does interest you, The Common Lisp Cookbook and Practical Common Lisp, coupled perhaps with Baggers’ videos are some of the several excellent resources to get started. If you ever need help with anything, the community is welcoming at r/CLSchools! Of course, there’s the more general purpose r/lisp, and the more familiar stackoverflow.

如果您对Common Lisp感兴趣,可以参考Common Lisp食谱和实用Common Lisp以及Baggers的视频,这是一些不错的入门资源。 如果您需要任何帮助,欢迎访问r / CLSchools ! 当然,有更通用的r / lisp和更熟悉的stackoverflow 。

And, if you find emacs to be curve, there is SLIMA for Atom as well.

而且,如果您发现emacs可以弯曲,那么Atom也可以使用SLIMA 。

Hope you have a good day!

希望你有美好的一天!

翻译自: https://medium.com/@shubhamkarayare/lisp-may-not-be-the-best-language-for-data-science-but-what-can-we-still-learn-from-it-528024114e02

lisp语言是最好的语言


http://www.taodudu.cc/news/show-997453.html

相关文章:

  • python pca主成分_超越“经典” PCA:功能主成分分析(FPCA)应用于使用Python的时间序列...
  • 大数据平台构建_如何像产品一样构建数据平台
  • 时间序列预测 时间因果建模_时间序列建模以预测投资基金的回报
  • 贝塞尔修正_贝塞尔修正背后的推理:n-1
  • php amazon-s3_推荐亚马逊电影-一种协作方法
  • 简述yolo1-yolo3_使用YOLO框架进行对象检测的综合指南-第一部分
  • 数据库:存储过程_数据科学过程:摘要
  • cnn对网络数据预处理_CNN中的数据预处理和网络构建
  • 消解原理推理_什么是推理统计中的Z检验及其工作原理?
  • 大学生信息安全_给大学生的信息
  • 特斯拉最安全的车_特斯拉现在是最受欢迎的租车选择
  • ml dl el学习_DeepChem —在生命科学和化学信息学中使用ML和DL的框架
  • 用户参与度与活跃度的区别_用户参与度突然下降
  • 数据草拟:使您的团队热爱数据的研讨会
  • c++ 时间序列工具包_我的时间序列工具包
  • adobe 书签怎么设置_让我们设置一些规则…没有Adobe Analytics处理规则
  • 分类预测回归预测_我们应该如何汇总分类预测?
  • 神经网络推理_分析神经网络推理性能的新工具
  • 27个机器学习图表翻译_使用机器学习的信息图表信息组织
  • 面向Tableau开发人员的Python简要介绍(第4部分)
  • 探索感染了COVID-19的动物的数据
  • 已知两点坐标拾取怎么操作_已知的操作员学习-第4部分
  • lime 模型_使用LIME的糖尿病预测模型解释— OneZeroBlog
  • 永无止境_永无止境地死:
  • 吴恩达神经网络1-2-2_图神经网络进行药物发现-第1部分
  • python 数据框缺失值_Python:处理数据框中的缺失值
  • 外星人图像和外星人太空船_卫星图像:来自太空的见解
  • 棒棒糖 宏_棒棒糖图表
  • nlp自然语言处理_不要被NLP Research淹没
  • 时间序列预测 预测时间段_应用时间序列预测:美国住宅

lisp语言是最好的语言_Lisp可能不是数据科学的最佳语言,但是我们仍然可以从中学到什么呢?...相关推荐

  1. python是用什么语言开发的-专为人工智能和数据科学而生的Go语言,或将取代Python...

    时间回到30年前,Python 首次亮相.花了20年时间,Python才获得开发者的认可.来到 2019 年,Python已经成为开发人员第二喜欢的语言. 在过去的5年时间里,Python 成为了机器 ...

  2. python是什么语言开发的-专为人工智能和数据科学而生的Go语言,或将取代Python...

    时间回到30年前,Python 首次亮相.花了20年时间,Python才获得开发者的认可.来到 2019 年,Python已经成为开发人员第二喜欢的语言. 在过去的5年时间里,Python 成为了机器 ...

  3. R语言是如何增强数据科学

    当今数据科学领域最流行的工具之一是开源编程语言R语言,它广泛的应用于各个领域.简单来说,R语言就是一种数据语言.过去的20年间,全世界的统计学家已经为开源语言R语言做出了许多创新性的贡献.这些贡献意味 ...

  4. Python 在数据科学中一直打压 R 语言?

    两三年前,凭借着强大可视化功能的 R 语言在统计领域可谓是风光无限,不过随着更简单易上手的 Python 崛起,R 语言的市场似乎正逐步被 Python 吞噬. 作者 | Nick Heath 译者 ...

  5. r语言和python爬虫谁厉害_R vs Python: 谁是最好的数据科学语言?

    作者:Lou Bajuk 翻译:黄小伟,资深数据从业者.目前就职杭州有赞数据分析团队,欢迎加入! 简历邮箱:huangxiaowei@youzan.com 从我们成立之初,RStudio就致力于几个关 ...

  6. lisp语言cond和if套用_LISP语言入门(CLISP)

    曾经翻译整理的一篇LISP语言的入门文章,与大家分享. (请勿转载) ---------------------------------------------------------------- ...

  7. lisp语言cond和if套用_lisp语言入门

    Lisp 语言入门 Lisp 是一门历史悠久的语言,全名叫 LISt Processor ,也就是"表处理语言",它是由 John McCarthy 于 1958 年就开始设计的一 ...

  8. lisp语言与python_5种语言混合编程:C++、JS、python、Lisp、汇编

    /* 混合C++.JS.python.Lisp.汇编 1种语言,5种语法 */ main { //C++ vector v; v.push(2); putsl(v.size()); if(v.coun ...

  9. lisp语言与python_5种语言混合编程:C 、JS、python、Lisp、汇编

    /*混合C++.JS.python.Lisp.汇编1种语言,5种语法*/main{//C++vector v;v.push(2);putsl(v.size());if(v.count()==1){pu ...

最新文章

  1. 数据分析师必看:5大概率分布,你了解多少?
  2. java B2B2C springmvc mybatis电子商务平台源码-Consul服务发现原理...
  3. Cannot open precompiled header file:'Debug/password.pch' No such file or directory
  4. 七自由度车辆稳定性数学模型和simulink求解
  5. 聊聊storm supervisor的启动
  6. 《剑指offer》替换空格
  7. Linux JDK升级
  8. 2021牛客暑期多校训练营4 E-Tree Xor(异或+思维+区间交 or Trie树)
  9. 关联规则挖掘算法_基于Apriori关联规则的协同过滤算法
  10. response.end后抛了异常_(七)异常处理
  11. 我的世界java多大内存_我的世界电脑版内存多大
  12. 如何通过使用fiddler对安卓系统设备抓包总结
  13. Linux RPM、YUM、APT包管理工具
  14. Compile error: Cannot find a C++ compiler that supports both C++11 and the specified C++ flags
  15. (三十)java版spring cloud+spring boot+redis多租户社交电子商务平台- gateway限流
  16. SnakeYaml 反序列化的一个小 trick
  17. FSDB Dumper
  18. DAS Over FC 技术允许 ATTO 分解存储并完成 vSAN 认证套件
  19. 计算机信息系统安全管理包括什么,计算机信息系统的运行安全包括什么
  20. 在线制图工具团队版介绍

热门文章

  1. Codeforces 1182A Filling Shapes
  2. Error: Program type already present: okhttp3.Authenticator$1
  3. 【题解】HAOI2007分割矩阵
  4. BZOJ 1878: [SDOI2009]HH的项链
  5. node中的Stream-Readable和Writeable解读
  6. TOJ---2621--全排列
  7. UVA 662 Fast Food
  8. ASP.NET2.0瞎记____主题皮肤
  9. 基于easyui开发Web版Activiti流程定制器详解(六)——Draw2d详解(二)
  10. Exchange ActiveSyn身份验证类型