javascript - Matching false (== undefined, null) in ClojureScript core.match -


i'm trying match false value of map's key, in javascript means undefined, null etc... seems me core.match matches value exactly. there way this?

the other way match "not true", docs don't give me hint how either.

you use :or patterns:

(match [x]   [(:or false nil)] true   [_] false) 

returns true if x false or nil, false otherwise.

alternatively, use :guard patterns:

(match [x]   [(_ :when not)] true   [_] false) 

:when patterns work (with (defpred not)), can tricky right , bring no benefit on guards in case.


Comments