Чему мы можем научиться у Lisp'а?

download Чему мы можем научиться у Lisp'а?

If you can't read please download the document

Transcript of Чему мы можем научиться у Lisp'а?

Lisp'?

Lisp

- 50

-

- ,

Lisp

MacLispInterLispZetaLispSchemeNewLispCommon LispClojureArcNuLispEmacs LispDylan

What makes Lisp different? - Built-in support for lists - Automatic storage management - Dynamic typing - First-class functions - Interactive environment - Uniform syntax - Extensibility - HistoryPeter Norvig, PAIP, 1992http://norvig.com/paip.html

Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp.Phillip Greenspun's10th rule of programming

We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.Guy Steele, Common Lisp,- Java

C++

Java

Python

Ruby

Lisp

(cl-who:with-html-output-to-string (s nil :prologue "") (:rss :version "2.0" :|xmlns:atom| "http://www.w3.org/2005/Atom" (:channel (:title " ") (:link "http://tedxkyiv.com") (:|atom:link| :href "http://tedxkyiv.com/feed" :rel "self" :type "application/rss+xml") (:description " .") (iter (:for item :in (mapcar #'cdar (cdadar (with-input-from-string (in (drakma:http-request *url*)) (json:decode-json in))))) (:for link := (strcat "http://ted.com/" (cl-ppcre:scan-to-strings "href=\".*\"" item))) (htm (:item (:title (str (cl-ppcre:scan-to-strings "(.*)" item))) (:link (str link)) (:guid (str link)) (:description (str (cl-ppcre:scan-to-strings "(.*)" item)))))))))

, ,

The establishment of protocols is a sort of before-the-fact hedge against the "prisoner's dilemma"; that is, it creates an obvious way for two people who are not directly communicating to structure independently developed code so that it works in a manner that remains coherent when such code is later combined.Kent Pitman

http://www.nhplace.com/kent/Papers/ Condition-Handling-2001.html

Common Lisp

- - - -

- (map, reduce, find, remove, funcall/apply,)

- +

- !

- -

!

Fractal programming

http://olabini.com/blog/2008/06/ fractal-programming/

Ola Bini, JRuby Team

Case study: fin-ack.com

-

5 Common Lisp backend, ( , , SBCL). , . . 800 Common Lisp ( Java backend 15 000). - "" , , , wiki-parser, 200 ...

http://archimag-dev.blogspot.com/2009/11/closure-template-5.html

Language-oriented programming

- code is data- data is code (data-driven design)

Writing DSL's in Lisp = putting parentheses around the specification and make it run

Rainer Joswighttp://bc.tech.coop/ blog/050711.html

Case study: CL-REDIS

The only easy way to do metaprogramming in Java is by writing interpreters which is quite widely used or by hiring lots of programmers and give them a catalogue of patterns to instantiate.The easiest way to do metaprogramming in Lisp is by using macros, which can be easily compiled away, so you don't have the same overhead as that of an interpreter at runtime. So my guess is that there is some form of interpreter running in the Java program that slows everything down.http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/b25de73bbe5eb9ba/de4230026ed741c6

Pascal Costanza

Exploratory programming

- -

TDD

REPL

?

1.

2.

3. - Read time- Eval time- Run time

?

JoelMoses

APL is like a diamond. It has a beautiful crystal structure; all of its parts are relatedin a uniform and elegant way. But if you try to extend this structure in any way even by adding another diamond you get an ugly kludge.

LISP, on the other hand, is like a ball of mud. You can add any amount of mud to it and it still looks like a ball of mud.

, Lisp'?

[email protected]://twitter.com/vselovedhttp://github.com/vseloved