Skip to content
Browse files

nic's presentation on lisp and elnode

  • Loading branch information...
0 parents commit 9e691505c91c1a9c78b2c220915ae10cfa90a815 Nic Ferrier committed Aug 30, 2012
BIN 2-4.Greenblatt-Richard_Knight.1978.L02645385.MIT.lg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN 303px-Symbolics3640_Modified.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN 400px-Tim_Berners-Lee_closeup.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN 453px-LISP_machine.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN 746px-Sun100U_Cardcage.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN 779px-HalAbelsonJI1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN BEich.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
456 File-Mosaic_Netscape_0.9_on_Windows_XP.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Jerry_Sussman.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Ken_n_dennis.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Netscape_3_.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Robert_Tappan_Morris.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 chat.el
@@ -0,0 +1,78 @@
+;;; chat example - very simple webchat -*- lexical-binding: t -*-
+(require 'esxml)
+(require 'cl)
+(require 'elnode)
+(defconst chat-dir (file-name-directory
+ (or (buffer-file-name)
+ load-file-name
+ default-directory)))
+
+(defun chat-main-templater ()
+ "Return the `chat-list' as rows for initial chat display."
+ (list
+ (cons
+ "messages"
+ (chat-list-to-html))))
+
+(defun chat-main-handler (httpcon)
+ "The main handler."
+ (let ((chat-js (concat chat-dir "chat.js"))
+ (chat-html (concat chat-dir "chat.html"))
+ (chat-css (concat chat-dir "styles.css")))
+ (elnode-hostpath-dispatcher
+ httpcon
+ `(("^.*//chat/poll/" . chat-comet-handler)
+ ("^.*//chat/send/" . chat-send-handler)
+ ("^.*//chat.js" . ,(elnode-make-send-file chat-js))
+ ("^.*//styles.css" . ,(elnode-make-send-file chat-css))
+ ("^.*//" . ,(elnode-make-send-file
+ chat-html
+ :replacements 'chat-main-templater))))))
+
+(defvar chat-list '())
+
+(defun chat-add (user text)
+ (add-to-list
+ 'chat-list
+ (list (current-time) user text)))
+
+(defun chat-list-since (since)
+ (loop for rec in chat-list
+ if (time-less-p since (car rec))
+ collect rec))
+
+;; chat-comet-handler - defer until there is some chat to send
+(defun chat-comet-handler (httpcon)
+ "Defer until there is new chat."
+ (let ((entered (current-time)))
+ (elnode-defer-until (chat-list-since entered)
+ (elnode-send-json
+ httpcon elnode-defer-guard-it :jsonp t))))
+
+;; chat-send-handler - add the POSTed chat to the chat-list
+;; the username is in a cookie: chatusername
+;; the message parameter is "msg"
+(defun chat-send-handler (httpcon)
+ (let ((username (elnode-http-cookie httpcon "chatusername" t))
+ (msg (elnode-http-param httpcon "msg")))
+ (chat-add username msg)
+ (elnode-send-json httpcon (json-encode '("thanks")))))
+
+;; chat-list-to-html - make a table rows
+;; each cell should have a class, username or message
+;; the username row could have the username as a class as well
+(defun chat-list-to-html ()
+ (loop for entry in chat-list
+ concat
+ (esxml-to-xml
+ `(tr
+ ()
+ (td
+ ((class . "username"))
+ ,(elt entry 1))
+ (td
+ ((class . "message"))
+ ,(elt entry 2))))))
+
+
+;;; chat.el ends here
78 chat.el~
@@ -0,0 +1,78 @@
+;;; chat example - very simple webchat -*- lexical-binding: t -*-
+(require 'esxml)
+(require 'cl)
+(require 'elnode)
+(defconst chat-dir (file-name-directory
+ (or (buffer-file-name)
+ load-file-name
+ default-directory)))
+
+(defun chat-main-templater ()
+ "Return the `chat-list' as rows for initial chat display."
+ (list
+ (cons
+ "messages"
+ (chat-list-to-html))))
+
+(defun chat-main-handler (httpcon)
+ "The main handler."
+ (let ((chat-js (concat chat-dir "chat.js"))
+ (chat-html (concat chat-dir "chat.html"))
+ (chat-css (concat chat-dir "styles.css")))
+ (elnode-hostpath-dispatcher
+ httpcon
+ `(("^.*//chat/poll/" . chat-comet-handler)
+ ("^.*//chat/send/" . chat-send-handler)
+ ("^.*//chat.js" . ,(elnode-make-send-file chat-js))
+ ("^.*//styles.css" . ,(elnode-make-send-file chat-css))
+ ("^.*//" . ,(elnode-make-send-file
+ chat-html
+ :replacements 'chat-main-templater))))))
+
+
+(defvar chat-list '())
+
+(defun chat-add (user text)
+ (add-to-list
+ 'chat-list
+ (list (current-time) user text)))
+
+(defun chat-list-since (since)
+ (loop for rec in chat-list
+ if (time-less-p since (car rec))
+ collect rec))
+
+;; chat-comet-handler - defer until there is some chat to send
+(defun chat-comet-handler (httpcon)
+ "Defer until there is new chat."
+ (let ((entered (current-time)))
+ (elnode-defer-until (chat-list-since entered)
+ (elnode-send-json
+ httpcon elnode-defer-guard-it :jsonp t))))
+
+;; chat-send-handler - add the POSTed chat to the chat-list
+;; the username is in a cookie: chatusername
+;; the message parameter is "msg"
+(defun chat-send-handler (httpcon)
+ (let ((username (elnode-http-cookie httpcon "chatusername" t))
+ (msg (elnode-http-param httpcon "msg")))
+ (chat-add username msg)
+ (elnode-send-json httpcon (json-encode '("thanks")))))
+
+;; chat-list-to-html - make a table rows
+;; each cell should have a class, username or message
+;; the username row could have the username as a class as well
+(defun chat-list-to-html ()
+ (loop for entry in chat-list
+ concat
+ (esxml-to-xml
+ `(tr
+ ()
+ (td
+ ((class . ,(concat "username,"
+ (elt entry 1))))
+ ,(elt entry 1))
+ (td ((class . "message")) ,(elt entry 2))))))
+
+
+;;; chat.el ends here
BIN crockford.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN dahl.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN guy_steele.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN heinemeier.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN hipster.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN james-gosling.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN jamie.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN jmcbw.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN lighttabletable.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN mark_zuckerberg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN matz.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN mcnealy.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN nicferrier.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN paul.graham.jpg
Diff not rendered.
BIN restore-distribution.gif
Diff not rendered.
BIN richhickey.jpg
Diff not rendered.
BIN rpg.jpg
Diff not rendered.
BIN stallman-1.jpg
Diff not rendered.
BIN stallman-2.jpg
Diff not rendered.
BIN stallman-3.jpg
Diff not rendered.
BIN stallman-3.jpg~
Binary file not shown.
BIN stallman-4.jpg
Diff not rendered.
BIN stallman-5.jpg
Diff not rendered.
BIN stallman-6.jpg
Diff not rendered.
80 talk.org
@@ -0,0 +1,80 @@
+DON'T FORGET TO SHOUT THE NAMES
+
+* Elnode and the history of Lisp
+** A story with fewer beards than you might think
+** With some jumping around
+* this guy invents a language
+** John McCarthy [[file:./jmcbw.jpg]]
+** it's 1958 for God's sake
+* it's so exciting and powerful :add_to_list:
+** Richard Greenblatt [[file:./2-4.Greenblatt-Richard_Knight.1978.L02645385.MIT.lg.jpg]]
+** [[./chat.el::35]]
+* they decide to build a computer around it
+** the Knight machine [[file:./453px-LISP_machine.jpg]]
+* this guy hates having his life ruined by the business
+** Richard Stallman [[file:./stallman-1.jpg]]
+* meanwhile these guys invent UNIX
+** Ken Thompson and Dennis Ritchie [[file:./Ken_n_dennis.jpg]]
+* UNIX runs on cheap commodity hardware
+** Ken and Dennis at a PDP-11 [[file:./unix-machine.jpg]]
+* this guy and a bunch of other guys standardize Lisp :loop_macro:
+** Richard Gabriel [[file:./rpg.jpg]]
+** [[~/chat.el::40]]
+* this guy uses CommonLisp to make the first web shop and get rich
+** Paul Graham [[file:./paul.graham.jpg]]
+* this guy is so upset by what's happened to hackers he starts the GNU project
+** Richard Stallman [[file:./stallman-4.jpg]]
+* Stallman hopes to use Emacs from this guy
+** James Gosling [[file:./james-gosling.jpg]]
+*** but Gosling first agrees and then sells the code to someone else
+*** Stallman is forced to write a Lisp version
+* Symbolics sells loads of Lisp Machines to Government and Big Business
+** Symbolics Lisp Machine [[file:./303px-Symbolics3640_Modified.JPG]]
+* Genera, the most advanced operating environment ever
+** genera restore screen [[file:./restore-distribution.gif]]
+* but soon this guy and his college chums
+** Scott McNealy [[file:./mcnealy.jpg]]
+* make this "worse" better than Lisp Machines
+** Sun Workstation open [[file:./746px-Sun100U_Cardcage.jpg]]
+* one of the Lisp Machine companies survives to employ this guy
+** Jamie Zawinski [[file:./jamie.jpg]]
+* who goes on to make this
+** Netscape Navigator [[file:Netscape_3_.png][file:~/work/elnode-talk/Netscape_3_.png]]
+* which implements a riff on ideas in Lisp by this guy :chat_main_templater:
+** [[file:./chat.el::45]]
+** Sir Tim Berners Lee [[file:./400px-Tim_Berners-Lee_closeup.jpg]]
+* and includes a language which was changed from Lisp in a weekend by this guy
+** Brendan Eich [[file:./BEich.jpg]]
+*** this is gosling shitting on lisp AGAIN
+*** his language has such hype they have to call the new language "javascript"
+* meanwhile this guy has built a movement around GNU
+** Richard Stallman [[file:./stallman-5.jpg]]
+* this guy has made a kernel for it
+** Linus Torvalds [[file:./torvalds_linus.jpg]]
+* no one uses Lisp anymore but they do use Emacs
+** Mark Zuckerberg [[file:./mark_zuckerberg.jpg]]
+* meanwhile this guy users EmacsLisp as inspiration for Ruby
+** Yukihiro Matsumoto [[file:./matz.jpg]]
+* Ruby becomes crazy popular because of this guy's Rails web thing
+** DHH [[file:./heinemeier.jpg]]
+* and this guy's insistance that it be easy for people :elnode_hello_world:
+** _why? [[file:./why.jpg]]
+* the web has lots of scaling problems, this guy thinks Lisp is the answer
+** Rich Hickey [[file:./richhickey.jpg]]
+* this guy finally steps down as Emacs maintainer :elnode_packaged:
+** Richard Stallman [[file:./stallman-6.jpg]]
+* Lisp starts getting popular again, as if the old guard are compost
+** John McCarthy [[file:./jmcbw.jpg]]
+* this guy invents an xml beater based on a language based on lisp :chat_send_handler:
+** Doug Crockford [[file:./crockford.png]]
+** [[file:~/work/elnode-auth/examples/chat.el:27]]
+* some guy gets a Gazillion $ on KickStarter for pitching Emacs
+** Light Table [[file:./lighttabletable.png]]
+*** no one notices
+* relatedly this guy invents a new way of doing web, exploiting latency
+** Ryan Dahl [[file:./dahl.jpg]]
+* finally this guy makes EmacsLisp do the same thing node.js does :chat_comet_handler:
+** Nic Ferrier [[file:./nicferrier.jpg]]
+** [[~/work/elnode-auth/examples/chat.el::31]]
+* Emacs achieves hipster nirvana
+** Hipster [[file:./hipster.jpg]]
BIN teco-emacs.png
Diff not rendered.
BIN tom_knight.jpg
Diff not rendered.
BIN torvalds_linus.jpg
Diff not rendered.
BIN unix-machine.jpg
Diff not rendered.
BIN why.jpg
Diff not rendered.

0 comments on commit 9e69150

Please sign in to comment.
Something went wrong with that request. Please try again.