Skip to content

Agregar instrucciones like arpeggio #60

@gustavoaca1997

Description

@gustavoaca1997
legato Tree {
    leaf: quarter,
    node: Melody<Tree>
}

sum(tree: >Tree, acc: >quarter): quarter {
    like arpeggio tree {
        (x: leaf) -> {
            acc <-> acc + x|
        }
        (xs: node) -> {
            loop idx {
                sum(xs[idx], acc)|
            } in (length(xs))
        }
    }
}

moderato() {
    tree: Tree <-> Tree(node: [
        Tree(node: [
            Tree(leaf: 0),
            Tree(leaf: 1)
        ]),
        Tree(leaf: 2),
        Tree(node: [
            Tree(leaf: 3),
            Tree(node: [
                Tree(leaf: 4)
            ])
        ])
    ])|

    total: quarter <-> 0|
    sum(tree, total)|
    |>(total)|          -- this should print 10
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions