MutableLambda.sql 503 B

123456789101112131415161718192021222324
  1. /* syntax version 1 */
  2. $regs = AsList("^a","^b");
  3. $input = AsList("e","aa","et","cb","ba");
  4. $table_input = (select * from (select $input as x) flatten by x);
  5. $compiled_regs = ListMap($regs, ($r)->{
  6. return Re2::Grep($r);
  7. });
  8. $f = ($s) -> {
  9. $apply_list = ListMap($compiled_regs, ($cr)->{
  10. return $cr($s);
  11. });
  12. $filtered = ListFilter($apply_list, ($m)->{
  13. return $m;
  14. });
  15. return ListLength(ListTake($filtered,1)) > 0;
  16. };
  17. select x, $f(x) from $table_input;