diff org/no_parens.org @ 1:a4cb0b71fc78

got this working again
author Robert McIntyre <rlm@mit.edu>
date Sun, 16 Oct 2011 07:52:40 -0700
parents 1c7ace5054ac
children 06131b93e54f
line wrap: on
line diff
     1.1 --- a/org/no_parens.org	Sun Oct 16 07:32:21 2011 -0700
     1.2 +++ b/org/no_parens.org	Sun Oct 16 07:52:40 2011 -0700
     1.3 @@ -4,8 +4,9 @@
     1.4  #+MATHJAX: align:"left" mathml:t path:"../MathJax/MathJax.js"
     1.5  #+STYLE: <link rel="stylesheet" type="text/css" href="../css/aurellem.css" />
     1.6  #+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
     1.7 -#+SETUPFILE: ../templates/level-0.org
     1.8 -#+INCLUDE: ../templates/level-0.org
     1.9 +#+SETUPFILE: ../../aurellem/org/level-0.org
    1.10 +#+INCLUDE: ../../aurellem/org/level-0.org
    1.11 +#+BABEL: :mkdirp yes
    1.12  
    1.13  [TABLE-OF-CONTENTS]
    1.14  
    1.15 @@ -34,35 +35,38 @@
    1.16    [this]
    1.17    (System/exit 0))
    1.18  
    1.19 +
    1.20  (defvar quit (abomination.no-parens.Quit.)
    1.21    "a sneaky way to support a `quit` command")
    1.22  #+end_src
    1.23  
    1.24 -When you type any variable at the REPL, the REPL attempts to print it as a nicely-formatted string by calling its =toString=
    1.25 -method. Our trick is to define a class with a =toString= method
    1.26 -that exits the REPL; this trick ensures that any variable of that class will close
    1.27 +When you type any variable at the REPL, the REPL attempts to print it
    1.28 +as a nicely-formatted string by calling its =toString= method. Our
    1.29 +trick is to define a class with a =toString= method that exits the
    1.30 +REPL; this trick ensures that any variable of that class will close
    1.31  the REPL when the REPL attempts to print it.
    1.32  
    1.33 -First, we use =gen-class= to make a new class named Quit; in that same line, we use
    1.34 -=:prefix= to establish the convention that any function named
    1.35 -=quit-[something]= will be adopted as the =[something]= method for the
    1.36 -newly-defined Quit class. We use this convention to write our own
    1.37 -=toString= method for Quit.
    1.38 +First, we use =gen-class= to make a new class named Quit; in that same
    1.39 +line, we use =:prefix= to establish the convention that any function
    1.40 +named =quit-[something]= will be adopted as the =[something]= method
    1.41 +for the newly-defined Quit class. We use this convention to write our
    1.42 +own =toString= method for Quit.
    1.43  
    1.44 -Next, we define a suitable =toString= method for the Quit class so that
    1.45 -attempting to print an instance of the Quit class has the effect of
    1.46 -closing the REPL. We do this by defining a function =quit-toString=
    1.47 +Next, we define a suitable =toString= method for the Quit class so
    1.48 +that attempting to print an instance of the Quit class has the effect
    1.49 +of closing the REPL. We do this by defining a function =quit-toString=
    1.50  which closes the REPL; by the convention established above, the Quit
    1.51 -class automatically adopts  =quit-toString= as its =toString= method.
    1.52 +class automatically adopts =quit-toString= as its =toString= method.
    1.53  
    1.54  Finally, we use =defvar= to create an instance of the Quit class; we
    1.55  name this instance =quit=. Now when you type =quit= into the REPL, the
    1.56 -REPL executes the =toString= method of the Quit class, exiting the REPL instead of returning a
    1.57 -string.
    1.58 +REPL executes the =toString= method of the Quit class, exiting the
    1.59 +REPL instead of returning a string.
    1.60  
    1.61  #+begin_src clojure :exports both
    1.62 -(binding [*compile-path* "/home/r/aurellem/classes"]
    1.63 +(binding [*compile-path* "/home/r/proj/abomination/classes"]
    1.64    (compile 'abomination.no-parens))
    1.65 +           
    1.66  #+end_src
    1.67  
    1.68  #+results:
    1.69 @@ -87,16 +91,18 @@
    1.70  The same thing, accomplished in a much more elegant and clojureish
    1.71  way.
    1.72  
    1.73 -#+begin_src clojure :tangle no_parens.clj :results silent :exports none :noweb yes
    1.74 -<<header>>
    1.75 -<<toString>>
    1.76 -<<lazy-seq>>
    1.77 -<<delay>>
    1.78 -#+end_src
    1.79 -
    1.80  # STUD CRUFT PIZZA
    1.81  
    1.82  #+begin_quote
    1.83  And death i think is no parenthesis
    1.84  \mdash{}E. E. Cummings
    1.85  #+end_quote
    1.86 +
    1.87 +
    1.88 +* COMMENT code generation
    1.89 +#+begin_src clojure :tangle ../src/abomination/no_parens.clj :results silent :exports none :noweb yes
    1.90 +<<header>>
    1.91 +<<toString>>
    1.92 +<<lazy-seq>>
    1.93 +<<delay>>
    1.94 +#+end_src