YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -1,22 +1,22 @@
|
|||
/*REXX program demonstrates the Amd operator, choosing a word from each set. */
|
||||
@.=; @.1 = "the that a"
|
||||
@.2 = "frog elephant thing"
|
||||
@.3 = "walked treaded grows"
|
||||
@.=; @.1 = "the that a"
|
||||
@.2 = "frog elephant thing"
|
||||
@.3 = "walked treaded grows"
|
||||
@.4 = "slowly quickly"
|
||||
call Amb 1 /*find all word combinations that works*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
Amb: procedure expose @.; parse arg # x; arg . u /*2nd parse uppercases U*/
|
||||
do j=1 until @.j==''; end /*locate a null string. */
|
||||
t=j-1 /*define number of sets.*/
|
||||
if #>t then do; w=word(u,1) /*W: is a uppercased U*/
|
||||
do n=2 to words(u); ?=word(u, n)
|
||||
if left(?, 1) \== right(w, 1) then return; w=?
|
||||
end /*n*/
|
||||
say space(x)
|
||||
Amb: procedure expose @.; parse arg # x; arg . u /*ARG uppercases U values. */
|
||||
do j=1 until @.j=='' /*locate a null string. */
|
||||
end /*j*/
|
||||
t= j-1 /*define number of sets. */
|
||||
if #>t 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
|
||||
|
||||
do k=1 for words(@.#) /*process words in sets.*/
|
||||
call Amb #+1 x word(@.#, k) /*generate combinations,*/
|
||||
end /*k*/ /* [↑] (recursively).*/
|
||||
return
|
||||
do k=1 for words(@.#); call Amb #+1 x word(@.#, k)
|
||||
end /*k*/ /* [↑] generate all combs */
|
||||
return /* recursively. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue