Amb: Difference between revisions
→{{header|langur}}
m (Minor error correction.) |
Langurmonkey (talk | contribs) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1,454:
constructor new(params object[] args)
{
_combinator := SequentialEnumerator.
}
Line 1,461:
_combinator.reset();
_combinator.seekEach::(v => dispatcher.eval(v,cond))
}
Line 1,498:
new object[]{"walked", "treaded", "grows"},
new object[]{"slowly", "quickly"})
.seek::(a,b,c,d => joinable(a,b) && joinable(b,c) && joinable(c,d) )
.do::(a,b,c,d) { console.printLine(a," ",b," ",c," ",d) }
}
catch(Exception e)
{
console.printLine
};
Line 2,448:
=={{header|langur}}==
This would build every valid set, but for the sample data, there's only one.
<syntaxhighlight lang="langur">val .wordsets = [
]
val .alljoin =
if last(.words[.i]) != first(.words[.i+1]): break = false
}}
# .amb expects 2 or more arguments
val .amb =
writeln join "\n", filter
</syntaxhighlight>
{{out}}
Line 5,288:
uBasic/4tH has limited support for arrays, so some workarounds are required to make this work.
<syntaxhighlight lang="text"> ' set up the arrays
Push
Push
Push
Push
' we'll reuse variable f ;-)
Proc _Ambassert (_Connect) ' now assert the function required
Line 5,327:
0 OK, 0:772
</pre>
=={{header|VBScript}}==
=====Implementation=====
Line 5,407 ⟶ 5,408:
{{trans|Go}}
Based on the 'alternative' version.
<syntaxhighlight lang="
var amb // recursive closure
|