... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. (.require [library [lux (.except local) [abstract [equivalence (.only Equivalence)] [hash (.only Hash)]] [control ["[0]" pipe]] [data [text ["%" \\format (.only Format)]]] [math [number ["n" nat]]] [meta ["[0]" symbol] [macro ["^" pattern]]]]] ["[0]" / ["[1][0]" variable (.only Variable)]]) (type .public Constant Symbol) (type .public Reference (Variant {#Variable Variable} {#Constant Constant})) (def .public equivalence (Equivalence Reference) (implementation (def (= reference sample) (when [reference sample] (^.with_template [ ] [[{ reference} { sample}] (of = reference sample)]) ([#Variable /variable.equivalence] [#Constant symbol.equivalence]) _ false)))) (def .public hash (Hash Reference) (implementation (def equivalence ..equivalence) (def (hash value) (when value (^.with_template [ ] [{ value} (|> value (of hash) (n.* ))]) ([2 #Variable /variable.hash] [3 #Constant symbol.hash]) )))) (with_template [ ] [(def .public (template ( content) [(<| {} {} content)]))] [local ..#Variable /variable.#Local] [foreign ..#Variable /variable.#Foreign] ) (with_template [ ] [(def .public (template ( content) [(<| {} content)]))] [variable ..#Variable] [constant ..#Constant] ) (`` (def .public self (template (self) [(..variable (,, (/variable.self)))]))) (def .public format (Format Reference) (|>> (pipe.when {#Variable variable} (/variable.format variable) {#Constant constant} (%.symbol constant))))