SlideShare a Scribd company logo
Lisp for Python Developers

       Vsevolod Dyomkin
           @vseloved
          2013-01-26
Topics

* A short intro
* Some myths and facts
* What Lisp offers
Hello World
CL-USER> "Hello world"
"Hello world"

CL-USER> (print "Hello world")

"Hello world"
"Hello world"
Horner's Rule
         (Is Lisp a functional language?)

(defun horner (coeffs x)
  (reduce (lambda (coef acc)
            (+ (* acc x) coef))
          coeffs
          :from-end t
          :initial-value 0))

From Rosetta Code:
http://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation
Horner's Rule
           (Python version)


def horner(coeffs, x):
  return reduce(lambda acc, c: 
                     acc * x + c,
                reversed(coeffs),
                0)
Lisp Tools

1. Implementations - multiple
2. IDEs - SLIME, SLIMV
3. quicklisp
Myths
*   The   syntax myth
*   The   libraries myth
*   The   community myth
*   The   slowness myth
*   The   outdatedness myth
*   The   myth of too much choice
*   The   myth of academic language
Myth              |        Fact
LISP = Lost In           )))))))])))))])]) —
Stupid Parenthesis       the joy of debugging
                         ASTs
Your eyes are gonna
                         -- Armin Ronacher
bleed!!!!                (https://twitter.com/mitsuhi
                         ko/status/88527153158815744)
Lisp in 1 slide
Myth             |       Fact
There are no Lisp       1961 libraries in
libraries               Quicklisp
Myth             |       Fact
There are no Lisp       1961 libraries in
libraries               Quicklisp

                        27413 libraries in
                        PyPI
(defun graylog (message &key level backtrace file line-no)
 (let (sock)
   (unwind-protect
        (let ((msg (salza2:compress-data
                    (babel:string-to-octets
                     (json:encode-json-to-string
                      #{:version "1.0" :facility "lisp"
                        :host (get-hostname)
                        :|short_message| message
                        :|full_message| backtrace
                        :timestamp (local-time:timestamp-to-unix
                                    (local-time:now))
                        :level level :file file :line line-no
                       })
                     :encoding :utf-8)
                    'salza2:zlib-compressor)))
          (setf sock (usocket:socket-connect *graylog-host*
                                             *graylog-port*
                                             :protocol :datagram
                                             :element-type 'ub8))
          (usocket:socket-send sock msg (length msg))))
     (usocket:socket-close sock)))
Myth                   |            Fact
There's no Lisp                  SBCL – more than 10
programmers                      people contribute to
                                 each release, ABCL –
There's no Lisp                  more than 5, etc.
jobs
                                 This year: 2 Lisp
Lisp community is                conferences in Europe
full of trolls                   for up to 100 people
                                 (ECLM & ECLS) &
Lisp hasn't been                 numerous Lisp user
developed for years              groups meetings

 http://lisp-univ-etc.blogspot.com/search/label/lisp-hackers
Myth        |       Fact
Lisp is slow       Lisp is the fastest
                   of popular dynamic
                   languages

                   Lisp can be faster
                   than Java

                   … or even C

                   http://benchmarksgame.
                   alioth.debian.org/u32q
                   /lisp.php
Cool Lisp Features
1.   Macros
2.   All the functional stuff
3.   CLOS multimethods
4.   Special variables
5.   Condition system
6.   Read macros
7.   The richest calling convention
8.   Etc.
Macros

This page is intentionally left blank
Condition system
Jedis redis = Redis.getClient(Redis.SOME_DB);
try {
    while (!Thread.interrupted())
         try {
             // do some useful work
             break;
         } catch (JedisException e) {
             Redis.returnBrokenClient(redis);
             redis = Redis.getClient(Redis.SOME_DB);
         }
    // do some other stuff
} finally {
      Redis.returnClient(redis);
}
Condition system
Jedis redis = Redis.getClient(Redis.SOME_DB);
try {
    while (!Thread.interrupted())
         try {
             // do some useful work
             break;
         } catch (JedisException e) {
             Redis.returnBrokenClient(redis);
             redis = Redis.getClient(Redis.SOME_DB);
         }
    // do some other stuff
} finally {
      Redis.returnClient(redis);
}
Condition system
(with-persistent-connection (host port)
  ;; do useful stuff
  )
Condition system
(with-persistent-connection (host port)
  ;; do useful stuff
  )

(defmacro with-persistent-connection
    ((&key (host #(127 0 0 1)) (port 6379))
     &body body)
  `(with-connection (:host ,host :port ,port)
     (handler-bind ((redis-connection-error
                     (lambda (e)
                       (warn "Reconnecting.")
                       (invoke-restart :reconnect))))
       ,@body)))
Condition system
(defmacro with-reconnect-restart (&body body)
  `(handler-case (progn ,@body)
     (usocket:connection-refused-error (e)
       (reconnect-restart-case
         (:error e :comment "Can't connect”)
         ,@body))
     ((or usocket:socket-error
          stream-error end-of-file) (e)
        (reconnect-restart-case (:error e)
          ,@body)))))
Condition system
(defmacro reconnect-restart-case
     ((&key error comment) &body body)
  `(if *pipelined*
       (progn ,@body)
       (restart-case (error 'redis-connection-error
                            :error ,error
                            :comment ,comment)
         (:reconnect ()
           :report "Trying to reconnect"
           (reconnect)
           ,@body))))

http://lisp-univ-etc.blogspot.com/2012/11/cl-redis-separation-
of-concerns-in.html
Read macros
{ x ! x <- (loop :for i :upto 10 :collect i) }
'(0 1 2 3 4 5 6 7 8 9 10 )

{x ! x <- '(1 nil 2) ! x}
'(1 2)

{x y ! x <- '(1 2 3) y <- '(5 6 7) ! (oddp x) (> y 5)}
'((3 7))

{ (+ x y) ! x <- '(1 2 3) y <- '(5 6 7) ! (oddp x) (> y 5) }
'(10)

(set-macro-character #{ #'read-listcomp)
(set-macro-character #} (get-macro-character #)))
(defun read-listcomp (stream char)
  "Read list comprehension { vars ! generators [! conditions]? }"
  (declare (ignore char))
  (let (rezs srcs conds state)
    (dolist (item (read-delimited-list #} stream))
      (if (eql '! item)
          (setf state (if state :cond :src))
          (case state
            (:src       (push item srcs))
            (:cond      (push item conds))
            (otherwise (push item rezs)))))
    (setf rezs (reverse rezs)
          srcs (reverse srcs)
          conds (reverse conds))
    (let ((binds (mapcar #`(cons (first %) (third %))
                          (group 3 srcs))))
      `(mapcan (lambda ,(mapcar #'car binds)
                  (when (and ,@conds)
                    (list ,(if (rest rezs)
                               (cons 'list rezs)
                               (first rezs)))))
               ,@(mapcar #'cdr binds)))))
Lisp is Python on
     steroids

     but w/o
  batteries :)
Lisp in My View
1.   Rich, non-exclusive culture
2.   Consistency & simplicity
3.   Mature interactive environment
4.   Multi-paradigm language
5.   Unique features
6.   Cool non-unique features
7.   Performant grown-up runtimes
Lisp Resources
1. Hyperspec -
http://clhs.lisp.se/Front/Contents.htm
2. Cookbook -
http://cl-cookbook.sourceforge.net/
3. Cliki – http://cliki.net
4. lispdoc - http://lispdoc.com/
5. Google Styleguide -
http://google-styleguide.googlecode.com/svn/trunk/lispguide.xml

6. L1sp.org - http://l1sp.org/
7. Lisp books -
http://pinterest.com/vseloved/lisp-books/

More Related Content

What's hot

2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge
Prof. Wim Van Criekinge
 
Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentation
Martin Odersky
 
KafNafParserPy: a python library for parsing/creating KAF and NAF files
KafNafParserPy: a python library for parsing/creating KAF and NAF filesKafNafParserPy: a python library for parsing/creating KAF and NAF files
KafNafParserPy: a python library for parsing/creating KAF and NAF files
Rubén Izquierdo Beviá
 
Python made easy
Python made easy Python made easy
Python made easy
Abhishek kumar
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
Utkarsh Sengar
 
The Sincerest Form of Flattery
The Sincerest Form of FlatteryThe Sincerest Form of Flattery
The Sincerest Form of Flattery
José Paumard
 
Python to scala
Python to scalaPython to scala
Python to scala
kao kuo-tung
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
Alex Payne
 
JDK8 Functional API
JDK8 Functional APIJDK8 Functional API
JDK8 Functional API
Justin Lin
 
DevNexus 2018: Learn Java 8, lambdas and functional programming
DevNexus 2018: Learn Java 8, lambdas and functional programmingDevNexus 2018: Learn Java 8, lambdas and functional programming
DevNexus 2018: Learn Java 8, lambdas and functional programming
Henri Tremblay
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
Fariz Darari
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
Shivam Gupta
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdb
Wei-Bo Chen
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and Python
Max Klymyshyn
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Rahul Jain
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)
RichardWarburton
 
Seattle useR Group - R + Scala
Seattle useR Group - R + ScalaSeattle useR Group - R + Scala
Seattle useR Group - R + Scala
Shouheng Yi
 
Java 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava ComparisonJava 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava Comparison
José Paumard
 
Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)
Ken Kousen
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
Peter Maas
 

What's hot (20)

2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge
 
Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentation
 
KafNafParserPy: a python library for parsing/creating KAF and NAF files
KafNafParserPy: a python library for parsing/creating KAF and NAF filesKafNafParserPy: a python library for parsing/creating KAF and NAF files
KafNafParserPy: a python library for parsing/creating KAF and NAF files
 
Python made easy
Python made easy Python made easy
Python made easy
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
The Sincerest Form of Flattery
The Sincerest Form of FlatteryThe Sincerest Form of Flattery
The Sincerest Form of Flattery
 
Python to scala
Python to scalaPython to scala
Python to scala
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
 
JDK8 Functional API
JDK8 Functional APIJDK8 Functional API
JDK8 Functional API
 
DevNexus 2018: Learn Java 8, lambdas and functional programming
DevNexus 2018: Learn Java 8, lambdas and functional programmingDevNexus 2018: Learn Java 8, lambdas and functional programming
DevNexus 2018: Learn Java 8, lambdas and functional programming
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdb
 
Odessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and PythonOdessapy2013 - Graph databases and Python
Odessapy2013 - Graph databases and Python
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)
 
Seattle useR Group - R + Scala
Seattle useR Group - R + ScalaSeattle useR Group - R + Scala
Seattle useR Group - R + Scala
 
Java 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava ComparisonJava 8 Stream API and RxJava Comparison
Java 8 Stream API and RxJava Comparison
 
Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 

Viewers also liked

Aspects of NLP Practice
Aspects of NLP PracticeAspects of NLP Practice
Aspects of NLP Practice
Vsevolod Dyomkin
 
NLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language IdentificationNLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language Identification
Vsevolod Dyomkin
 
Practical NLP with Lisp
Practical NLP with LispPractical NLP with Lisp
Practical NLP with Lisp
Vsevolod Dyomkin
 
NLP Project Full Cycle
NLP Project Full CycleNLP Project Full Cycle
NLP Project Full Cycle
Vsevolod Dyomkin
 
Crash-course in Natural Language Processing
Crash-course in Natural Language ProcessingCrash-course in Natural Language Processing
Crash-course in Natural Language Processing
Vsevolod Dyomkin
 
Tedxkyiv communication guidelines
Tedxkyiv communication guidelinesTedxkyiv communication guidelines
Tedxkyiv communication guidelinesVsevolod Dyomkin
 
Новые нереляционные системы хранения данных
Новые нереляционные системы хранения данныхНовые нереляционные системы хранения данных
Новые нереляционные системы хранения данныхVsevolod Dyomkin
 
Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?Vsevolod Dyomkin
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная оберткаVsevolod Dyomkin
 
Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?
Vsevolod Dyomkin
 
CL-NLP
CL-NLPCL-NLP
Экосистема Common Lisp
Экосистема Common LispЭкосистема Common Lisp
Экосистема Common Lisp
Vsevolod Dyomkin
 
Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)
Vsevolod Dyomkin
 
Natural Language Processing in Practice
Natural Language Processing in PracticeNatural Language Processing in Practice
Natural Language Processing in PracticeVsevolod Dyomkin
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your application
rjsmelo
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
Noah Davis
 

Viewers also liked (18)

Aspects of NLP Practice
Aspects of NLP PracticeAspects of NLP Practice
Aspects of NLP Practice
 
NLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language IdentificationNLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language Identification
 
Practical NLP with Lisp
Practical NLP with LispPractical NLP with Lisp
Practical NLP with Lisp
 
NLP Project Full Cycle
NLP Project Full CycleNLP Project Full Cycle
NLP Project Full Cycle
 
Crash-course in Natural Language Processing
Crash-course in Natural Language ProcessingCrash-course in Natural Language Processing
Crash-course in Natural Language Processing
 
Lisp Machine Prunciples
Lisp Machine PrunciplesLisp Machine Prunciples
Lisp Machine Prunciples
 
Tedxkyiv communication guidelines
Tedxkyiv communication guidelinesTedxkyiv communication guidelines
Tedxkyiv communication guidelines
 
Новые нереляционные системы хранения данных
Новые нереляционные системы хранения данныхНовые нереляционные системы хранения данных
Новые нереляционные системы хранения данных
 
Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная обертка
 
Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?
 
CL-NLP
CL-NLPCL-NLP
CL-NLP
 
Экосистема Common Lisp
Экосистема Common LispЭкосистема Common Lisp
Экосистема Common Lisp
 
Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)
 
Natural Language Processing in Practice
Natural Language Processing in PracticeNatural Language Processing in Practice
Natural Language Processing in Practice
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your application
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 

Similar to Lisp for Python Programmers

Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01
Hajime Tazaki
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
GangSeok Lee
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
David Gu
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
Tim Bunce
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
Moabi.com
 
LISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийLISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола Мозговий
Sigma Software
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )
Tim Bunce
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
Michiel Borkent
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
Saurabh Nanda
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
Itamar Haber
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with Modules
Itamar Haber
 
Redis Lua Scripts
Redis Lua ScriptsRedis Lua Scripts
Redis Lua Scripts
Itamar Haber
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
Vladimir Sedach
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL Environment
Jim Mlodgenski
 
Profiling Ruby
Profiling RubyProfiling Ruby
Profiling Ruby
Ian Pointer
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
Oleg Podsechin
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
Hyuk Hur
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
Astrails
 

Similar to Lisp for Python Programmers (20)

Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01
 
Lisp Primer Key
Lisp Primer KeyLisp Primer Key
Lisp Primer Key
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
LISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийLISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола Мозговий
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with Modules
 
Redis Lua Scripts
Redis Lua ScriptsRedis Lua Scripts
Redis Lua Scripts
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL Environment
 
Profiling Ruby
Profiling RubyProfiling Ruby
Profiling Ruby
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Lisp for Python Programmers

  • 1. Lisp for Python Developers Vsevolod Dyomkin @vseloved 2013-01-26
  • 2. Topics * A short intro * Some myths and facts * What Lisp offers
  • 3. Hello World CL-USER> "Hello world" "Hello world" CL-USER> (print "Hello world") "Hello world" "Hello world"
  • 4. Horner's Rule (Is Lisp a functional language?) (defun horner (coeffs x) (reduce (lambda (coef acc) (+ (* acc x) coef)) coeffs :from-end t :initial-value 0)) From Rosetta Code: http://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation
  • 5. Horner's Rule (Python version) def horner(coeffs, x): return reduce(lambda acc, c: acc * x + c, reversed(coeffs), 0)
  • 6. Lisp Tools 1. Implementations - multiple 2. IDEs - SLIME, SLIMV 3. quicklisp
  • 7. Myths * The syntax myth * The libraries myth * The community myth * The slowness myth * The outdatedness myth * The myth of too much choice * The myth of academic language
  • 8. Myth | Fact LISP = Lost In )))))))])))))])]) — Stupid Parenthesis the joy of debugging ASTs Your eyes are gonna -- Armin Ronacher bleed!!!! (https://twitter.com/mitsuhi ko/status/88527153158815744)
  • 9. Lisp in 1 slide
  • 10. Myth | Fact There are no Lisp 1961 libraries in libraries Quicklisp
  • 11. Myth | Fact There are no Lisp 1961 libraries in libraries Quicklisp 27413 libraries in PyPI
  • 12. (defun graylog (message &key level backtrace file line-no) (let (sock) (unwind-protect (let ((msg (salza2:compress-data (babel:string-to-octets (json:encode-json-to-string #{:version "1.0" :facility "lisp" :host (get-hostname) :|short_message| message :|full_message| backtrace :timestamp (local-time:timestamp-to-unix (local-time:now)) :level level :file file :line line-no }) :encoding :utf-8) 'salza2:zlib-compressor))) (setf sock (usocket:socket-connect *graylog-host* *graylog-port* :protocol :datagram :element-type 'ub8)) (usocket:socket-send sock msg (length msg)))) (usocket:socket-close sock)))
  • 13. Myth | Fact There's no Lisp SBCL – more than 10 programmers people contribute to each release, ABCL – There's no Lisp more than 5, etc. jobs This year: 2 Lisp Lisp community is conferences in Europe full of trolls for up to 100 people (ECLM & ECLS) & Lisp hasn't been numerous Lisp user developed for years groups meetings http://lisp-univ-etc.blogspot.com/search/label/lisp-hackers
  • 14. Myth | Fact Lisp is slow Lisp is the fastest of popular dynamic languages Lisp can be faster than Java … or even C http://benchmarksgame. alioth.debian.org/u32q /lisp.php
  • 15. Cool Lisp Features 1. Macros 2. All the functional stuff 3. CLOS multimethods 4. Special variables 5. Condition system 6. Read macros 7. The richest calling convention 8. Etc.
  • 16. Macros This page is intentionally left blank
  • 17. Condition system Jedis redis = Redis.getClient(Redis.SOME_DB); try { while (!Thread.interrupted()) try { // do some useful work break; } catch (JedisException e) { Redis.returnBrokenClient(redis); redis = Redis.getClient(Redis.SOME_DB); } // do some other stuff } finally { Redis.returnClient(redis); }
  • 18. Condition system Jedis redis = Redis.getClient(Redis.SOME_DB); try { while (!Thread.interrupted()) try { // do some useful work break; } catch (JedisException e) { Redis.returnBrokenClient(redis); redis = Redis.getClient(Redis.SOME_DB); } // do some other stuff } finally { Redis.returnClient(redis); }
  • 20. Condition system (with-persistent-connection (host port) ;; do useful stuff ) (defmacro with-persistent-connection ((&key (host #(127 0 0 1)) (port 6379)) &body body) `(with-connection (:host ,host :port ,port) (handler-bind ((redis-connection-error (lambda (e) (warn "Reconnecting.") (invoke-restart :reconnect)))) ,@body)))
  • 21. Condition system (defmacro with-reconnect-restart (&body body) `(handler-case (progn ,@body) (usocket:connection-refused-error (e) (reconnect-restart-case (:error e :comment "Can't connect”) ,@body)) ((or usocket:socket-error stream-error end-of-file) (e) (reconnect-restart-case (:error e) ,@body)))))
  • 22. Condition system (defmacro reconnect-restart-case ((&key error comment) &body body) `(if *pipelined* (progn ,@body) (restart-case (error 'redis-connection-error :error ,error :comment ,comment) (:reconnect () :report "Trying to reconnect" (reconnect) ,@body)))) http://lisp-univ-etc.blogspot.com/2012/11/cl-redis-separation- of-concerns-in.html
  • 23. Read macros { x ! x <- (loop :for i :upto 10 :collect i) } '(0 1 2 3 4 5 6 7 8 9 10 ) {x ! x <- '(1 nil 2) ! x} '(1 2) {x y ! x <- '(1 2 3) y <- '(5 6 7) ! (oddp x) (> y 5)} '((3 7)) { (+ x y) ! x <- '(1 2 3) y <- '(5 6 7) ! (oddp x) (> y 5) } '(10) (set-macro-character #{ #'read-listcomp) (set-macro-character #} (get-macro-character #)))
  • 24. (defun read-listcomp (stream char) "Read list comprehension { vars ! generators [! conditions]? }" (declare (ignore char)) (let (rezs srcs conds state) (dolist (item (read-delimited-list #} stream)) (if (eql '! item) (setf state (if state :cond :src)) (case state (:src (push item srcs)) (:cond (push item conds)) (otherwise (push item rezs))))) (setf rezs (reverse rezs) srcs (reverse srcs) conds (reverse conds)) (let ((binds (mapcar #`(cons (first %) (third %)) (group 3 srcs)))) `(mapcan (lambda ,(mapcar #'car binds) (when (and ,@conds) (list ,(if (rest rezs) (cons 'list rezs) (first rezs))))) ,@(mapcar #'cdr binds)))))
  • 25. Lisp is Python on steroids but w/o batteries :)
  • 26. Lisp in My View 1. Rich, non-exclusive culture 2. Consistency & simplicity 3. Mature interactive environment 4. Multi-paradigm language 5. Unique features 6. Cool non-unique features 7. Performant grown-up runtimes
  • 27. Lisp Resources 1. Hyperspec - http://clhs.lisp.se/Front/Contents.htm 2. Cookbook - http://cl-cookbook.sourceforge.net/ 3. Cliki – http://cliki.net 4. lispdoc - http://lispdoc.com/ 5. Google Styleguide - http://google-styleguide.googlecode.com/svn/trunk/lispguide.xml 6. L1sp.org - http://l1sp.org/ 7. Lisp books - http://pinterest.com/vseloved/lisp-books/