Mou Code

Divacon Trace Output


scannob

-- source -- scannob = !self @ PDC(d_lr, c_lr, id, (runOnLeft, runOnRight) @ #!corr, atom, id2x) trace(scannob, [0, 1, 2, 3, 4, 5, 6, 7]) -- end source -- -- lib: scannob_lib.py -- """User-extensible Divacon helper library. Anything callable defined here (and not starting with _) gets loaded into the Divacon STDLIB by `pydc <prog.dc> <this-file>`, so .dc programs can refer to it by name. Convention: each helper takes one tuple argument (the comm'd tuple) and returns the resulting scalar/tuple. Use destructuring on the first line.""" def runOnLeft(t): """((hereval, tailval), (otherhv, othertv)) -> (hereval, hereval + othertv) Drop-in adjustment used in scan-without-broadcast (left side of pair).""" L, R = t return (L[0],L[1] + R[1]) def runOnRight(t): """((hereval, tailval), (otherhv, othertv)) -> (hereval+othertv,tailval+othertv) Drop-in adjustment used in scan-without-broadcast (right side of pair).""" L, R = t return (L[0] + R[1],L[1] + R[1]) def id2x(A): return [(A[0],A[0])] -- end lib -- -- trace: scannob([0,1,2,3,4,5,6,7]) -- f([0,1,2,3,4,5,6,7]) divide d_lr -> ([0,1,2,3], [4,5,6,7]) f([0,1,2,3]) divide d_lr -> ([0,1], [2,3]) f([0,1]) divide d_lr -> ([0], [1]) f([0]) ⇣ atom; basef -> [(0, 0)] f([1]) ⇣ atom; basef -> [(1, 1)] post #!corr -> ([((0, 0), (1, 1))], [((1, 1), (0, 0))]) post (runOnLeft, runOnRight) -> ([(0, 1)], [(1, 1)]) combine c_lr -> [(0, 1),(1, 1)] f([2,3]) divide d_lr -> ([2], [3]) f([2]) ⇣ atom; basef -> [(2, 2)] f([3]) ⇣ atom; basef -> [(3, 3)] post #!corr -> ([((2, 2), (3, 3))], [((3, 3), (2, 2))]) post (runOnLeft, runOnRight) -> ([(2, 5)], [(5, 5)]) combine c_lr -> [(2, 5),(5, 5)] post #!corr -> ([((0, 1), (2, 5)),((1, 1), (5, 5))], [((2, 5), (0, 1)),((5, 5), (1, 1))]) post (runOnLeft, runOnRight) -> ([(0, 6),(1, 6)], [(3, 6),(6, 6)]) combine c_lr -> [(0, 6),(1, 6),(3, 6),(6, 6)] f([4,5,6,7]) divide d_lr -> ([4,5], [6,7]) f([4,5]) divide d_lr -> ([4], [5]) f([4]) ⇣ atom; basef -> [(4, 4)] f([5]) ⇣ atom; basef -> [(5, 5)] post #!corr -> ([((4, 4), (5, 5))], [((5, 5), (4, 4))]) post (runOnLeft, runOnRight) -> ([(4, 9)], [(9, 9)]) combine c_lr -> [(4, 9),(9, 9)] f([6,7]) divide d_lr -> ([6], [7]) f([6]) ⇣ atom; basef -> [(6, 6)] f([7]) ⇣ atom; basef -> [(7, 7)] post #!corr -> ([((6, 6), (7, 7))], [((7, 7), (6, 6))]) post (runOnLeft, runOnRight) -> ([(6, 13)], [(13, 13)]) combine c_lr -> [(6, 13),(13, 13)] post #!corr -> ([((4, 9), (6, 13)),((9, 9), (13, 13))], [((6, 13), (4, 9)),((13, 13), (9, 9))]) post (runOnLeft, runOnRight) -> ([(4, 22),(9, 22)], [(15, 22),(22, 22)]) combine c_lr -> [(4, 22),(9, 22),(15, 22),(22, 22)] post #!corr -> ([((0, 6), (4, 22)),((1, 6), (9, 22)),((3, 6), (15, 22)),((6, 6), (22, 22))], [((4, 22), (0, 6)),((9, 22), (1, 6)),((15, 22), (3, 6)),((22, 22), (6, 6))]) post (runOnLeft, runOnRight) -> ([(0, 28),(1, 28),(3, 28),(6, 28)], [(10, 28),(15, 28),(21, 28),(28, 28)]) combine c_lr -> [(0, 28),(1, 28),(3, 28),(6, 28),(10, 28),(15, 28),(21, 28),(28, 28)] !self_ -> [0,1,3,6,10,15,21,28] -- result: [0,1,3,6,10,15,21,28] --
Your thoughts?
(will not be shared or abused)
Comment:
                                        Feedback is welcome.
Copyright © 2025 Thomas C. Veatch. All rights reserved.
Created: May 2026