Skip to content

Commit f53b559

Browse files
author
ken
committed
commit
0 parents  commit f53b559

File tree

124 files changed

+14899
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+14899
-0
lines changed

Diff for: LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 SpaceTimeProgrammingLanguage
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
###spacetimeprogramminglanguage.github.io
2+

Diff for: SpaceTime.graffle

10.9 KB
Binary file not shown.

Diff for: app.js

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
var httpServer = function(dir)
2+
{
3+
var http = require('http');
4+
var fs = require('fs');
5+
var path = require("path");
6+
var url = require('url');
7+
8+
var mimeTypes = {
9+
"html": "text/html",
10+
"jpeg": "image/jpeg",
11+
"jpg": "image/jpeg",
12+
"png": "image/png",
13+
"js": "text/javascript",
14+
"css": "text/css"
15+
};
16+
17+
return http.createServer(function(req, res)
18+
{
19+
var uri = url.parse(req.url)
20+
.pathname;
21+
var filename = path.join(dir, unescape(uri));
22+
var indexFilename = path.join(dir, unescape('index.html'));
23+
var stats;
24+
25+
console.log(filename);
26+
27+
try
28+
{
29+
stats = fs.lstatSync(filename); // throws if path doesn't exist
30+
}
31+
catch (e)
32+
{
33+
res.writeHead(404,
34+
{
35+
'Content-Type': 'text/plain'
36+
});
37+
res.write('404 Not Found\n');
38+
res.end();
39+
return;
40+
}
41+
42+
var fileStream;
43+
if (stats.isFile())
44+
{
45+
// path exists, is a file
46+
var mimeType = mimeTypes[path.extname(filename)
47+
.split(".")[1]];
48+
res.writeHead(200,
49+
{
50+
'Content-Type': mimeType
51+
});
52+
53+
fileStream =
54+
fs
55+
.createReadStream(filename)
56+
.pipe(res);
57+
}
58+
else if (stats.isDirectory())
59+
{
60+
// path exists, is a directory
61+
res.writeHead(200,
62+
{
63+
'Content-Type': "text/html"
64+
});
65+
fileStream =
66+
fs
67+
.createReadStream(indexFilename)
68+
.pipe(res);
69+
}
70+
else
71+
{
72+
// Symbolic link, other?
73+
// TODO: follow symlinks? security?
74+
res.writeHead(500,
75+
{
76+
'Content-Type': 'text/plain'
77+
});
78+
res.write('500 Internal server error\n');
79+
res.end();
80+
}
81+
82+
});
83+
};
84+
85+
86+
var HTTPserver =
87+
httpServer('./')
88+
.listen(18080, function()
89+
{
90+
console.log('HTTP listening 8080');
91+
});

Diff for: contents/entries/entry0/entry.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<style type="text/css"> body {display: none;}
3+
</style>
4+
<meta name="description" content="">
5+
<meta name="author" content="">
6+
<title>
7+
</title>
8+
<!--===== Don't Touch ===========-->
9+
<script type="text/javascript" src="/invoke/jquery-2.0.3.min.js"></script>
10+
<script type="text/javascript" src="/invoke/invoke.js"></script>
11+
<!--========================-->
12+
</head>
13+
<body>
14+
15+
</body>
16+
</html>
17+

Diff for: contents/entries/entry0/entry.md

+220
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
2+
3+
4+
#SpaceTime Programming Language
5+
6+
####*Inspired by LISP*
7+
####*Inverted data structure of LISP*
8+
9+
#### - Functional Language
10+
#### - Lazy Evaluation
11+
#### - Runs on JavaScript (browser & node.js)
12+
#### - Written in JavaScript
13+
14+
##Hello world
15+
---
16+
17+
```
18+
(
19+
"Hello world"
20+
(map (CONSOLE))
21+
)
22+
23+
```
24+
25+
##Foundation
26+
---
27+
###Pair
28+
29+
![](http://localhost:18080/contents/img/pairentity.png)
30+
This is the fundamental unit of *SpaceTime*.
31+
`Pair` has a pair of hands to point a pair of any objects.
32+
33+
---
34+
###Pair points a pair of objects
35+
36+
![](http://localhost:18080/contents/img/pairab.png)
37+
38+
Now, a `Pair` points objects: `a` and `b`.
39+
40+
---
41+
###Pair notation
42+
43+
![](http://localhost:18080/contents/img/pairabnotation.png)
44+
45+
When a `Pair` points objects: `a` and `b`, it's expressed as **{a b}** in `Pair notation`.
46+
47+
---
48+
###Pair can point itself
49+
50+
![](http://localhost:18080/contents/img/emptypairentity.png)
51+
52+
---
53+
###Empty Pair
54+
55+
![](http://localhost:18080/contents/img/emptypairnotation.png)
56+
57+
58+
59+
When a Pair points itself, since it's a form of [Self-reference](http://en.wikipedia.org/wiki/Self-reference), an [Infinite recursion](http://en.wikipedia.org/wiki/Infinite_loop#Infinite_recursion) occurs.
60+
Accordingly, the `Pair notaion` is { { {...} {...} } { {...} {...} } }, so we simply express `Empty Pair` as **{}**.
61+
62+
---
63+
###Push Pair
64+
65+
![](http://localhost:18080/contents/img/push5.png)
66+
67+
A `Pair` can point another `Pair` so that we can joint `Pair`s.
68+
69+
Now let a `pair` point another `Pair` and `5` by each hands.
70+
Let's call this special action `Push`.
71+
72+
In this case, we `push` 5 to an `Empty Pair`.
73+
74+
The `Pair notation` is **{ {} 5 }**.
75+
76+
77+
---
78+
###Push another Pair
79+
80+
![](http://localhost:18080/contents/img/push2.png)
81+
82+
In the same manner, we can `push` another `Pair`.
83+
84+
We `push` `2` to the previous sequence.
85+
86+
The `Pair notation` is **{ { {} 5 } 2 }**.
87+
88+
---
89+
###Push to any sequence
90+
91+
![](http://localhost:18080/contents/img/push7.png)
92+
93+
---
94+
###Sequence
95+
96+
![](http://localhost:18080/contents/img/sequence527.png)
97+
98+
Here, *SpaceTime* explicitly defines a term `Sequence` for this form.
99+
Please note this is the same term and meaning of [Sequence](http://en.wikipedia.org/wiki/Sequence) in Mathematics.
100+
101+
At the same time, instead of `Pair notation` : { { { {} 5 } 2 } 7 }, it can be simply expressed as **( 5 2 7 )**.
102+
103+
---
104+
###Push function
105+
106+
![](http://localhost:18080/contents/img/function5.png)
107+
108+
A `Pair` can point `function`.
109+
110+
Accordingly, we can `push` `function` to any `Sequence`.
111+
112+
In this case, we `push` a `function` to **(5)**.
113+
114+
---
115+
###A case of Push function
116+
117+
![](http://localhost:18080/contents/img/plus52.png)
118+
119+
When we push a `function` : `plus2` to **(5)**, the result is **(7)**.
120+
121+
---
122+
###Function is Sequence
123+
124+
![](http://localhost:18080/contents/img/functionissequence.png)
125+
126+
The `function` : `plus2` is fundamentally some `Sequence`.
127+
128+
`plus2` consists of a `Sequence` : **( plus (2) )**.
129+
130+
---
131+
###Evaluation of a Sequence containing a function
132+
133+
![](http://localhost:18080/contents/img/fullsequence527.png)
134+
135+
**( 5 (plus (2)) )** is equivalent to **(7)**.
136+
137+
---
138+
### Everything is function and Sequence
139+
140+
![](http://localhost:18080/contents/img/think53.png)
141+
142+
![](http://localhost:18080/contents/img/actually53is.png)
143+
![](http://localhost:18080/contents/img/so3isfunction.png)
144+
![](http://localhost:18080/contents/img/so3isfunction2.png)
145+
146+
Everything is `function` in *SpaceTime*.
147+
148+
In this case, `3` is a `function` that maps a source : **(5)** to a target : **( 5 3 )**.
149+
150+
Consequently, since `function` is `Sequence` in *SpaceTime*, everything is `Sequence` in *SpaceTime*.
151+
152+
Therefore, `3` is a `function` and at the same time, is a `Sequence`.
153+
154+
However, `3` is `3`. There is no other way to express than just `3` in *SpaceTime*.
155+
156+
157+
158+
---
159+
###Every Sequence is a result of function to `Empty Pair`
160+
161+
![](http://localhost:18080/contents/img/so5isalsofunction.png)
162+
163+
---
164+
###Function composition
165+
166+
![](http://localhost:18080/contents/img/functioncomposition.png)
167+
168+
[Function composition](http://en.wikipedia.org/wiki/Function_composition) is naturally expressed in a form : **( source function fucnction )** in *SpaceTime*
169+
170+
---
171+
###1 +2 +3 = 6
172+
173+
![](http://localhost:18080/contents/img/plus123.png)
174+
175+
*SpaceTime* has a short-cut notation : **+** corresponding to `plus` function.
176+
177+
---
178+
###1 +(2 +3) = 6
179+
180+
![](http://localhost:18080/contents/img/plust1and23.png)
181+
182+
---
183+
###Indefinite sequence
184+
185+
![](http://localhost:18080/contents/img/naturaltake10.png)
186+
187+
*SpaceTime* employes an [evaluation strategy](http://en.wikipedia.org/wiki/Evaluation_strategy) : [lazy evaluation, or call-by-need](http://en.wikipedia.org/wiki/Lazy_evaluation).
188+
189+
Accordingly, *SpaceTime* can deal with Indefinite sequence such as [Natural number](http://en.wikipedia.org/wiki/Natural_number).
190+
191+
---
192+
###I/O (Input and Output)
193+
194+
![](http://localhost:18080/contents/img/console5.png)
195+
196+
[I/O](http://en.wikipedia.org/wiki/Input/output) does not affect the evaluation context of *SpaceTime* directly, so that it can preserve [Functional programming](http://en.wikipedia.org/wiki/Functional_programming) paradigm.
197+
198+
*SpaceTime* employes [FRP](http://en.wikipedia.org/wiki/Functional_reactive_programming) or `SpaceTime Programming paradigm`.
199+
200+
---
201+
###Hello world
202+
203+
![](http://localhost:18080/contents/img/helloworld.png)
204+
205+
---
206+
###Hello world twice
207+
208+
![](http://localhost:18080/contents/img/helloworld2.png)
209+
210+
---
211+
###Map any Sequence to the console
212+
213+
![](http://localhost:18080/contents/img/fibconsole.png)
214+
215+
---
216+
217+
218+
219+
220+
\[----entry1-----](http://localhost:18080/contents/entries/entry1/entry.html)

Diff for: contents/entries/entry1/entry.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<style type="text/css"> body {display: none;}
3+
</style>
4+
<meta name="description" content="">
5+
<meta name="author" content="">
6+
<title>
7+
</title>
8+
<!--===== Don't Touch ===========-->
9+
<script type="text/javascript" src="/invoke/jquery-2.0.3.min.js"></script>
10+
<script type="text/javascript" src="/invoke/invoke.js"></script>
11+
<!--========================-->
12+
</head>
13+
<body>
14+
15+
</body>
16+
</html>
17+

Diff for: contents/entries/entry1/entry.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## entry1 title
2+
3+
hhh
4+
5+
jjjjj
6+
7+
jjjjj
8+
9+
##[entry2 title](/contents/entries/entry2/entry.html) に進む
10+
11+
##▲[INDEX](/contents/entries/agenda/entry.html)

Diff for: contents/img/actually53is.png

8.19 KB
Loading

Diff for: contents/img/console5.png

30.2 KB
Loading

Diff for: contents/img/emptypairentity.png

13.1 KB
Loading

Diff for: contents/img/emptypairnotation.png

20.5 KB
Loading

Diff for: contents/img/fibconsole.png

73.6 KB
Loading

Diff for: contents/img/fullsequence527.png

14.4 KB
Loading

Diff for: contents/img/function5.png

77.5 KB
Loading

Diff for: contents/img/functioncomposition.png

82.2 KB
Loading

Diff for: contents/img/functionissequence.png

23.6 KB
Loading

Diff for: contents/img/helloworld.png

56.9 KB
Loading

Diff for: contents/img/helloworld2.png

80.9 KB
Loading

Diff for: contents/img/long123.png

33.9 KB
Loading

Diff for: contents/img/naturaltake10.png

33.3 KB
Loading

Diff for: contents/img/pairab.png

13.2 KB
Loading

Diff for: contents/img/pairabnotation.png

13.2 KB
Loading

Diff for: contents/img/pairentity.png

11.2 KB
Loading

Diff for: contents/img/plus123.png

62.5 KB
Loading

Diff for: contents/img/plus52.png

36.5 KB
Loading

Diff for: contents/img/plust1and23.png

37.9 KB
Loading

Diff for: contents/img/push2.png

25.5 KB
Loading

Diff for: contents/img/push5.png

21.6 KB
Loading

Diff for: contents/img/push7.png

22.3 KB
Loading

Diff for: contents/img/sequence527.png

18.1 KB
Loading

Diff for: contents/img/so3isfunction.png

28.4 KB
Loading

Diff for: contents/img/so3isfunction2.png

32.4 KB
Loading

Diff for: contents/img/so5isalsofunction.png

57.4 KB
Loading

Diff for: contents/img/think53.png

7.74 KB
Loading

0 commit comments

Comments
 (0)