Misc cleanup for midwest.io presentation.
authorJoel Martin <github@martintribe.org>
Sat, 7 Nov 2015 21:19:44 +0000 (15:19 -0600)
committerJoel Martin <github@martintribe.org>
Sat, 7 Nov 2015 21:31:25 +0000 (15:31 -0600)
.gitignore
mal/Makefile
mal/hello.mal [new file with mode: 0644]
mal/presentation.mal [new file with mode: 0755]
runtest.py
tests/step0_repl.mal

index f7136c0..d6b584b 100644 (file)
@@ -1,13 +1,19 @@
 */experiments
-make/mal.mk
 */node_modules
-js/mal.js
-js/mal_web.js
-bash/mal.sh
 c/*.o
 *.pyc
+bash/mal.sh
 c/mal
+coffee/mal.coffee
+crystal/mal
 haskell/mal
+js/mal.js
+js/mal_web.js
+make/mal.mk
+mal/mal.mal
+nim/mal
+php/mal.php
+python/mal.py
 */step0_repl
 */step1_read_print
 */step2_eval
index cc1d7e5..6390d18 100644 (file)
@@ -5,7 +5,10 @@ SOURCES_BASE =
 SOURCES_LISP = env.mal core.mal stepA_mal.mal
 SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
 
-all:
+all: mal.mal
+
+mal.mal: stepA_mal.mal
+       cp $< $@
 
 #.PHONY: stats tests $(TESTS)
 .PHONY: stats
diff --git a/mal/hello.mal b/mal/hello.mal
new file mode 100644 (file)
index 0000000..165efc4
--- /dev/null
@@ -0,0 +1,2 @@
+(println "hello world\n\nanother line")
+(println "and another line")
diff --git a/mal/presentation.mal b/mal/presentation.mal
new file mode 100755 (executable)
index 0000000..80dadac
--- /dev/null
@@ -0,0 +1,123 @@
+;; Mal Presentation
+
+(def! clear
+  (fn* ()
+    (str "\e[2J\e[;H")))
+
+(def! bold
+  (fn* (s)
+    (str "\e[1m" s "\e[0m")))
+
+(def! blue
+  (fn* (s)
+    (str "\e[1;34m" s "\e[0m")))
+
+(def! title
+  (fn* (s)
+    (bold (blue (str s "\n")))))
+
+(def! title2
+  (fn* (s)
+    (bold (blue s))))
+
+
+(def! slides
+  (list
+   (list
+    (title2 " __  __    _    _")
+    (title2 "|  \/  |  / \  | |")
+    (title2 "| |\/| | / _ \ | | ")
+    (title2 "| |  | |/ ___ \| |___ ")
+    (title2 "|_|  |_/_/   \_\_____|"))
+   (list
+    (title "gherkin")
+    "- a lisp1 written in bash4")
+   (list
+    (title "mal - an interpreter for a subset of Clojure"))
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make")
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make"
+    "- and Bash 4")
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make"
+    "- and Bash 4"
+    "- and Javascript")
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make"
+    "- and Bash 4"
+    "- and Javascript"
+    "- and Python")
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make"
+    "- and Bash 4"
+    "- and Javascript"
+    "- and Python"
+    "- and Clojure")
+   (list
+    (title "mal - an interpreter for a subset of Clojure")
+    "- written in GNU make"
+    "- and Bash 4"
+    "- and Javascript"
+    "- and Python"
+    "- and Clojure"
+    "- and 17 other languages")
+   (list
+    (title "things it has")
+    "- scalars: integers, strings, symbols, keywords, nil, true, false"
+    "- immutable collections: lists, vectors, hash-maps"
+    "- metadata, atoms"
+    "- def!, fn*, let*"
+    "  - varargs: (fn* (x y & more) ...)"
+    "- tail call optimization"
+    "  -  except GNU make implementation (no iteration)"
+    "- macros (quote, unquote, quasiquote, splice-quote)"
+    "- over 500 unit tests"
+    "- REPL with line editing (GNU readline/libedit/linenoise)")
+   (list
+    (title "things it does not have")
+    "- performance"
+    "- namespaces"
+    "- GC (in bash, make, C implmentations)"
+    "- protocols :-("
+    "- lots of other things")
+   (list
+    (title "why?")
+    "- because!")
+   (list
+    (title "why?")
+    "- because!"
+    "- gherkin was an inspiration to higher levels of crazy"
+    "- evolved into learning tool"
+    "- way to learn about Lisp and also the target language"
+    "- each implementation broken into small 11 steps")
+   (list
+    (title "thanks to:")
+    "- Peter Norvig: inspiration: lispy"
+    "  - http://norvig.com/lispy.html"
+    "- Alan Dipert: gherkin, original gherkin slides"
+    "  - https://github.com/alandipert/gherkin")
+   (list
+    (title "mal - Make a Lisp")
+    "https://github.com/kanaka/mal")
+   (list
+    (title "demo"))))
+
+(def! present
+  (fn* (slides)
+    (if (> (count slides) 0)
+      (do
+        (println (clear))
+
+        (apply println (map (fn* (line) (str "\n        " line)) (first slides)))
+        (println "\n\n\n")
+        (readline "")
+        (present (rest slides))))))
+
+(present slides)
+
index a61d273..308ecbc 100755 (executable)
@@ -258,7 +258,7 @@ while t.next():
             else:
                 log(" -> FAIL (line %d):" % t.line_num)
                 fail_cnt += 1
-            log("    Expected : %s" % repr(expected))
+            log("    Expected : %s" % repr(expected[0]))
             log("    Got      : %s" % repr(res))
     except:
         _, exc, _ = sys.exc_info()
index 9bf80d1..2b83a01 100644 (file)
@@ -1,14 +1,17 @@
-hello world
-;=>hello world
-
+;; Testing basic string
 abcABC123
 ;=>abcABC123
 
+;; Testing string containing spaces
+hello mal world
+;=>hello mal world
+
+;; Testing string containing symbols
 []{}"'* ;:()
 ;=>[]{}"'* ;:()
 
 
-;;; Test long line
+;; Test long string
 hello world abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 (;:() []{}"'* ;:() []{}"'* ;:() []{}"'*)
 ;=>hello world abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 (;:() []{}"'* ;:() []{}"'* ;:() []{}"'*)