Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Redesigning Common Lisp

  1. Shibuya.lisp Tech Talk #8 Eitaro Fukamachi Redesigning Common Lisp
  2. Thank you for coming.
  3. I’m Eitaro Fukamachi @nitro_idiot fukamachi
  4. (and 'web-application-developer 'common-lisper)
  5. GitHub product languages Others Clojure Perl Emacs Lisp JavaScript Common Lisp
  6. GitHub product languages
  7. I ♥ Common Lisp
  8. because…
  9. Common Lisp is the most powerful, expressive and fast language ever.
  10. Common Lisp is damn powerful • First class functions + lexical closures • Object system + multiple dispatch • Metaobject protocol
  11. Common Lisp is expressive • Reader macros • Macros
  12. Common Lisp is fast • (Optional) type declaration • Inlining functions • Compiler macros • Disassembler included • Free high-performance implementation
  13. Common Lisp is the most powerful, expressive and fast language ever.
  14. = GOD LANGUAGE
  15. So, here is a question.
  16. Is Common Lisp perfect?
  17. Is Common Lisp successful?
  18. Is Common Lisp attractive to young people?
  19. ……………..
  20. “well…”
  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. It’s because of the origin.
  23. Portability 8 Goals of standardising Common Lisp Commonality Consistency Expressiveness Compatibility Efficiency Power Stability from Common Lisp the Language
  24. Common Lisp is a compound of MacLISP, Zetalisp, Spice Lisp, NIL and S-1 Lisp.
  25. Common Lisp was designed for MacLISP, Zetalisp, Spice Lisp, NIL and S-1 Lisp users, not us.
  26. Besides, Common Lisp is old.
  27. Common Lisp = 30 years old Ruby = 19 years old JavaScript = 19 years old Clojure = 7 years old
  28. Common Lisp was designed for people 30 years ago.
  29. But it doesn’t mean Common Lisp is obsolete.
  30. Common Lisp is the most powerful, expressive and fast language ever.
  31. Common Lisp is the best one, but I’m still not fulfilled in it.
  32. CLtL3? Almost hopeless.
  33. Let’s redesign Common Lisp for the 21st century by ourselves.
  34. “Common Lisp for the 21st century”
  35. “CL21”
  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. Portability 8 Goals of standardising Common Lisp Commonality Consistency Expressiveness Compatibility Efficiency Power Stability from Common Lisp the Language
  38. Consistency Expressiveness 4 Goals of CL21 Compatibility Efficiency
  39. Goal 1: Consistency
  40. Consistency of CL21 • Naming convention • Argument order
  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. 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. Consistency of CL21 Common Lisp (getf person :name) (gethash :name person-hash)
  44. Consistency of CL21 CL21 (getf person :name) (gethash person-hash :name)
  45. Goal 2: Expressiveness
  46. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  47. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  48. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols
  49. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols (ed “~/.sbclrc”)
  50. Expressiveness of CL21 • Specific vs Generic • Delete useless symbols Are you crazy???? (ed “~/.sbclrc”)
  51. Expressiveness of CL21 Common Lisp (append '(1 2 3) '(a b c)) (concatenate 'vector #(1 2 3) '()) (concatenate 'string "Hello, " name)
  52. Expressiveness of CL21 CL21 (append '(1 2 3) '(a b c)) (append #(1 2 3) '()) (append "Hello, " name)
  53. Expressiveness of CL21 Common Lisp (mapcar #'1+ '(1 2 3)) (map 'vector #'1+ #(1 2 3))
  54. Expressiveness of CL21 CL21 (map #'1+ '(1 2 3)) (map #'1+ #(1 2 3))
  55. Expressiveness of CL21 Common Lisp (format nil "Hello, World!~%") (format nil "Hello, ~A~%" name)
  56. Expressiveness of CL21 CL21 "Hello, World!n" #"Hello, ${name}n"
  57. Expressiveness of CL21 Common Lisp (parse-integer "1984") (symbol-name 'alien-technology)
  58. Expressiveness of CL21 CL21 (coerce "1984" 'integer) (coerce 'alien-technology 'string)
  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. Expressiveness of CL21 CL21 (use-package :cl21.re) ! (#/^(d{4})-(d{2})-(d{2})$/ "2014-01-23") (re-replace #/a/ig "Eitaro Fukamachi" "α")
  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. 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. 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. 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. 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. 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. Goal 3: Compatibility
  68. Compatibility of CL21 • Written in Common Lisp • 100% compatible with Common Lisp • All CL libraries are available
  69. Compatibility of CL21 (defsystem my-cl21-app :defsystem-depends-on (:cl21) :class :cl21-system :components ((:file "src/myapp")))
  70. Compatibility of CL21 (! defsystem my-cl21-app :defsystem-depends-on (:cl21) :class :cl21-system :components ((:file "src/myapp")))
  71. Goal 4: Efficiency
  72. Efficiency of CL21 • (less important in CL21, though) • Generic methods are slow • Compiler macros
  73. Consistency Expressiveness 4 Goals of CL21 Compatibility Efficiency
  74. Other topics: “syntax”
  75. “syntax” • CL21 has “syntax” • “syntax” = readtable bound to a package
  76. “syntax” (defsyntax cl21.process ((## #`) #'run-process-reader)) ! (export-syntax 'cl21.process) (use-package :cl21.process) ! #`ls -l /Users`
  77. Other topics: Standard libraries
  78. Batteries included (?) • cl21.re • cl21.process • cl21.lazy • cl21.os
  79. Remember CL21 is 100% compatible with Common Lisp
  80. You see how Common Lisp is expressive and growable?
  81. Current status
  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. WEB SITE: cl21.org ! GITHUB: github.com/cl21/cl21
  84. Make Lisp the Premier Prototyping Language. — Richard P. Gabriel “Worse Is Better”
  85. Thanks.
  86. EITARO FUKAMACHI 8arrow.org @nitro_idiot fukamachi
Advertisement