Hacker News new | ask | show | jobs
by ndriscoll 465 days ago
I don't ever have a reason to practice this and can't be bothered to test it, so this might be off, but something like this ought to work?

    fn recurse(tree, acc = Nil) : 
        tree.children match
            case Cons(head, tail) => recurse(head, tail++acc)
            case Nil => acc match
                case Cons(head, tail) => recurse(head, tail)
                case Nil => ()