| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
goal: |
| 7 |
language where closure is easy to write. |
| 8 |
closure(mx) is interesting: need cascading, if, while, |
| 9 |
picking, sorting. |
| 10 |
for more complicated stuff introduce mclvTernary? |
| 11 |
hum, still try to bind to ruby or lua? |
| 12 |
|
| 13 |
for efficiency, a framework with complete vectors and counts. |
| 14 |
it is not even supported in C though, i believe. a temporary |
| 15 |
vector is constructed for mclvBinary. |
| 16 |
|
| 17 |
|
| 18 |
types |
| 19 |
<node> |
| 20 |
<list> |
| 21 |
<graph> or <context> or <incidence> |
| 22 |
|
| 23 |
context(mx) sets the current context for overloaded operators. |
| 24 |
|
| 25 |
[ bad idea if I'll be using matrices to store results / keep state ] |
| 26 |
|
| 27 |
will need support for vectors of longs matrices of longs ? vectors of matrices ? |
| 28 |
tabs ? |
| 29 |
-> not in C though. User-assembled. conflicts with large scale stuff. |
| 30 |
|
| 31 |
|
| 32 |
def closure (<graph> mx, <node> i) |
| 33 |
{ context(mx) |
| 34 |
let(seen, list(i)) |
| 35 |
let(next, extend(i)) |
| 36 |
|
| 37 |
while(next) { |
| 38 |
let(nextnext, list()) |
| 39 |
for(next as n) { |
| 40 |
join(nextnext, extend(n), nextnext) |
| 41 |
} |
| 42 |
# apply(join(nextnext, _, nextnext), next) |
| 43 |
set(next, minus(nextnext, seen)) |
| 44 |
set(seen, join(seen, nextnext)) |
| 45 |
} |
| 46 |
yield(seen) |
| 47 |
# yield removes var seen from local storage. |
| 48 |
} |
| 49 |
|
| 50 |
# hum, ref counting? |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
(def closure ( |
| 55 |
|
| 56 |
mcxquery |
| 57 |
|
| 58 |
load("small.mci") |
| 59 |
load(mx, "small.mci") |
| 60 |
|
| 61 |
paths(2, 10) |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
$$ write ext(path()). |
| 66 |
$$ even better: allow arbitrary nesting |
| 67 |
dom("cr", join(path(disc(1, path(i(0-5), domain("1", 3))))), i(38)) |
| 68 |
|
| 69 |
bind(name, expression) |
| 70 |
|
| 71 |
v i i-list all listed integers |
| 72 |
v d v join of all sets indexed by v in domain matrix |
| 73 |
v d i-list join of all sets indexed by i-list in domain matrix |
| 74 |
|
| 75 |
v join v+ everything from all sets |
| 76 |
v meet v+ everything shared by all sets |
| 77 |
v minus v+ everything only in leftmost |
| 78 |
v diff v+ everthing in a single set |
| 79 |
v disc i, v expand nodes in v to radius i |
| 80 |
v tags l-list map of all listed labels |
| 81 |
|
| 82 |
v paths v all nodes participating in all shortest paths |
| 83 |
between all elements of v |
| 84 |
v paths v1, v2 all nodes participating in all shortest paths |
| 85 |
between all elements of v1 and v2 |
| 86 |
v paths i1, i2 all nodes participating in all shortest paths |
| 87 |
between i1 and i2, empty if none. |
| 88 |
m paths i1, i2 all nodes participating in all shortest paths |
| 89 |
between i1 and i2, NULL if none. |
| 90 |
|
| 91 |
|
| 92 |
v closure(i) all things reachable from i |
| 93 |
m closure(m) all connected components in m |
| 94 |
|
| 95 |
v strstr(pat) map of labels matching str |
| 96 |
|
| 97 |
v bind(name, v) bind v to name |
| 98 |
|
| 99 |
v cmpl(v) complement relative to default universe |
| 100 |
|
| 101 |
|
| 102 |
and empty and default actions should be coded as |
| 103 |
|
| 104 |
template(cr, v) |
| 105 |
template(cr, v1, v2) |
| 106 |
|
| 107 |
sub(cr, v) |
| 108 |
sub(cr, v1, v2) |
| 109 |
|
| 110 |
mcd matrix column domain |
| 111 |
mrd matrix row domain |
| 112 |
dcd domain column domain |
| 113 |
drd domain row domain |
| 114 |
|
| 115 |
and |
| 116 |
graph(cr, disc(5, i(..))) |
| 117 |
graph(cR, (disc(5, i(..)))) |
| 118 |
|
| 119 |
|
| 120 |
this will also make ext({l,r,}disc) redundant. |
| 121 |
It requires implementing a parse tree. Or lex/yacc. |
| 122 |
|
| 123 |
/ mcxsubs acting on tabs. |
| 124 |
should be relatively easy: just a different output primitive tab(foo) note |
| 125 |
that mcxdump already can take subselections. |
| 126 |
|
| 127 |
|
| 128 |
|