eval_code.sql 686 B

12345678910111213141516171819202122
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. select EvaluateCode(FuncCode("Int32",AtomCode("1")));
  4. $inc = EvaluateCode(LambdaCode(($x)->{return
  5. FuncCode("+", $x, FuncCode("Int32", AtomCode("1")))}));
  6. select $inc(1);
  7. $addPrefixForMembers = ($strValue)->{
  8. $code = EvaluateCode(LambdaCode(($str)->{
  9. $members = StructTypeComponents(TypeHandle(TypeOf($strValue)));
  10. $list = ListMap($members, ($x)->{
  11. return ListCode(AtomCode("prefix" || $x.Name),FuncCode("Member", $str, AtomCode($x.Name)));
  12. });
  13. return FuncCode("AsStruct",$list);
  14. }));
  15. return $code($strValue);
  16. };
  17. select $addPrefixForMembers(AsStruct(1 as foo, "2" as bar));