Skip to content

(:at) - Operators

select a value at exactly the specified scope level

clojure
(:at scope val)

Where:

  1. scope: the enclosing scope to confine the search to *
  2. val: an immediate descendant of the scope *

Expanding into:

clojure
(:#across 2 \1 \2)

Guides

Behavior

  • Similar in concept to the CSS > operator

Examples

Find calls made directly at module level, not inside any function.

clojure
(:at (mod) (call setup))

Selects in lines { 1 }:

typescript
setup()

def init():
  setup()

Find calls inside a function but not in nested functions.

clojure
(:at (fun outer) (call x))

Selects in lines { 2, 2 }:

typescript
def outer():
  x()
  def inner():
    x()
  x()

Audit direct function body statements without traversing into nested scopes.

clojure
(:at (fun process) (call log))

Selects in lines { 2, 2 }:

typescript
def process():
  log()
  def helper():
    log()
  log()

def other():
  log()

Find variable declarations at exactly the class level.

clojure
(:at (class Config) (var))

Selects in lines { 4, 5 }:

typescript
x = 1

class Config:
  timeout = 30
  retries = 3

  def setup(self):
    local = 5

Arguments

scope

val

Copyright © 2022-present Semantic Works, Inc.