Skip to content
Newer
Older
100644 189 lines (121 sloc) 4.88 KB
64e93a0 @hraberg moved down version
authored Mar 4, 2012
1 # 神.clj | Shen for Clojure
2
5b56b11 @hraberg README
authored Feb 22, 2012
3 http://shenlanguage.org/
4
5 Shen is a portable functional programming language by [Mark Tarver](http://www.lambdassociates.org/) that offers
6
7 * pattern matching,
8 * λ calculus consistency,
9 * macros,
10 * optional lazy evaluation,
11 * static type checking,
12 * an integrated fully functional Prolog,
13 * and an inbuilt compiler-compiler.
14
15
4ab268a @hraberg This, not the, port
authored Feb 25, 2012
16 ## This Clojure Port
5b56b11 @hraberg README
authored Feb 22, 2012
17
58bdce8 @hraberg Not worth it man
authored Mar 16, 2012
18 `[shen.clj "0.1.2"]` | [Marginalia](http://ghettojedi.org/shen.clj/)
092ee7c @hraberg Packaging refactorings
authored Mar 12, 2012
19
b89c4f7 @hraberg Minor restructuring
authored Mar 16, 2012
20 Is a work in progress. Passes the Shen 3.1 test suite.
4894c0a @hraberg How to run
authored Feb 22, 2012
21
28d28da @hraberg While seemingly on topic, confusing
authored Mar 16, 2012
22 Uses [Leiningen](https://github.com/technomancy/leiningen) to build.
7def9b6 @hraberg Link
authored Mar 16, 2012
23 The script [`build`](https://github.com/hraberg/shen.clj/blob/master/build) is used for full, repeatable builds.
28d28da @hraberg While seemingly on topic, confusing
authored Mar 16, 2012
24
c355ab8 @hraberg 'when it's done'
authored Mar 4, 2012
25
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
26 ### To run the REPL:
4894c0a @hraberg How to run
authored Feb 22, 2012
27
a3c3871 @hraberg No colons, please
authored Mar 16, 2012
28 #### Standalone release
dd243a4 @hraberg Direct link/instruction to standalone jar
authored Mar 16, 2012
29
15169fd @hraberg Direct link/instruction to standalone jar
authored Mar 16, 2012
30 `java -jar `[`shen.clj-0.1.2-standalone.jar`](https://github.com/downloads/hraberg/shen.clj/shen.clj-0.1.2-standalone.jar)
dd243a4 @hraberg Direct link/instruction to standalone jar
authored Mar 16, 2012
31
32
33 #### Leiningen
c33d0d7 @hraberg Direct link/instruction to standalone jar
authored Mar 16, 2012
34
68c0d3a @hraberg Clarifying that lein repl doesn't manage to pick up the generated file
authored Feb 23, 2012
35 lein trampoline run
36
37 # If shen.clj already exists, for readline support:
0644c7d @hraberg Detecting REPL and launches Shen
authored Feb 23, 2012
38 lein repl
a3e227d @hraberg Link, license
authored Feb 22, 2012
39
092ee7c @hraberg Packaging refactorings
authored Mar 12, 2012
40 # java:
8b1248a @hraberg Leiningen-less install
authored Mar 16, 2012
41 java -cp lib/clojure-1.4.0-beta5.jar:shen.clj-0.1.2.jar shen
42
43
44 #### Plain
092ee7c @hraberg Packaging refactorings
authored Mar 12, 2012
45
8b1248a @hraberg Leiningen-less install
authored Mar 16, 2012
46 ./install
092ee7c @hraberg Packaging refactorings
authored Mar 12, 2012
47
8865ac3 @hraberg How to build without Leiningen
authored Mar 16, 2012
48 ---
49
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
50 Shen 2010, copyright (C) 2010 Mark Tarver
8703515 @hraberg Upgraded to Shen 3.1
authored Feb 28, 2012
51 www.lambdassociates.org, version 3.1
8b1248a @hraberg Leiningen-less install
authored Mar 16, 2012
52 running under Clojure, implementation: Clojure 1.4.0-beta5 [jvm 1.8.0-ea]
283c86c @hraberg 0.1.2
authored Mar 15, 2012
53 port 0.1.2 ported by Håkan Råberg
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
54
55
56 (0-) (define super
57 [Value Succ End] Action Combine Zero ->
58 (if (End Value)
59 Zero
60 (Combine (Action Value)
61 (super [(Succ Value) Succ End]
62 Action Combine Zero))))
cf856d5 @hraberg Reflected as symbols, not vars are returned
authored Mar 11, 2012
63 super
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
64
65 (1-) (define for
66 Stream Action -> (super Stream Action do 0))
cf856d5 @hraberg Reflected as symbols, not vars are returned
authored Mar 11, 2012
67 for
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
68
69 (2-) (define filter
70 Stream Condition ->
71 (super Stream
72 (/. Val (if (Condition Val) [Val] []))
73 append
74 []))
cf856d5 @hraberg Reflected as symbols, not vars are returned
authored Mar 11, 2012
75 filter
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
76
77 (3-) (for [0 (+ 1) (= 10)] print)
78 01234567890
79
80 (4-) (filter [0 (+ 1) (= 100)]
81 (/. X (integer? (/ X 3))))
82 [0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60... etc]
83
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored Mar 4, 2012
84
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
85 ### The Shen Test Suite
da13eb2 @hraberg Various fixes - narrowing in on defmacro
authored Mar 3, 2012
86
6deec62 @hraberg Note that we could get the cleaned up docstrings from shen-mode.el
authored Mar 4, 2012
87 The Shen test suite is now running, slowly but surely:
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored Mar 4, 2012
88
89 [... loads of output ...]
b942f4e @hraberg 100%
authored Mar 12, 2012
90 passed ... 146
91 failed ...0
92 pass rate ...100%
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored Mar 4, 2012
93
94 ok
95 0
96
b942f4e @hraberg 100%
authored Mar 12, 2012
97 run time: 19.022 secs
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored Mar 4, 2012
98 loaded
99
f5ad571 @hraberg build script
authored Mar 4, 2012
100 The suite can be run via:
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to i…
authored Mar 4, 2012
101
102 yes | lein trampoline run -m shen.test
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored Mar 4, 2012
103
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
104
105 The benchmarks can be run via:
106
107 JAVA_OPTS="-Xss4m" lein run -m shen.benchmarks
108
109
283c86c @hraberg 0.1.2
authored Mar 15, 2012
110 * Performance is not a goal for 0.1.x, but some tuning has been made to ease development.
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored Mar 4, 2012
111
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
112
113 ### 神, define, prolog? and defprolog macros
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored Mar 4, 2012
114
115 Instead of using Shen's reader, you can embed Shen directly in Clojure using these macros.
116 For simplicity, all Shen code lives and is evaluated in the `shen` namespace for now (this will likely change).
117
c8d1023 @hraberg highlighting in markdown?
authored Mar 4, 2012
118 ```clojure
5c2fc9f @hraberg No need for extra indent
authored Mar 4, 2012
119 ; shen.test/shenlanguage.org
120 (define for
121 Stream Action -> (super Stream Action do 0))
122
123 ; shen.test/printer
124 (
125 (cons 1 2))
126 "[1 | 2]"
127
128 (
129 (@p 1 2))
130 "(@p 1 2)"
131
132 ; shen.test/partials
133 (
134 ((λ X Y (+ X Y)) 2))
135 fn?
c8d1023 @hraberg highlighting in markdown?
authored Mar 4, 2012
136 ```
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored Mar 4, 2012
137
138 As can be seen `λ` stands in for `/.` in Shen to avoid Clojure reader macros.
139 `@p`, `@s` and `@v` are converted from Clojure deref to their Shen symbols.
56bde31 @hraberg Clarity
authored Mar 13, 2012
140 Characters, like `\;`, will also be converted to symbols.
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored Mar 4, 2012
141
c3392cc @hraberg Some notes about interop
authored Mar 17, 2012
142 Note that `[]` in Shen are lists, and not Clojure vectors. A Clojure vector with a count of 2 is used to represent a cons pair internally.
143
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored Mar 4, 2012
144 See [`shen.test`](https://github.com/hraberg/shen.clj/blob/master/test/shen/test.clj) for more examples.
da13eb2 @hraberg Various fixes - narrowing in on defmacro
authored Mar 3, 2012
145
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
146
c3392cc @hraberg Some notes about interop
authored Mar 17, 2012
147 #### Shen calling Clojure
148
149 Shen code can (but this is not very tested) access `clojure.core`, which is required as `core`:
150
151 (
152 (core/with-out-str
153 (for [0 (+ 1) (= 10)] print)))
154 "\"0123456789\""
155
156 More advanced mixing and requiring of Clojure packages isn't supported yet.
157
158
509608e @hraberg Disregard for how markdown actually works
authored Feb 26, 2012
159 ## Roadmap
160
b1f3248 @hraberg M-x flyspell-mode
authored Feb 28, 2012
161 This port, while aiming to conform closely (and hopefully fully) to the [Shen specification](http://shenlanguage.org/Documentation/shendoc.htm), has its primary goal to enable Shen's power in real world Clojure code.
509608e @hraberg Disregard for how markdown actually works
authored Feb 26, 2012
162
163 * Shen / Clojure interop:
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to i…
authored Mar 4, 2012
164 * Shen packages as namespaces?
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
165 * Hiding Shen internal names.
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to i…
authored Mar 4, 2012
166 * Bringing smaller parts of Shen goodness back into Clojure: predicate dispatch, pattern matching, prolog. Maybe even the type system.
167 * Ensuring Shen can call Clojure/Java properly.
509608e @hraberg Disregard for how markdown actually works
authored Feb 26, 2012
168 * Future / Questions
d0f8e78 @hraberg Cleaning out todo list
authored Mar 11, 2012
169 * More TCO than implicit recur for KLambda?
1daf562 @hraberg Note about Shen lazyiness
authored Mar 6, 2012
170 * Making Shen as lazy as its host?
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
171 * Revisit using STM (refs/atoms) instead of intern for set/value?
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to i…
authored Mar 4, 2012
172 * Existing Shen libraries and portability?
173 * ClojureScript.
ec6835a @hraberg Preparing 0.1.0
authored Mar 12, 2012
174 * overwrite.clj - rewriting more parts of Shen into Clojure if interop or performance requires it.
175 * [Shen in 15 minutes](http://www.shenlanguage.org/learn-shen/tutorials/shen_in_15mins.html#shen-in-15mins) as smoke test for the REPL
509608e @hraberg Disregard for how markdown actually works
authored Feb 26, 2012
176
6470749 @hraberg Cleaning up some code, updating docs
authored Feb 26, 2012
177
178 #### The other port, Shen to Clojure
8da7859 @hraberg Link to Dominik's port
authored Feb 25, 2012
179
180 http://code.google.com/p/shen-to-clojure/
181
a3e227d @hraberg Link, license
authored Feb 22, 2012
182 ## License
183
184 http://shenlanguage.org/license.html
384f96f @hraberg attribution
authored Feb 22, 2012
185
23c9ae5 @hraberg Consistency
authored Feb 22, 2012
186 Shen, Copyright © 2010-2012 Mark Tarver
b6cb6a8 @hraberg attribution
authored Feb 22, 2012
187
232d28b @hraberg What is this project really called?
authored Mar 4, 2012
188 shen.clj, Copyright © 2012 Håkan Råberg
Something went wrong with that request. Please try again.