on master help sign in
Merge remote-tracking branch 'origin/master' into cleanorg
commit74b4333f21032aad85c2468194a1849511953edb authorproduction server <urbit@urbit.org> dateTue 31 May 2016, 14:45 (10 years ago) parentb561086583eb96
5 files changed+285−6
docs/hoon/exercises/fizzbuzz.md+1−1 docs/nock/implementations/groovy.md+153 docs/nock/implementations/hoon.md+1−1 docs/user/install.md+119 readme.md+11−4
docs/hoon/exercises/fizzbuzz.md+1−1
@@ -23,7 +23,7 @@ comments: true
2323 "Fizz"
2424 ?: =(0 (mod count 3))
2525 "Buzz"
26− (text !>(count))
26+ (pave !>(count))
2727 $(count (add 1 count))
2828 ```
2929
docs/nock/implementations/groovy.mdnew file+153
@@ -0,0 +1,153 @@
1+---
2+navhome: /docs
3+title: Groovy
4+sort: 7
5+next: true
6+---
7+
8+# Groovy
9+
10+From [Kohányi Róbert](https://github.com/kohanyirobert/gnock/blob/master/gnock.groovy):
11+
12+```
13+def i(def a) {
14+ a.class in [
15+ byte, Byte,
16+ char, Character,
17+ short, Short,
18+ int, Integer,
19+ long, Long,
20+ BigInteger
21+ ] && a >= 0
22+}
23+
24+def n(def a) {
25+ if (a in List) {
26+ if (a.size() == 1) {
27+ n(a[0])
28+ } else if (a.size() == 2) {
29+ [n(a[0]), n(a[1])]
30+ } else if (a.size() > 2) {
31+ [n(a[0]), n(a.tail())]
32+ } else {
33+ throw new IllegalStateException()
34+ }
35+ } else if (i(a)) {
36+ (BigInteger) a
37+ } else {
38+ throw new IllegalStateException()
39+ }
40+}
41+
42+def wut(def a) {
43+ i(a) ? 1 : 0
44+}
45+
46+def lus(def a) {
47+ if (wut(a) == 0) {
48+ throw new IllegalStateException()
49+ }
50+ 1 + a
51+}
52+
53+def tis(def a) {
54+ if (wut(a) == 1) {
55+ throw new IllegalStateException()
56+ }
57+ a[0] == a[1] ? 0 : 1
58+}
59+
60+def fas(def a) {
61+ if (wut(a) == 1) {
62+ throw new IllegalStateException()
63+ }
64+ def h = a[0]
65+ if (!i(h)) {
66+ throw new IllegalStateException()
67+ }
68+ def t = a[1]
69+ if (h == 0) {
70+ throw new IllegalStateException()
71+ } else if (h == 1) {
72+ t
73+ } else {
74+ if (i(t)) {
75+ throw new IllegalStateException()
76+ }
77+ if (h == 2) {
78+ t[0]
79+ } else if (h == 3) {
80+ t[1]
81+ } else {
82+ def x = h.intdiv(2)
83+ if (h.mod(2) == 0) {
84+ fas([2, fas([x, t])])
85+ } else {
86+ fas([3, fas([x, t])])
87+ }
88+ }
89+ }
90+}
91+
92+def tar(def a) {
93+ if (wut(a) == 1) {
94+ throw new IllegalStateException()
95+ }
96+ def s = a[0]
97+ def f = a[1]
98+ if (wut(f) == 1) {
99+ throw new IllegalStateException()
100+ }
101+ def o = f[0]
102+ def v = f[1]
103+ if (wut(o) == 0) {
104+ [tar([s, o]), tar([s, v])]
105+ } else {
106+ if (o == 0) {
107+ fas([v, s])
108+ } else if (o == 1) {
109+ v
110+ } else if (o == 3) {
111+ wut(tar([s, v]))
112+ } else if (o == 4) {
113+ lus(tar([s, v]))
114+ } else if (o == 5) {
115+ tis(tar([s, v]))
116+ } else {
117+ if (wut(v) == 1) {
118+ throw new IllegalStateException()
119+ }
120+ def x = v[0]
121+ def y = v[1]
122+ if (o == 2) {
123+ tar([tar([s, x]), tar([s, y])])
124+ } else if (o == 7) {
125+ tar(n([s, 2, x, 1, y]))
126+ } else if (o == 8) {
127+ tar(n([s, 7, [[7, [0, 1], x], 0, 1], y]))
128+ } else if (o == 9) {
129+ tar(n([s, 7, y, 2, [0, 1], 0, x]))
130+ } else if (o == 10) {
131+ if (wut(x) == 1) {
132+ tar([s, y])
133+ } else {
134+ def r = x[0]
135+ def t = x[1]
136+ tar(n([s, 8, t, 7, [0, 3], y]))
137+ }
138+ } else {
139+ if (wut(y) == 1) {
140+ throw new IllegalStateException()
141+ }
142+ def p = y[0]
143+ def q = y[1]
144+ if (o == 6) {
145+ tar(n([s, 2, [0, 1], 2, [1, p, q], [1, 0], 2, [1, 2, 3], [1, 0], 4, 4, x]))
146+ } else {
147+ throw new IllegalStateException()
148+ }
149+ }
150+ }
151+ }
152+}
153+```
docs/nock/implementations/hoon.md+1−1
@@ -1,7 +1,7 @@
11---
22navhome: /docs
33title: Hoon
4−sort: 7
4+sort: 8
55---
66
77# Hoon
docs/user/install.mdnew file+119
@@ -0,0 +1,119 @@
1+---
2+next: true
3+sort: 2
4+title: Install
5+---
6+
7+# Installation guide
8+
9+Urbit can be installed on most Unix systems. There is no Windows
10+port. Windows is a wonderful OS, we just haven't gotten to it yet.
11+Use a VM.
12+
13+## Configure the OS
14+
15+Urbit wants to map 2GB of memory when it boots up. We won't
16+necessarily use all this memory, we just want to see it. On a
17+normal modern PC or Mac, this is not an issue. On some small
18+cloud virtual machines (Amazon or Digital Ocean), the default
19+memory configuration is smaller than this, and you need to
20+manually configure a swapfile.
21+
22+To add swap to a DO droplet:
23+
24+https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
25+
26+To add swap on an Amazon instance:
27+
28+http://stackoverflow.com/questions/17173972/how-do-you-add-swap-to-an-ec2-instance
29+
30+To add swap on a BSD instance:
31+
32+ https://www.freebsd.org/doc/handbook/adding-swap-space.htm
33+
34+Don't spend a lot of time tweaking these settings; the simplest
35+thing is fine.
36+
37+## Install as a package
38+
39+### OS X - Homebrew
40+
41+ brew install --HEAD homebrew/head-only/urbit
42+
43+### Ubuntu or Debian
44+
45+Third-party packages are available, at:
46+
47+ https://github.com/yebyen/urbit-deb
48+
49+Urbit is only supported on Jessie onward (but outbound HTTPS
50+requests only work on Stretch; I wish we knew why; help us!)
51+
52+## Hand-build from source
53+
54+First, install all external dependencies. Then, make.
55+
56+### Dependencies
57+
58+urbit depends on:
59+
60+ gcc (or clang)
61+ gmp
62+ libsigsegv
63+ openssl
64+ automake
65+ autoconf
66+ ragel
67+ cmake
68+ re2c
69+ libtool
70+ libssl-dev (Linux only)
71+ ncurses (Linux only)
72+
73+#### Ubuntu or Debian
74+
75+ sudo apt-get install libgmp3-dev libsigsegv-dev openssl libssl-dev libncurses5-dev git make exuberant-ctags automake autoconf libtool g++ ragel cmake re2c
76+
77+#### Fedora
78+
79+ sudo dnf install gcc gcc-c++ git gmp-devel openssl-devel openssl ncurses-devel libsigsegv-devel ctags automake autoconf libtool ragel cmake re2c
80+
81+#### AWS
82+
83+ sudo yum --enablerepo epel install gcc gcc-c++ git gmp-devel openssl-devel ncurses-devel libsigsegv-devel ctags automake autoconf libtool cmake re2c
84+
85+#### OS X - Homebrew
86+
87+ brew install git gmp libsigsegv openssl libtool autoconf automake cmake
88+
89+#### OS X - Macports
90+
91+ sudo port install git gmp libsigsegv openssl autoconf automake cmake
92+
93+Although `automake`/`autoconf`/`libtool` are generally installed by
94+default, some have reported needing to uninstall and reinstall those
95+three packages, at least with Homebrew. Your mileage may vary.
96+
97+#### FreeBSD
98+
99+ pkg install git gmake gmp libsigsegv curl python automake autoconf ragel cmake re2c libtool
100+
101+#### Archlinux
102+
103+ pacman -S gcc gmp libsigsegv openssl automake autoconf ragel cmake re2c libtool ncurses
104+
105+### Download and make
106+
107+Clone the repo:
108+
109+ git clone git://github.com/urbit/urbit.git
110+
111+`cd` to the directory you just created:
112+
113+ cd urbit
114+
115+Run `make`:
116+
117+ make
118+
119+(On FreeBSD, use `gmake` instead.)
readme.md+11−4
@@ -1,7 +1,14 @@
1−# Urbit docs
1+Urbit docs
2+==========
23
3−These are the urbit docs as they appear on urbit.org.
4+These are the urbit docs as they appear on [urbit.org](urbit.org/docs).
45
5−We're currently in the process of factoring this repo out of the [urbit core](http://github.com/urbit/urbit) (as of 1/28/2015).
6+If you'd like to serve the contents from your Urbit just copy `docs/` and `docs.md` into `web/` inside your urbit.
67
7−This readme will get updated when that process is complete.
8+
9+Contributing
10+============
11+
12+PRs are more than welcome: both corrections and suggestions.
13+
14+We're almost always available on `:talk`, but you can also email [`urbit@urbit.org`](mailto:urbit@urbit.org) or post to [`urbit-dev`](https://groups.google.com/forum/#!forum/urbit-dev) if you have questions.