YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -2,46 +2,45 @@ import system'routines.
|
|||
import extensions.
|
||||
import extensions'routines.
|
||||
|
||||
joinable = (:aFormer:aLater)(aFormer[aFormer length - 1] == aLater[0]).
|
||||
joinable(former,later) = (former[former length - 1] == later[0]).
|
||||
|
||||
dispatcher =
|
||||
{
|
||||
eval(object anArray, Func2 aFunction)
|
||||
eval(object a, Func2 f)
|
||||
[
|
||||
^ aFunction(anArray[0],anArray[1]).
|
||||
^ f(a[0],a[1]).
|
||||
]
|
||||
|
||||
eval(object anArray, Func3 aFunction)
|
||||
eval(object a, Func3 f)
|
||||
[
|
||||
^ aFunction(anArray[0], anArray[1],anArray[2]).
|
||||
^ f(a[0], a[1],a[2]).
|
||||
]
|
||||
|
||||
eval(object anArray, Func4 aFunction)
|
||||
eval(object a, Func4 f)
|
||||
[
|
||||
^ aFunction(anArray[0],anArray[1],anArray[2],anArray[3]).
|
||||
^ f(a[0],a[1],a[2],a[3]).
|
||||
]
|
||||
|
||||
eval(object anArray, Func5 aFunction)
|
||||
eval(object a, Func5 f)
|
||||
[
|
||||
^ aFunction(anArray[0],anArray[1],anArray[2],anArray[3],anArray[4]).
|
||||
^ f(a[0],a[1],a[2],a[3],a[4]).
|
||||
]
|
||||
|
||||
}.
|
||||
|
||||
class AmbValueCollection
|
||||
{
|
||||
object theCombinator.
|
||||
|
||||
constructor new(V<object> Arguments)
|
||||
generic constructor new(V<object> args)
|
||||
[
|
||||
theCombinator := SequentialEnumerator new(Arguments).
|
||||
theCombinator := SequentialEnumerator new(args).
|
||||
]
|
||||
|
||||
seek : aCondition
|
||||
seek : cond
|
||||
[
|
||||
theCombinator reset.
|
||||
|
||||
theCombinator seekEach(:v)(dispatcher eval(v,aCondition))
|
||||
theCombinator seekEach(:v)(dispatcher eval(v,cond))
|
||||
]
|
||||
|
||||
do : aFunction
|
||||
|
|
@ -55,11 +54,11 @@ class AmbValueCollection
|
|||
|
||||
ambOperator =
|
||||
{
|
||||
generic for(V<object> Arguments)
|
||||
= AmbValueCollection new(Arguments).
|
||||
generic for(V<object> args)
|
||||
= AmbValueCollection new(args).
|
||||
}.
|
||||
|
||||
public program =
|
||||
public program
|
||||
[
|
||||
try(ambOperator
|
||||
for(("the","that","a"),("frog", "elephant", "thing"),("walked", "treaded", "grows"),("slowly", "quickly"));
|
||||
|
|
@ -72,5 +71,5 @@ public program =
|
|||
]
|
||||
}.
|
||||
|
||||
console readChar.
|
||||
].
|
||||
console readChar
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue