about summary refs log tree commit diff stats
path: root/archive/0.vm.arc/Readme.md
blob: b8292abb08c9f3d87a9050028b89a332e209a0d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Original prototype, last modified 2015-03-14

First install [Racket](http://racket-lang.org) (just for this prototype;
last tested with v6.3). Then:

  ```shell
  $ cd mu/archives/1.vm
  $ git clone http://github.com/arclanguage/anarki
  $ cd anarki
  $   git checkout d7290130a7  # last compatible snapshot
  $ cd ..
  $ ./mu test mu.arc.t  # run tests
  ```

Example programs:

  ```shell
  $ ./mu factorial.mu  # computes factorial of 5
  $ ./mu fork.mu  # two threads print '33' and '34' forever
  $ ./mu channel.mu  # two threads in a producer/consumer relationship
  ```
port init; init() from ranger.container import History from unittest import TestCase, main import unittest class Test(TestCase): def test_history(self): hist = History(3) for i in range(6): hist.add(i) self.assertEqual([3,4,5], list(hist)) hist.back() self.assertEqual(4, hist.current()) self.assertEqual([3,4], list(hist)) self.assertEqual(5, hist.top()) hist.back() self.assertEqual(3, hist.current()) self.assertEqual([3], list(hist)) # no change if current == bottom self.assertEqual(hist.current(), hist.bottom()) last = hist.current() hist.back() self.assertEqual(hist.current(), last) self.assertEqual(5, hist.top()) hist.forward() hist.forward() self.assertEqual(5, hist.current()) self.assertEqual([3,4,5], list(hist)) self.assertEqual(3, hist.bottom()) hist.add(6) self.assertEqual(4, hist.bottom()) self.assertEqual([4,5,6], list(hist)) if __name__ == '__main__': main()