Transpiled version (2602L) is out of date.
// f : A -> Collection<A> // trace_out collects what the function returns // returns hashset including input static <A> Set<A> mapLike transitiveHullOfFunction(O f, A input, O... _) { final Set<A> seen = optPar(_, seen := (Set) lithashset(input)); final Int max = cast optPar max(_); Map trace_out = cast optPar trace_out(_); // Make pool of iterators final new LinkedList<Iterator<A>> pool; pool.add(iterator((Iterable<A>) callF(f, input))); int n = 0; while ping (!empty(pool) && (max == null || n < max)) { Iterator<A> it = first(pool); if (!it.hasNext()) continue with removeFirst(pool); // Get entry and check if seen already A entry = it.next(); if (!seen.add(entry)) continue; // found new entry - return and schedule for further analysis Collection<A> newStuff = cast callF(f, entry); mapPut(trace_out, entry, newStuff); if (nempty(newStuff)) pool.add(iterator(newStuff)); ++n; } ret seen; } static <A> Set<A> transitiveHullOfFunction(IF1<A, Cl<A>> f, A input, O... _) { ret transitiveHullOfFunction((O) f, input, _); }
Began life as a copy of #1022233
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1022458 | 
| Snippet name: | transitiveHullOfFunction | 
| Eternal ID of this version: | #1022458/12 | 
| Text MD5: | c6fcbd862c354aae5022fd2f5c7e8fc6 | 
| Author: | stefan | 
| Category: | javax / a.i. | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2021-06-21 21:47:54 | 
| Source code size: | 1143 bytes / 34 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 553 / 694 | 
| Version history: | 11 change(s) | 
| Referenced in: | [show references] |