Skip to content

Commit

Permalink
bring the examples up to date and fix stale code in the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbmerritt committed Jul 19, 2012
1 parent 6a8ebb6 commit 967c90a
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
12 changes: 6 additions & 6 deletions examples/anonymous-funs.jxa
@@ -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)
Expand Down
15 changes: 7 additions & 8 deletions examples/case.jxa → examples/example-case.jxa
@@ -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}))
22 changes: 22 additions & 0 deletions examples/example-let.jxa
@@ -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})))
4 changes: 2 additions & 2 deletions examples/fibonacci.jxa
@@ -1,4 +1,4 @@
(ns jxat-fibonacci
(ns fibonacci
(use (erlang :only (>/2 -/2 +/2))))

(defn+ fibo (n)
Expand All @@ -7,4 +7,4 @@
(1 1)
(_ (when (> n 0))
(+ (fibo (- n 1))
(fibo (- n 2))))))
(fibo (- n 2))))))
3 changes: 1 addition & 2 deletions examples/helloworld.jxa
@@ -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]))

20 changes: 0 additions & 20 deletions examples/let.jxa

This file was deleted.

2 changes: 1 addition & 1 deletion examples/sieve-of-eratosthenes.jxa
@@ -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)
Expand Down

0 comments on commit 967c90a

Please sign in to comment.