Query List Comprehensions
LFE supports QLCs for mnesia through the qlc macro. It has the same
structure as a list comprehension and generates a Query Handle in the
same way as with qlc:q([...])
. The handle can be used together with
all the combination functions in the module qlc.
For example:
(qlc
(lc ((<- (tuple k v) (ets:table e2)) (== k i)) v) {{Option}})
Macros, especially record macros, can freely be used inside query list comprehensions.
CAVEAT: Some things which are known not to work in the current
version are nested QLCs and let
/case
/recieve
which shadow
variables.