Permalink
Browse files

bring the examples up to date and fix stale code in the examples

  • Loading branch information...
1 parent 6a8ebb6 commit 967c90a6e82add39806ed5a54a13859b31c20b7b @ericbmerritt committed Jul 19, 2012
@@ -1,16 +1,16 @@
-(ns example.anonymous-funs
+(ns anonymous-funs
(use (erlang :only (==/2))))
(defn internal-test ()
(fn (arg1 arg2)
{:hello arg1 arg2}))
(defn+ do-test ()
- (let ((z (internal-test))
- (x (fn (arg1 arg2)
- {:hello arg1 arg2}))
- (y (x 1 2)))
- (do (== y (x 1 2))
+ (let* (z (internal-test)
+ x (fn (arg1 arg2)
+ {:hello arg1 arg2})
+ y (x 1 2))
+ (do
(apply internal-test/0)
(apply x 1 2)
(apply erlang/phash2/1 22))))
@@ -1,4 +1,4 @@
-(ns example.complex-module
+(ns complex-module
(use string code)
(attr sfoo 123)
(use (lists :only (member/2 append/2)
@@ -1,29 +1,28 @@
-(ns example.case
+(ns example-case
(use (erlang :only (==/2 phash2/1 and/2))))
(defn internal-test (arg1 arg2)
(case {arg1 arg2}
({:foo :bar}
(phash2 :bar))
- ((= four (= three :z))
- (erlang/is_atom three)
+ ((= four (= three {:z :v} ))
(phash2 four))
(_z
:ok)))
(defn internal-test2 (arg1 arg2 arg3)
(case [arg1 arg2 arg3]
([one two three]
- (and (and (erlang/is_atom one)
+ (when (and (and (erlang/is_atom one)
(erlang/is_integer two))
- (erlang/is_list three))
- (phash2 one))
+ (erlang/is_list three)))
+ (phash2 one))
([{a a 33} a 4]
(phash2 a))
([:foo :bar _]
(phash2 :bar))))
(defn+ do-test (arg1 arg2 arg3)
- (let ((z (internal-test arg1 arg2))
- (x (internal-test2 arg1 arg2 arg3)))
+ (let* (z (internal-test arg1 arg2)
+ x (internal-test2 arg1 arg2 arg3))
{z x}))
@@ -0,0 +1,22 @@
+(ns example-let
+ (require erlang)
+ (use (io :only (format/2) :rename ((format/2 print)))))
+
+(defn internal-test ()
+ [1 2 3 4 5 6 7 8])
+
+(defn+ do-test ()
+ (let* (foo 1
+ z (erlang/phash2 22)
+ a 1
+ b 2
+ c 3
+ a1 (internal-test)
+ bar [1 2 3 4 5] ; This is a comment test
+ baz "Hello World"
+ bad-boy 'super-dooper)
+ (do
+ ;; as is this
+ (print "~i ~p ~s ~p ~p~n"
+ [foo bar baz bad-boy (1 . 2)])
+ {foo bar baz bad-boy z a b c a1})))
@@ -1,4 +1,4 @@
-(ns jxat-fibonacci
+(ns fibonacci
(use (erlang :only (>/2 -/2 +/2))))
(defn+ fibo (n)
@@ -7,4 +7,4 @@
(1 1)
(_ (when (> n 0))
(+ (fibo (- n 1))
- (fibo (- n 2))))))
+ (fibo (- n 2))))))
@@ -1,6 +1,5 @@
-(ns example.helloworld
+(ns helloworld
(use (io :only (format/2) :rename ((format/2 print)))))
(defn+ hello-world (arg)
(print "~p" [arg]))
-
View
@@ -1,20 +0,0 @@
-(ns example.let
- (require erlang)
- (use (io :only (format/2) :rename ((format/2 print)))))
-
-(defn internal-test ()
- [1 2 3 4 5 6 7 8])
-
-(defn+ do-test ()
- (let ((foo 1)
- (z (erlang/phash2 22))
- ((a b c) (values 1 2 3))
- (a1 (internal-test))
- (bar [1 2 3 4 5]) ; This is a comment test
- (baz \"Hello World\")
- (bad-boy 'super-dooper))
- (do
- ;; as is this
- (print \"~i ~p ~s ~p ~p~n\"
- [foo bar baz bad-boy (1 . 2)])
- {foo bar baz bad-boy z a b c a1})))
@@ -1,6 +1,6 @@
(ns sieve-of-eratosthenes
(require lists io)
- (use (joxa.core :only (!=/2))
+ (use (joxa-core :only (!=/2))
(erlang :only (rem/2 +/2))))
(defn sieve (v primes)

0 comments on commit 967c90a

Please sign in to comment.