Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 168 lines (113 sloc) 4.732 kb
64e93a0 @hraberg moved down version
authored
1 # 神.clj | Shen for Clojure
2
5b56b11 @hraberg README
authored
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
16 ## This Clojure Port
5b56b11 @hraberg README
authored
17
e657618 @hraberg 97% passing
authored
18 Is a work in progress. The example on the Shen homepage works, and the test suite is currently running: 97% passed.
4894c0a @hraberg How to run
authored
19
6470749 @hraberg Cleaning up some code, updating docs
authored
20 Uses [Leiningen](https://github.com/technomancy/leiningen) to build.
21
c355ab8 @hraberg 'when it's done'
authored
22 **0.1.0 will be released once the test suite passes.**
23
6470749 @hraberg Cleaning up some code, updating docs
authored
24 ### To run the REPL:
4894c0a @hraberg How to run
authored
25
68c0d3a @hraberg Clarifying that lein repl doesn't manage to pick up the generated file
authored
26 lein trampoline run
27
28 # If shen.clj already exists, for readline support:
0644c7d @hraberg Detecting REPL and launches Shen
authored
29 lein repl
a3e227d @hraberg Link, license
authored
30
6470749 @hraberg Cleaning up some code, updating docs
authored
31 Shen 2010, copyright (C) 2010 Mark Tarver
8703515 @hraberg Upgraded to Shen 3.1
authored
32 www.lambdassociates.org, version 3.1
6470749 @hraberg Cleaning up some code, updating docs
authored
33 running under Clojure, implementation: Clojure 1.4.0-beta1 [jvm 1.8.0-ea]
34 port 0.1.0-SNAPSHOT ported by Håkan Råberg
35
36
37 (0-) (define super
38 [Value Succ End] Action Combine Zero ->
39 (if (End Value)
40 Zero
41 (Combine (Action Value)
42 (super [(Succ Value) Succ End]
43 Action Combine Zero))))
44 #'shen/super
45
46 (1-) (define for
47 Stream Action -> (super Stream Action do 0))
48 #'shen/for
49
50 (2-) (define filter
51 Stream Condition ->
52 (super Stream
53 (/. Val (if (Condition Val) [Val] []))
54 append
55 []))
56 #'shen/filter
57
58 (3-) (for [0 (+ 1) (= 10)] print)
59 01234567890
60
61 (4-) (filter [0 (+ 1) (= 100)]
62 (/. X (integer? (/ X 3))))
63 [0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60... etc]
64
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored
65
da13eb2 @hraberg Various fixes - narrowing in on defmacro
authored
66 ### Known Issues
67
6deec62 @hraberg Note that we could get the cleaned up docstrings from shen-mode.el
authored
68 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
69
70 [... loads of output ...]
e657618 @hraberg 97% passing
authored
71 passed ... 142
72 failed ...4
73 pass rate ...97.26027397260275%
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored
74
75 ok
76 0
77
5482eb0 @hraberg May or may not have helped
authored
78 run time: 18.337 secs
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored
79 loaded
80
f5ad571 @hraberg build script
authored
81 The suite can be run via:
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to init...
authored
82
83 yes | lein trampoline run -m shen.test
d724402 @hraberg Test suite is now running (79% pass in 5 mins; 10x slower than CLisp)
authored
84
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored
85
11096af @hraberg Progress update, info on the 4 failures
authored
86 * 4 failing tests:
87 * 3 `tc+` tests fails with `type-error in rule`.
88 * `einstein.shen` returns `false` instead of `german`.
89 * Performance is not a goal for 0.1.0, but some tuning has been made to ease development.
e7413d9 @hraberg plural
authored
90 * Next step: `benchmarks.shen` running without errors.
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored
91
92 ### 神 and define macros
93
94 Instead of using Shen's reader, you can embed Shen directly in Clojure using these macros.
95 For simplicity, all Shen code lives and is evaluated in the `shen` namespace for now (this will likely change).
96
c8d1023 @hraberg highlighting in markdown?
authored
97 ```clojure
5c2fc9f @hraberg No need for extra indent
authored
98 ; shen.test/shenlanguage.org
99 (define for
100 Stream Action -> (super Stream Action do 0))
101
102 ; shen.test/printer
103 (神
104 (cons 1 2))
105 "[1 | 2]"
106
107 (神
108 (@p 1 2))
109 "(@p 1 2)"
110
111 ; shen.test/partials
112 (神
113 ((λ X Y (+ X Y)) 2))
114 fn?
c8d1023 @hraberg highlighting in markdown?
authored
115 ```
7f6ec59 @hraberg Updated with info about macros and test suite state of play
authored
116
117 As can be seen `λ` stands in for `/.` in Shen to avoid Clojure reader macros.
118 `@p`, `@s` and `@v` are converted from Clojure deref to their Shen symbols.
119
120 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
121
6470749 @hraberg Cleaning up some code, updating docs
authored
122
c0a5bc4 @hraberg Over optimistic % at the top
authored
123 ### Leiningen
124
125 `[shen.clj "0.1.0-SNAPSHOT"]` - not yet in public repo.
126
f5a8af3 @hraberg Simplified build + marginalia
authored
127 The script `build` is used for full, repeatable builds.
f5ad571 @hraberg build script
authored
128
c0a5bc4 @hraberg Over optimistic % at the top
authored
129
5a8d03f @hraberg Marginalia link
authored
130 ### Marginalia
131
132 http://ghettojedi.org/shen.clj/
133
134
509608e @hraberg Disregard for how markdown actually works
authored
135 ## Roadmap
136
b1f3248 @hraberg M-x flyspell-mode
authored
137 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
138
139 * Test suite passing. (days to week/s)
5a8d03f @hraberg Marginalia link
authored
140 * [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
141 * Shen / Clojure interop:
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to init...
authored
142 * Shen packages as namespaces?
143 * Hiding KLambda and its names a bit.
144 * Bringing smaller parts of Shen goodness back into Clojure: predicate dispatch, pattern matching, prolog. Maybe even the type system.
145 * Ensuring Shen can call Clojure/Java properly.
6deec62 @hraberg Note that we could get the cleaned up docstrings from shen-mode.el
authored
146 * Docstrings for Shen, maybe from [shen-mode.el](https://github.com/eschulte/shen-mode/blob/master/shen-mode.el).
509608e @hraberg Disregard for how markdown actually works
authored
147 * Future / Questions
d0f8e78 @hraberg Cleaning out todo list
authored
148 * More TCO than implicit recur for KLambda?
1daf562 @hraberg Note about Shen lazyiness
authored
149 * Making Shen as lazy as its host?
47ae409 @hraberg How to run the test suite from leiningen + shen.test/-main needs to init...
authored
150 * Revisit using STM (refs/atoms) instead of intern for set/value.
151 * Existing Shen libraries and portability?
152 * ClojureScript.
d0f8e78 @hraberg Cleaning out todo list
authored
153 * overrides.clj - rewriting parts of Shen into Clojure if interop or performance requires it.
05ac629 @hraberg not a vision, more of a gesture
authored
154 * This project is part of my long term wish for a semi-automated global socialistic utopia, which requires some further work.
509608e @hraberg Disregard for how markdown actually works
authored
155
6470749 @hraberg Cleaning up some code, updating docs
authored
156
157 #### The other port, Shen to Clojure
8da7859 @hraberg Link to Dominik's port
authored
158
159 http://code.google.com/p/shen-to-clojure/
160
a3e227d @hraberg Link, license
authored
161 ## License
162
163 http://shenlanguage.org/license.html
384f96f @hraberg attribution
authored
164
23c9ae5 @hraberg Consistency
authored
165 Shen, Copyright © 2010-2012 Mark Tarver
b6cb6a8 @hraberg attribution
authored
166
232d28b @hraberg What is this project really called?
authored
167 shen.clj, Copyright © 2012 Håkan Råberg
Something went wrong with that request. Please try again.