filtered = Q(l,{'name__contains':"k", "age__lt":20})
filtered = [x for x in l if ('k' in x['name'] and int(x['age']) < 20)]
{"name" (includes? "k"), "age" (< 20)}
{"name" #(includes? % "k"), "age" #(< % 20)}
{"name" (fn [name] (includes? name "k")), "age" (fn [age] (< age 20))}
You could serialize the patterns using EDN as a substitute for JSON.
Fun stuff.
I wrote something [similar][1] in javascript. With that it would be:
const is_k_kid = tisch.compileFunction((etc) => ({ 'name': name => name.includes('k'), 'age': age => age < 20, ...etc })); const result = input.filter(is_k_kid);
[1]: https://github.com/dgoffredo/tisch
You could serialize the patterns using EDN as a substitute for JSON.
Fun stuff.
I wrote something [similar][1] in javascript. With that it would be:
Yes, "...etc" is part of the DSL.[1]: https://github.com/dgoffredo/tisch