-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
109 lines (73 loc) · 3.55 KB
/
README
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
.ooooo.
d88' `8.
Y88.. .8'
`88888b.
.8' ``88b
`8. .88P
`boood8'
Document last modified: 2/2/2010
Eight 2010, a lisp by Sam Bleckley
Contact me!
Sam Bleckley
http://sambleckley.com/
Gnawing on bones
My tongue is sore from trying to get the marrow out
I refuse to ignore the meat any longer
I intend to sculpt Eight into a beautiful and emotional and
extraordinarily powerful programming language. I am not concerned with
speed of execution or ease of learning. Programmers want to be magic
ninjas. Eight lets programmers do magic ninja things.
-------------------------------------------------------------------------------
A Quick-Start Guide
I am still actively altering and developing Eight. If you seek a
finished, capable language, you will not find one here. However, if
you're looking to help build a language to be beautiful inside and
out, Eight may be for you.
Follow along with these examples at http://diiq.org/eight, or by
cloning the repository and using the python implementation:
$ python/8 test.8
I built Eight for metaprogramming. In my opinion, no other language
equals Eight in the power and simplicity of its fexprs. To understand
why, take a look at a function definition in Eight:
(def with ('sym val ... 'body)
((fn ,(list sym) *body) val))
(I'll assume you've got a working knowledge of lisp --- it doesn't
matter which one. Arc, scheme, common --- it's all the same to me.)
Questions to ask about this function:
What does this function do? Much like with in Arc or let in common
lisp, this function temporarily binds a value to a variable; it might
be used like this:
(with a (+ 2 3) (print a) (* a 2))
Which would print "5" and return 10. Afterwards, a will be unbound (or
return to the binding it had previously in this scope).
How does def work?
def takes three arguments: a symbol: with; a lambda list: ('sym val
... 'body); and a body of expressions: ((fn ,(list sym) *body) val).
What does the ... mean?
The elipsis works just like &rest in common list, or a . in Arc or
scheme: body will be bound to a list of all remaining arguments.
Why are arguments in the lambda list quoted?
In Eight, argument names in the lambda list can have a function
applied to them; this is clearer if I desugar the lambda list:
((' sym) val ... (' body))
' is a function. Before the arguments are evaluated, that function is
applied; ' prevents the evaluation of those arguments. It also does
more, but that's much is important to understand first: the argument
bound to sym will not be evaluated; the argument(s) to body will not
be evaluated. They will be passed to ', and the result will be bound.
,? *? What do they do?
, prevents an argument from being wrapped in a function, when the
lambda-list calls for it. fn quotes its first argument, but with has
*already* quoted that argument. Usually, , acts as a sort of opposite
to '.
* unpacks a list into arguments:
(list *(a b c))
is the same as:
(list a b c)
THe behavior of *, @, and , are still in flux. I am unhappy with the
false symmetry of , and ', and * currently hides an extra eval which
could be dangerous.
For a more in-depth look at what Eight is, take a look at
python/eight.py . It is a well-documented and reasonably organized
implementation.