]> hydra-www.ietfng.org Git - dyna2/commitdiff
row slicing - an example of interesting structure building
authortimv <tim.f.vieira@gmail.com>
Mon, 17 Dec 2012 20:49:35 +0000 (15:49 -0500)
committertimv <tim.f.vieira@gmail.com>
Mon, 17 Dec 2012 20:49:35 +0000 (15:49 -0500)
examples/row.dyna [new file with mode: 0644]

diff --git a/examples/row.dyna b/examples/row.dyna
new file mode 100644 (file)
index 0000000..c50a2d1
--- /dev/null
@@ -0,0 +1,15 @@
+
+% extract a row from matrix
+
+rowlen(N,I) max= J whenever m(N,I,J).
+row_(N,I,K) += &nil whenever K is (rowlen(N,I) + 1).
+row_(N,I,J) += &cons(*m(N,I,J), *row_(N, I, J + 1)).
+row(N,I) += row_(N,I,1).
+
+
+% matrix "b" = [ 3 0 ;
+%                0 2 ]
+m(b, 1, 1) += 3.
+m(b, 1, 2) += 0 .
+m(b, 2, 1) += 0 .
+m(b, 2, 2) += 2.