Amb: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) m (→{{Header|11l}}) |
m (→version 1: optimized AMB function, changed whitespace.) |
||
Line 2,999: | Line 2,999: | ||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
Amb: procedure expose @.; parse arg # x; arg . u /*ARG uppercases U values. */ |
Amb: procedure expose @.; parse arg # x; arg . u /*ARG uppercases U values. */ |
||
do j=1 until @.j=='' /*locate a null string. */ |
|||
end /*j*/ |
end /*j*/ /*define number of sets. */ |
||
if #>j-1 then do; y=word(u, 1) /*Y: is a uppercased U. */ |
|||
do n=2 to words(u); ?=word(u, n) |
|||
if left(?, 1) \== right(y, 1) then return; y=? |
|||
end /*n*/ |
|||
say space(x) /*¬show superfluous blanks.*/ |
|||
end |
|||
end |
|||
do k=1 for words(@.#); call Amb #+1 x word(@.#, k) |
do k=1 for words(@.#); call Amb #+1 x word(@.#, k) |
||
end /*k*/ |
end /*k*/ /* [↑] generate all combs */ |
||
return /* recursively. */</lang> |
return /* recursively. */</lang> |
||
{{out|output|text= when using the default internal |
{{out|output|text= when using the default internal inputs:}} |
||
<pre> |
<pre> |
||
that thing grows slowly |
that thing grows slowly |