Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

29
Task/Amb/11l/amb.11l Normal file
View file

@ -0,0 +1,29 @@
F amb(comp, options, prev = ) -> Array[String]
I options.empty
R []
L(opt) options[0]
// If this is the base call, prev is empty and we need to continue.
I prev != & !comp(prev, opt)
L.continue
// Take care of the case where we have no options left.
I options.len == 1
R [opt]
// Traverse into the tree.
V res = amb(comp, options[1..], opt)
// If it was a failure, try the next one.
if !res.empty
R opt [+] res // We have a match
R []
V sets = [[the, that, a],
[frog, elephant, thing],
[walked, treaded, grows],
[slowly, quickly]]
V result = amb((s, t) -> s.last == t[0], sets)
print(result.join( ))