Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
(defun next-minipage () (interactive) (goto-char (search-forward "\f\n")) (recenter 0)) (defun previous-minipage () (interactive) (backward-char) (goto-char (+ 2 (search-backward "\f\n"))) (recenter 0)) (define-key my-mode-map (kbd "S-<up>") 'previous-minipage) (define-key my-mode-map (kbd "S-<down>") 'next-minipage) ;; (find-estring "\f\nFirst minipage\n\n\f\nSecond\n\n\f\nThird\n") ;; http://angg.twu.net/eev-current/slides/ ;; http://angg.twu.net/eev-current/slides/slides-pt.tex ;; http://angg.twu.net/eev-current/slides/dec2006-pt.txt ;; (find-pspage "~/eev-current/slides/slides-pt.ps") ;; (find-pspage "~/eev-current/slides/slides.ps") ;; (find-sh "gsub.lua '\f' '^L' < ~/eev-current/slides/dec2006-pt.txt") ;; (find-sh "tr '\f' '_' < ~/eev-current/slides/dec2006-pt.txt") ;; (find-anggfile "bin/gsub.lua") ;; (eea2ps (point-min) (point-max)) * (eepitch-shell) gsdj-tmp ~/o.ps cd /tmp/ laf cat o.p001 > /dev/lp0 cat o.p002 > /dev/lp0 Emacs: história =============== 1958: Lisp <- linguagem 1963: TECO <- editor programável 1970: Unix <- sistema operacional 1975: Emacs (versão em TECO) 1976: Emacs (primeiras versões em Lisp) 1979: artigo (Richard Stallman): "EMACS: The Extensible, Customizable Display Editor" 1983: GPL 1983: Projeto GNU Refs: http://www.jwz.org/doc/emacs-timeline.html http://www.gnu.org/software/emacs/emacs-paper.html TECO: exemplo de programa ========================= (http://en.wikipedia.org/wiki/Text_Editor_and_Corrector#Example_2) 0uz ! clear repeat flag ! <j 0aua l ! load 1st char into register A ! <0aub ! load 1st char of next line into B ! qa-qb"g xa k -l ga -1uz ' ! if A>B, switch lines and set flag ! qbua ! load B into A ! l .-z;> ! loop back if another line in buffer ! qz;> ! repeat if a switch was made last pass ! " Lisp: primeiros exemplos ======================== (+ 1 2) -> 3 (* (+ 1 2) (+ 3 4)) -> 21 (list (+ 2 3) (* 4 5)) -> (5 20) (car (list (+ 2 3) (* 4 5))) -> 5 (cdr (list (+ 2 3) (* 4 5))) -> (20) Lisp: mais exemplos =================== ;; Calcula 20+21+22+...+50: (let ((total 0) (i 20)) (while (<= i 50) (setq total (+ total i)) (setq i (+ i 1))) total) -> 1085 ;; Calcula 5^2: (defun square (n) (* n n)) -> square (square 5) -> 25 (defun cube (n) (* n (square n))) -> cube (cube 5) -> 125 Lisp "matemático" versus Lisp "computacional" ============================================= Lisp "computacional": * strings e conses são representados por endereços de memória * duas funções de comparação: * eq: rápido, compara endereços * equal: lento, compara estruturas (eq (list 1 2) (list 1 2)) -> nil (equal (list 1 2) (list 1 2)) -> t * garbage collection Como assim, "Lisp é poderoso"? ============================== A definição de "Universal Turing Machine" (1936) é bem complicada... Uma versão do "eval" original (1958), em Lisp moderno: http://www.paulgraham.com/rootsoflisp.html http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp Pergunta: Pra que queremos isso? Resposta: Modificando o "eval" nós modificamos a linguagem... O Lisp original não tem nem "let", nem "while", por exemplo. Qualquer Lisp lisp Idéia original (Turing, 1936): "...the primary representation of program code is the same type of list structure that is also used for the main data structures. As a result, Lisp functions can be manipulated, altered or even created within a Lisp program without extensive parsing or manipulation of binary machine code." (wikipedia: Lisp) -- (find- # Local Variables: # coding: raw-text-unix # modes: (fundamental-mode emacs-lisp-mode) # End: