Skip to content

(:not) - Operators

select a value that fails to meet a condition (complement)

clojure
(:not val)

Where:

  1. val: condition that must not apply *

Behavior

  • Placement matters:
    • (:not (arg _ (obj))) means 'no argument may be an object', while
    • (arg _ (:not (obj))) means 'an argument that is not an object'.

Examples

Find objects that lack a specific property.

clojure
(obj (:not (prop error)))

Selects in lines { 1, 3 } but not in { 2 }:

typescript
const response1 = { data: users }
const response2 = { data: users, error: null }
const response3 = { status: 'ok' }

Locate function calls without any arguments.

clojure
(call refresh (:not (arg)))

Selects in lines { 1 } but not in { 2, 3 }:

typescript
refresh()
refresh(true)
poll()

Find array elements that are not string literals.

clojure
(arr (el _ (:not (str))))

Selects in lines { 1, 3 } but not in { 2 }:

typescript
const arr1 = [1, 2, 3]
const arr2 = ['a', 'b']
const arr3 = [1, 'a', 2]

Arguments

val

  1. inherit

Copyright © 2022-present Semantic Works, Inc.