#lang racket ;; symbols this module provides ;; The main unicalc code can only refer to definitions ;; in this file if they appear in a "provide" expression. (provide unicalc-db) (provide UDB) (provide make-QL get-quant get-num get-den) (provide make-UQL get-error) (provide extend-db) ;; The Unicalc database is an association list of pairs. ;; Each pair consists of a unit and a quantity defining the unit. ;; Units are atoms. ;; Quantities are 3-lists: numeric multiplier, numerator, denominator ;; Both numerator and denominator are lists of units. ;; It is assumed that they do not have any units in common and are sorted ;; '(i.e. they are already simplified, in the sense of the Unicalc application). ;; comparing symbols alphabetically requires conv. to strings (define (symstring sym1) (symbol->string sym2))) ;; a function for sorting lists of symbols: sortsym (define (sortsym L) (sort L sym