Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Redesigning Common Lisp

8.233 Aufrufe

Veröffentlicht am

Shibuya.lisp Tech Talk #8

Veröffentlicht in: Technologie
  • Thank you very much for these works. I hope CL21 will grow into a mainstream programing language for lispers. I love it.
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

Redesigning Common Lisp

  1. 1. Shibuya.lisp Tech Talk #8 Eitaro Fukamachi Redesigning Common Lisp
  2. 2. Thank you for coming.
  3. 3. I’m Eitaro Fukamachi @nitro_idiot fukamachi
  4. 4. (and 'web-application-developer 'common-lisper)
  5. 5. GitHub product languages Others Clojure Perl Emacs Lisp JavaScript Common Lisp
  6. 6. GitHub product languages
  7. 7. I ♥ Common Lisp
  8. 8. because…
  9. 9. Common Lisp is the most powerful, expressive and fast language ever.
  10. 10. Common Lisp is damn powerful • First class functions + lexical closures • Object system + multiple dispatch • Metaobject protocol
  11. 11. Common Lisp is expressive • Reader macros • Macros
  12. 12. Common Lisp is fast • (Optional) type declaration • Inlining functions • Compiler macros • Disassembler included • Free high-performance implementation
  13. 13. Common Lisp is the most powerful, expressive and fast language ever.
  14. 14. = GOD LANGUAGE
  15. 15. So, here is a question.
  16. 16. Is Common Lisp perfect?
  17. 17. Is Common Lisp successful?
  18. 18. Is Common Lisp attractive to young people?
  19. 19. ……………..
  20. 20. “well…”
  21. 21. Common Lisp is not sophisticated • too-long-wordy-name-for-common-macros • append & nconc • elt vs aref vs nth • getf vs gethash • map?? mapc?? dolist?? loop?? • Functional vs Procedual
  22. 22. It’s because of the origin.
  23. 23. Portability 8 Goals of standardising Common Lisp Commonality Consistency Expressiveness Compatibility Efficiency Power Stability from Common Lisp the Language
  24. 24. Common Lisp is a compound of MacLISP, Zetalisp, Spice Lisp, NIL and S-1 Lisp.
  25. 25. Common Lisp was designed for MacLISP, Zetalisp, Spice Lisp, NIL and S-1 Lisp users, not us.
  26. 26. Besides, Common Lisp is old.
  27. 27. Common Lisp = 30 years old Ruby = 19 years old JavaScript = 19 years old Clojure = 7 years old
  28. 28. Common Lisp was designed for people 30 years ago.
  29. 29. But it doesn’t mean Common Lisp is obsolete.
  30. 30. Common Lisp is the most powerful, expressive and fast language ever.
  31. 31. Common Lisp is the best one, but I’m still not fulfilled in it.
  32. 32. CLtL3? Almost hopeless.
  33. 33. Let’s redesign Common Lisp for the 21st century by ourselves.
  34. 34. “Common Lisp for the 21st century”
  35. 35. “CL21”
  36. 36. What is CL21? • (One of) the next generation of Common Lisp • Bases on Common Lisp • Designed for us • Actual implementation (not only discussions)
  37. 37. Portability 8 Goals of standardising Common Lisp Commonality Consistency Expressiveness Compatibility Efficiency Power Stability from Common Lisp the Language
  38. 38. Consistency Expressiveness 4 Goals of CL21 Compatibility Efficiency
  39. 39. Goal 1: Consistency
  40. 40. Consistency of CL21 • Naming convention • Argument order
  41. 41. Consistency of CL21 Common Lisp (reverse '(1 2 3)) (nreverse '(1 2 3)) ! (append '(1 2 3) '(a b c)) (nconc '(1 2 3) '(a b c))
  42. 42. Consistency of CL21 CL21 (reverse '(1 2 3)) (nreverse '(1 2 3)) ! (append '(1 2 3) '(a b c)) (nappend '(1 2 3) '(a b c))
  43. 43. Consistency of CL21 Common Lisp (getf person :name) (gethash :name person-hash)
  44. 44. Consistency of CL21 CL21 (getf person :name) (gethash person-hash :name)
  45. 45. Goal 2: Expressiveness
  46. 46. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  47. 47. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  48. 48. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  49. 49. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols (ed “~/.sbclrc”)
  50. 50. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols Are you crazy???? (ed “~/.sbclrc”)
  51. 51. Expressiveness of CL21 Common Lisp (append '(1 2 3) '(a b c)) (concatenate 'vector #(1 2 3) '()) (concatenate 'string "Hello, " name)
  52. 52. Expressiveness of CL21 CL21 (append '(1 2 3) '(a b c)) (append #(1 2 3) '()) (append "Hello, " name)
  53. 53. Expressiveness of CL21 Common Lisp (mapcar #'1+ '(1 2 3)) (map 'vector #'1+ #(1 2 3))
  54. 54. Expressiveness of CL21 CL21 (map #'1+ '(1 2 3)) (map #'1+ #(1 2 3))
  55. 55. Expressiveness of CL21 Common Lisp (format nil "Hello, World!~%") (format nil "Hello, ~A~%" name)
  56. 56. Expressiveness of CL21 CL21 "Hello, World!n" #"Hello, ${name}n"
  57. 57. Expressiveness of CL21 Common Lisp (parse-integer "1984") (symbol-name 'alien-technology)
  58. 58. Expressiveness of CL21 CL21 (coerce "1984" 'integer) (coerce 'alien-technology 'string)
  59. 59. Expressiveness of CL21 (ql:quickload :cl-ppcre) (use-package :cl-ppcre) ! (scan-to-strings "^(d{4})-(d{2})-(d{2})$" "2014-01-23") (regex-replace-all "a" "Eitaro Fukamachi" "α" :preserve-case nil) Common Lisp
  60. 60. Expressiveness of CL21 CL21 (use-package :cl21.re) ! (#/^(d{4})-(d{2})-(d{2})$/ "2014-01-23") (re-replace #/a/ig "Eitaro Fukamachi" "α")
  61. 61. Expressiveness of CL21 CL21 ! (use-package :cl21.re) ! (#/^(#/^(d{4})-(d{2})-(d{2})$/ "2014-01-23") (re-replace #/a/ig "Eitaro Fukamachi" "α")
  62. 62. Expressiveness of CL21 CL21 ! (use-package :cl21.re) ! (#/^(#/^(d{4})-(d{2})-(d{2})$/ "2014-01-23") (re-replace #/a/ig "Eitaro Fukamachi" "α") Appliable Regex literal
  63. 63. Expressiveness of CL21 Common Lisp (ql:quickload :clazy) (use-package :clazy) ! (defun fib-seq () (labels ((rec (a b) (clazy:lazily (cons a (rec b (+ a b)))))) (rec 0 1))) ! (head (tail (tail (tail (fib-seq))))) (lazy-seq:take 5 (fib-seq))
  64. 64. Expressiveness of CL21 CL21 (use-package :cl21.lazy) ! (defun fib-seq () (labels ((rec (a b) (lazy-sequence (cons a (rec b (+ a b)))))) (rec 0 1))) ! (first (rest (rest (rest (fib-seq))))) (elt (fib-seq) 3) (subseq (fib-seq) 0 5)
  65. 65. Expressiveness of CL21 CL21 ! (use-package :cl21.lazy) ! (defun fib-seq () (labels ((rec (a b) Abstract sequence (lazy-sequence (cons a (rec b (+ a b)))))) (rec 0 1))) ! ! ! ! ! (first (rest (rest (rest (fib-seq))))) (elt (fib-seq) 3) (subseq (fib-seq) 0 5)
  66. 66. Expressiveness of CL21 CL21 ! (use-package :cl21.lazy) ! (defun fib-seq () (labels ((rec (a b) Abstract sequence (lazy-sequence (cons a (rec b (+ a b)))))) (rec 0 1))) ! ! ! ! ! (first (rest (rest (rest (fib-seq))))) (elt (fib-seq) 3) (subseq (fib-seq) 0 5) Builtin sequence functions are available
  67. 67. Goal 3: Compatibility
  68. 68. Compatibility of CL21 • Written in Common Lisp • 100% compatible with Common Lisp • All CL libraries are available
  69. 69. Compatibility of CL21 (defsystem my-cl21-app :defsystem-depends-on (:cl21) :class :cl21-system :components ((:file "src/myapp")))
  70. 70. Compatibility of CL21 (! defsystem my-cl21-app :defsystem-depends-on (:cl21) :class :cl21-system :components ((:file "src/myapp")))
  71. 71. Goal 4: Efficiency
  72. 72. Efficiency of CL21 • (less important in CL21, though) • Generic methods are slow • Compiler macros
  73. 73. Consistency Expressiveness 4 Goals of CL21 Compatibility Efficiency
  74. 74. Other topics: “syntax”
  75. 75. “syntax” • CL21 has “syntax” • “syntax” = readtable bound to a package
  76. 76. “syntax” (defsyntax cl21.process ((## #`) #'run-process-reader)) ! (export-syntax 'cl21.process) (use-package :cl21.process) ! #`ls -l /Users`
  77. 77. Other topics: Standard libraries
  78. 78. Batteries included (?) • cl21.re • cl21.process • cl21.lazy • cl21.os
  79. 79. Remember CL21 is 100% compatible with Common Lisp
  80. 80. You see how Common Lisp is expressive and growable?
  81. 81. Current status
  82. 82. Current status • Still in development • No backward-compatibility guaranteed • We’ll release in the 21st century • Not settled discussions • loop vs iterate vs series
  83. 83. WEB SITE: cl21.org ! GITHUB: github.com/cl21/cl21
  84. 84. Make Lisp the Premier Prototyping Language. — Richard P. Gabriel “Worse Is Better”
  85. 85. Thanks.
  86. 86. EITARO FUKAMACHI 8arrow.org @nitro_idiot fukamachi

×