Idiomdrottning’s homepage

call table literals

ct, ctq, ct* and ctq* are sugar for creating a call-table with some values already filled.

The q variants are implicitly quasiquoted while the non-q variants aren’t.


(let ((banana-color 'yellow))
  (ctq banana ,banana-color apple red))

is equivalent to

(let ((banana-color 'yellow))
  (call-table seed: `((banana . ,banana-color) (apple . red))))


(let ((banana-color 'yellow))
  (ct 'banana banana-color 'apple 'red))

The * variants create call-table* instances instead.

These call-tables aren’t closed, you can add more keys and values to them.

In brev-separate from version 1.42.

In destructuring

Our first example from our last post becomes:

(define (basket-color-inspect
         ('shopping-basket (= (ctq banana yellow apple red pear green) color)))
  (print "The shopping basket has a " color " fruit."))

(basket-color-inspect '(shopping-basket apple))

That prints:

The shopping basket has a red fruit.

ct is kinda like the curly-braced map literals in Clojure.