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

16
LINES

< > BotCompany Repo | #1027895 // ai_lhsToForWhere

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (3096L) is out of date.

// e.g. hasWord($x) => bla
// to:  for $x where hasWord($x): bla

sO ai_lhsToForWhere(BasicLogicRule rule, DeepZipTools tools) {
  ret ai_lhsToForWhere(rule, null, tools);
}

sO ai_lhsToForWhere(BasicLogicRule rule, Set knownVars, DeepZipTools tools) {
  rule = (BasicLogicRule) ai_fragmentExpressionsToFunctionCalls(rule, tools);
  if (!(rule.lhs instanceof FunctionCall)) ret rule;
  FunctionCall fc = (FunctionCall) rule.lhs;
  if (l(fc.args) != 1) ret rule;
  O var = first(fc.args);
  if (!tools.isVar(var) || contains(knownVars, var)) ret rule;
  ret ForWhere(var, rule.lhs, rule.rhs);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027895
Snippet name: ai_lhsToForWhere
Eternal ID of this version: #1027895/4
Text MD5: 7f95287881ba36928e84dbe85871e859
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 16:12:37
Source code size: 608 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 126 / 212
Version history: 3 change(s)
Referenced in: [show references]