-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring the examples up to date and fix stale code in the examples
- Loading branch information
1 parent
6a8ebb6
commit 8eba91d
Showing
8 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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])) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters