r3/io-build.tng
author Tony Garnock-Jones <tonygarnockjones@gmail.com>
Wed, 16 Jan 2019 17:15:58 +0000
changeset 438 1fe179d53161
parent 222 799f14cd040a
permissions -rw-r--r--
Add missing primitive implementation for the plain interpreter.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
     1
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
     2
define-method (d=[Directory: _] nonUnderscoreFolders) (
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
     3
  filter: d folders by: [x=_: (x name beginsWith: '_') not]
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
     4
);;
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
     5
222
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
     6
"filter: folders d by: [$x: not (name x beginsWith: '_')]"
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
     7
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
     8
define [
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
     9
  Log: [indentLevel: 0 ref]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    10
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    11
  ([indentLevel: i] indentDuring: blk):
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    12
    ( i set: i get + 1,
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    13
      blk $ (),
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    14
      i set: i get - 1 )
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    15
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    16
  (write $x)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    17
];;
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    18
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    19
"
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    20
Syntactic sugar:
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    21
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    22
   a + b   ==>   (0: a #(+): b)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    23
   a b     ==>   (#b: a)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    24
   a: b    ==>   (a: b)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    25
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    26
   [a + b] ==>   [0: a #(+): b]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    27
   [a b]   ==>   [#b: a]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    28
   [a: b]  ==>   [a: b]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    29
"
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    30
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    31
"
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    32
Read '<==>' as 'matched against' (with pattern on left, value on right)
46
6a9fab6479be More syntax thoughts.
Tony Garnock-Jones <tonyg@lshift.net>
parents:
diff changeset
    33
222
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    34
As a pattern:		((indentLevel: i) indentDuring: blk) <==> msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    35
Expands to:		(0: (indentLevel: i) indentDuring: blk) <==> msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    36
Which results in        (indentLevel: i) <==> (msg $ #0)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    37
                    and blk <==> (msg $ #indentDuring)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    38
Which results in    	i <==> (msg $ #0) $ #indentLevel
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    39
                    and blk <==> (msg $ #indentDuring)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    40
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    41
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    42
    (foo: bar): ...      ->    bar bound to (msg $ #foo)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    43
    (foo bar): ...       ->    foo bound to (msg $ #bar)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    44
    (foo $ bar): ...     ->    illegal pattern
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    45
    foo: ...             ->    foo bound to msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    46
    123: ...             ->    123 matched with msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    47
    #foo: ...            ->    #foo matched with msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    48
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    49
Essentially, on the left of the colon (i.e. in pattern context), it is
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    50
a form entirely analogous to an expression, although obviously
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    51
application can't be matched since it's already been reduced. On the
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    52
right of the colon is another pattern. (??????????????????????????)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    53
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    54
[
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    55
  (foo: bar): zot
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    56
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    57
  [foo: bar]: zot
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    58
] $ msg
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    59
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    60
2 = [lowBit: false high: [lowBit: true high: zero]]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    61
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    62
[lowBit: false high: [lowBit: true high: zero]] <>
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    63
[lowBit: false high: [lowBit: true high: zero]]
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    64
  --> (false <> ([lowBit: false high: [lowBit: true high: zero]] $ #lowBit)) ^
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    65
      ([lowBit: true high: zero] <> ([lowBit: false high: [lowBit: true high: zero]] $ #high))
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    66
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    67
([lowBit: false high: [lowBit: true high: zero]] $ #lowBit)
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    68
  --> {presume matching against #high fails}
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    69
      results in false
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    70
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    71
What's the base case of the recursion??
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    72
Need a distinction somewhere!
799f14cd040a During the darcs->hg conversion, something apparently went wrong with
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents: 46
diff changeset
    73
"