💾 Archived View for idiomdrottning.org › call-table-literals captured on 2023-06-16 at 16:53:44. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

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.

I.e.

(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))))

and

(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.

Clojure-like destructuring in brev

call-table

brev-separate