Other utilities


In addition to the matcher there is a small utilities package. This contains functions to deal with association lists (see below) and a suite of set handling functions. Brief examples of some of the functions are given here.
 

Functions for association lists

The function called -> extracts values from association lists, for example...
 
(defvar country
'((Africa
    (Botswana (Capital . Gaborone) (Population . 1.5))
    (Zimbabwe (Capital . Harare)   (Population . 11)))
  (Asia
    (India   (Capital . New-Delhi) (Population . 980))
    (Sri-Lanka (Capital . Colombo) (Population . 15))
  )))

> (-> country 'Africa 'Zimbabwe 'Capital)
==> HARARE

Other functions update association lists.
 

Set handling functions.

a variety of set manipulation functions exist in lisp but use irregular names, utils includes a suite of set functions, their names all start with "$" (to be read "set") and are followed by mathematical or boolean symbols chosen to be easily remembered mnemonics. Examples include $- (set difference), S+ (set union), $* (intersection) and $<= (is-subset-of).