-- Leo's gemini proxy

-- Connecting to idiomdrottning.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

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

-- Response ended

-- Page fetched on Thu Mar 28 10:53:42 2024