view julia/recursion.jl @ 3:c1db337c15be

Reorganize files
author Lewin Bormann <lbo@spheniscida.de>
date Tue, 14 Feb 2023 21:12:06 +0100
parents
children
line wrap: on
line source


function combinations(n::Int, k::Int)::Vector
    if k == 1
        return collect(1:n)
    end
    lower = combinations(n, k-1)
    [(i, l...) for i in 1:n for l in lower]
end