-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
244 lines (233 loc) · 12.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#444">
<meta name="msapplication-navbutton-color" content="#444">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#444">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="apple-touch-icon" href="favicon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Fira+Sans|Fira+Mono">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<!--
<script src="https://github.com/rkoeninger/ShenScript/releases/download/v0.14.0/shen-script.js"></script>
<script>(new Shen()).then($ => (window.$ = $, $.load('index.shen')));</script>
-->
<title>Shen Language</title>
</head>
<body>
<main>
<section>
<img id="logo" src="https://cdn.rawgit.com/Shen-Language/shen-sources/master/assets/shen_noname.svg">
<header id="logo-text">Shen</header>
</section>
<section>
<header>About</header>
<p>
Shen is a portable functional programming language by <a href="http://www.marktarver.com/">Mark Tarver</a>. It is the successor to the award-winning Qi language, with the added goal of being highly portable across platforms.
</p>
<p>
More information is available on the <a href="http://shenlanguage.org">official website</a>.
</p>
</section>
<section>
<header><a class="anchor" aria-hidden="true" id="features" href="#features">Features</a></header>
<header class="small">Pattern Matching</header>
<pre><code>(<span class="keyword">define</span> filter
_ [] -> []
<span class="variable">F</span> [<span class="variable">X</span> | <span class="variable">Xs</span>] -> [<span class="variable">X</span> | (filter <span class="variable">F</span> <span class="variable">Xs</span>)]<span class="large-spacer"> </span><span class="small-spacer">
</span><span class="keyword">where</span> (<span class="variable">F</span> <span class="variable">X</span>)
<span class="variable">F</span> [_ | <span class="variable">Xs</span>] -> (filter <span class="variable">F</span> <span class="variable">Xs</span>))
(<span class="keyword">define</span> element?
_ [] -> false
<span class="variable">X</span> [<span class="variable">X</span> | _] -> true
<span class="variable">X</span> [_ | <span class="variable">Y</span>] -> (element? <span class="variable">X</span> <span class="variable">Y</span>))</code></pre>
<header class="small">Backtracking</header>
<pre><code>(<span class="keyword">define</span> walk
_ [] <- (fail)
<span class="variable">F</span> [<span class="variable">X</span> | _] -> <span class="variable">X</span> <span class="keyword">where</span> (<span class="variable">F</span> <span class="variable">X</span>)
<span class="variable">F</span> [_ | <span class="variable">Y</span>] -> (walk <span class="variable">F</span> <span class="variable">Y</span>))</code></pre>
<header class="small">Lambda Calculus Consistency</header>
<pre><code>(<span class="keyword">define</span> y-combinator
<span class="variable">F</span> -> ((/. <span class="variable">X</span> (<span class="variable">X</span> <span class="variable">X</span>))
(/. <span class="variable">X</span> (<span class="variable">F</span> (/. <span class="variable">Y</span> ((<span class="variable">X</span> <span class="variable">X</span>) <span class="variable">Y</span>))))))</code></pre>
<header class="small">Lazy Evalution</header>
<pre><code>(<span class="keyword">let</span> <span class="variable">F</span> (freeze (output <span class="literal">"Hello!"</span>))
(thaw <span class="variable">F</span>))
> "Hello!"</code></pre>
<header class="small">Optional Type Checking</header>
<pre><code>(tc +)
(<span class="keyword">define</span> map
{(<span class="variable">A</span> --> <span class="variable">B</span>) --> (list <span class="variable">A</span>) --> (list <span class="variable">B</span>)}
_ [] -> []
<span class="variable">F</span> [<span class="variable">X</span> | <span class="variable">Xs</span>] -> [(<span class="variable">F</span> <span class="variable">X</span>) | (map <span class="variable">F</span> <span class="variable">Xs</span>)])
(map (+ <span class="literal">1</span>) [<span class="literal">"a"</span> <span class="literal">"b"</span> <span class="literal">"c"</span>])
> type error</code></pre>
<header class="small">Configurable Type Rules</header>
<pre><code>(<span class="keyword">datatype</span> maybe-type
_____________________
none : (maybe <span class="variable">A</span>);
<span class="variable">X</span> : <span class="variable">A</span>;
_____________________
(some <span class="variable">X</span>) : (maybe <span class="variable">A</span>);
<span class="variable">M</span> : (maybe <span class="variable">A</span>);
_____________________
(unwrap <span class="variable">M</span>) : <span class="variable">A</span>;)</code></pre>
<header class="small">Integrated Logic Engine</header>
<pre><code>(<span class="keyword">defprolog</span> member
<span class="variable">X</span> [<span class="variable">X</span> | _] <-- ;
<span class="variable">X</span> [_ | <span class="variable">Y</span>] <-- (member <span class="variable">X</span> <span class="variable">Y</span>);)
(prolog?
(member <span class="variable">X</span> [<span class="literal">1</span> <span class="literal">2</span> <span class="literal">3</span>])
(member <span class="variable">X</span> [<span class="literal">3</span> <span class="literal">4</span> <span class="literal">5</span>])
(return <span class="variable">X</span>))
> 3</code></pre>
<header class="small">Built-in Compiler-Compiler</header>
<pre><code>(<span class="keyword">define</span> bit?
<span class="variable">B</span> -> (element? <span class="variable">B</span> [<span class="literal">0</span> <span class="literal">1</span>]))
(<span class="keyword">defcc</span> <b>
<span class="variable">B</span> <b> := [<span class="variable">B</span> | <b>] <span class="keyword">where</span> (bit? <span class="variable">B</span>);
<span class="variable">B</span> := [<span class="variable">B</span>] <span class="keyword">where</span> (bit? <span class="variable">B</span>);)</code></pre>
<header class="small">Unique Macros</header>
<pre><code>(<span class="keyword">defmacro</span> infix-macro
[<span class="variable">X</span> + <span class="variable">Y</span>] -> [+ <span class="variable">X</span> <span class="variable">Y</span>]
[<span class="variable">X</span> * <span class="variable">Y</span>] -> [* <span class="variable">X</span> <span class="variable">Y</span>])</code></pre>
</section>
<!--
<section>
<header><a class="anchor" aria-hidden="true" id="demo" href="#demo">Demo</a></header>
<p>
An in-browser REPL is hosted <a href="http://gravicappa.github.io/shen-js/shen.html#/.doc/welcome.html">here</a> where you can try out Shen and take a brief tutorial.
</p>
</section>
-->
<section>
<header><a class="anchor" aria-hidden="true" id="downloads" href="#downloads">Downloads</a></header>
<p>
There are implementations of Shen for most platforms. Some have fallen out of date and could use support to reach Certified status and stay current.
</p>
<p>
An implementation is considered Certified if it passes <a href="https://github.com/Shen-Language/shen-sources/tree/master/tests">the test suite</a> included with the <a href="https://github.com/Shen-Language/shen-sources/tree/master/sources">kernel sources</a>.
</p>
<p>
To port Shen to a new platform, <a href="https://github.com/Shen-Language/shen-sources/blob/master/doc/porting.md">see the porting guide</a>. You can <a href="https://github.com/Shen-Language/shen-language.github.io">submit a pull request</a> to get it added here.
</p>
<div id="downloads-table">
<!--
<noscript>The implementations table cannot be load without Javascript. To see the download table, enable Javascript.</noscript>
-->
<table>
<tbody><tr>
<th>Platform</th>
<th>URL</th>
</tr>
<tr>
<th colspan="2">Active Ports</th>
</tr>
<tr>
<td>Common Lisp</td>
<td><a href="https://shenlanguage.org/download.html">Common Lisp</a> (by Mark Tarver)</td>
</tr>
<tr>
<td>Scheme</td>
<td><a href="https://github.com/tizoc/shen-scheme">tizoc/shen-scheme</a></td>
</tr>
<tr>
<th colspan="2">Inactive Ports</th>
</tr>
<tr>
<td>Common Lisp</td>
<td><a href="https://github.com/Shen-Language/shen-cl">Shen-Language/shen-cl</a></td>
</tr>
<tr>
<td>C</td>
<td><a href="https://github.com/otabat/shen-c">otabat/shen-c</a></td>
</tr>
<tr>
<td>CLR</td>
<td><a href="https://github.com/rkoeninger/ShenSharp">rkoeninger/ShenSharp</a></td>
</tr>
<tr>
<td>Emacs Lisp</td>
<td><a href="https://github.com/deech/shen-elisp">deech/shen-elisp</a></td>
</tr>
<tr>
<td>Erlang</td>
<td><a href="https://github.com/sborrazas/shen-erl">sborrazas/shen-erl</a></td>
</tr>
<tr>
<td>Go</td>
<td><a href="https://github.com/tiancaiamao/shen-go">tiancaiamao/shen-go</a></td>
</tr>
<tr>
<td>Haskell</td>
<td><a href="https://github.com/mthom/shentong">mthom/shentong</a></td>
</tr>
<tr>
<td>Java</td>
<td><a href="https://github.com/otabat/shen-jvm">otabat/shen-jvm</a></td>
</tr>
<tr>
<td>Ruby</td>
<td><a href="https://github.com/gregspurrier/shen-ruby">gregspurrier/shen-ruby</a></td>
</tr>
<tr>
<td>Truffle</td>
<td><a href="https://github.com/ragnard/shen-truffle">ragnard/shen-truffle</a></td>
</tr>
<tr>
<td>Wasp Lisp</td>
<td><a href="https://github.com/doublec/shen-wasp">doublec/shen-wasp</a></td>
</tr>
<tr>
<td>JavaScript</td>
<td><a href="https://github.com/rkoeninger/ShenScript">rkoeninger/ShenScript</a></td>
</tr>
<tr>
<td>JavaScript</td>
<td><a href="https://github.com/gravicappa/shen-js">gravicappa/shen-js</a></td>
</tr>
<tr>
<td>C++</td>
<td><a href="https://github.com/wehu/ShenCPP">wehu/ShenCPP</a></td>
</tr>
<tr>
<td>Clojure</td>
<td><a href="https://github.com/hraberg/shen.clj">hraberg/shen.clj</a></td>
</tr>
<tr>
<td>Java</td>
<td><a href="https://github.com/hraberg/Shen.java">hraberg/Shen.java</a></td>
</tr>
<tr>
<td>Python</td>
<td><a href="https://github.com/gravicappa/shen-py">gravicappa/shen-py</a></td>
</tr>
<tr>
<td>Python</td>
<td><a href="https://github.com/yminer/pyshen">yminer/pyshen</a></td>
</tr>
</tbody></table>
</div>
</section>
<section>
<header><a class="anchor" aria-hidden="true" id="contributing" href="#contributing">Contributing</a></header>
<p>
The Shen Open Source Kernel is authored in Shen itself and hosted <a href="https://github.com/Shen-Language/shen-sources">on GitHub</a>. Bug reports and suggested enhancements are welcome!
</p>
<!--
</section>
<section>
<header><a class="anchor" aria-hidden="true" id="community" href="#community">Community</a></header>
<p>
The following is a (non-exhaustive) list of developers who have contributed to the Shen Language Open Source Community. Thanks to everyone for contributing!
</p>
<div id="community-table"></div>
</section>
-->
</main>
</body>
</html>