Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1008130 // matchConditions_all

JavaX fragment (include)

static L<Map<S, Lisp>> matchConditions_all(L<Lisp> conditions) {
  ret matchConditions_all(conditions, new HashMap);
}

static L<Map<S, Lisp>> matchConditions_all(L<Lisp> conditions, Map<S, Lisp> m) {
  if (empty(conditions)) ret ll(m);
  
  Lisp condition = first(conditions);
  L<Map<S, Lisp>> candidates = matchCondition_all(condition, m);
  if (empty(candidates)) ret candidates; // first condition failed
  
  new LinkedHashSet<Map<S, Lisp>> results;
  for (Map<S, Lisp> m2 : candidates)
    results.addAll(matchConditions_all(dropFirst(conditions), m2));
  ret asList(results);
}

Author comment

Began life as a copy of #1008124

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008130
Snippet name: matchConditions_all
Eternal ID of this version: #1008130/3
Text MD5: 80f23fb91f1abdeceef3d6e5db1a4e1a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-14 02:12:30
Source code size: 602 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 470 / 517
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)