Amb: Difference between revisions

10 bytes removed ,  5 years ago
m
→‎version 1: optimized AMB function, changed whitespace.
m (→‎version 1: optimized AMB function, changed whitespace.)
Line 2,999:
/*──────────────────────────────────────────────────────────────────────────────────────*/
Amb: procedure expose @.; parse arg # x; arg . u /*ARG uppercases U values. */
do j=1 until @.j=='' do j=1 until @.j=='' /*locate a null string. */
end /*j*/ /*define number of sets. */
t=if #>j-1 then do; y=word(u, 1) /*Y: is a uppercased /*define number of setsU. */
if #>t then do; y=word(u, 1) /*Y: do isn=2 a to uppercasedwords(u); U. */ ?=word(u, n)
do n=2if left(?, to1) \== wordsright(uy, 1); then return; ?=word(u, n)y=?
if left(?,end 1) \== right(y, 1) then return; y=?/*n*/
say space(x) end /*n¬show superfluous blanks.*/
say space(x) /*¬show superfluous blanks.*/end
end
 
do k=1 for words(@.#); call Amb #+1 x word(@.#, k)
end /*k*/ /* [↑] generate all combs */
return /* recursively. */</lang>
{{out|output|text=&nbsp; when using the default internal inputinputs:}}
<pre>
that thing grows slowly