Minimal steps down to 1: Difference between revisions
Content deleted Content added
Line 187: | Line 187: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
This is a non-recursive solution that is memoized for the count-only portions of the task, but not memoized when all possible solutions are to be listed. |
|||
Implemented as a generic solution for any functions acting on an integer and taking any range of second arguments, with the goal solution also specifiable. To do so generically, it is also necessary to specify a failure condition, which in the example is falling below 1. |
|||
<lang julia>import Base.print |
<lang julia>import Base.print |
||
Line 200: | Line 202: | ||
end |
end |
||
Base.print(io::IO, ao::ActionOutcome) = print(io, "$(ao.act.f) $(ao.act.i) yields $(ao.out)") |
|||
print(io, "$(ao.act.f) $(ao.act.i) yields $(ao.out)") |
|||
end |
|||
memoized = Dict{Int, Int}() |
memoized = Dict{Int, Int}() |