The q-lang egg provides a procedural interface to Q, a functional programming language based on equational term rewriting. It allows loading a file of equations or specifying them from within Scheme, and allows you to encode Q expressions in native source, native binary, or S-expression formats. You have access to the Q reduction interpreter and can set and clear Q variables.
The primitives of Q expressions are symbols, numbers, and booleans, which are represented in the obvious way in S-expression format. Q lists are likewise represented as Scheme lists, and Q tuples as Scheme vectors. Q function applications, however, are Scheme lists whose car is q:call, an illegal Q symbol; likewise, improper Q tuples are represented as improper Scheme lists whose car is q:tuple.
Q native source is represented using Scheme strings, and Q native binary objects are Chicken Scheme tagged pointers; the q:obj? predicate returns #t on these. Q binary objects can be embedded in S-expressions, and in particular a Q binary object may be passed to any routine that expects an S-expression.
Returns #t if OBJECT is a Q binary object.
Returns a Q binary object representing EXP interpreted as a Q expression in S-expression format.
Returns a Q binary object representing STRING interpreted as Q native source code.
Returns a Scheme value in S-expression format representing EXP, which can be a Q binary object or a Scheme value representing a Q expression in S-expression format.
Returns a Scheme value in S-expression format representing STRING, which is interpreted as Q native source code.
Returns a string in Q native source code format representing EXP, which can be a Q binary object or a Scheme value representing a Q expression in S-expression format.
Returns a string in Q native source code format representing STRING, representing a string in Q native code format. This is not a no-op, because it syntax-checks the string and uses any unparsing rules specified in the Q program.
Returns a Q binary object representing the fully reduced form of EXP interpreted as a Q expression in S-expression format.
Returns a Q binary object representing the fully reduced form of STRING interpreted as Q native source code.
Returns a Scheme value in S-expression format representing the fully reduced form of EXP, which can be a Q binary object or a Scheme value representing a Q expression in S-expression format.
Returns a Scheme value in S-expression format representing the fully reduced form of STRING, which is interpreted as Q native source code.
Returns a string in Q native source code format representing the fully reduced form of EXP, which can be a Q binary object or a Scheme value representing a Q expression in S-expression format.
Returns a string in Q native source code format representing the fully reduced form of STRING, representing a string in Q native code format.
Loads Q equations from the file named FILENAME. Any equations loaded by previous calls to q:load-rules! or q:set-rules! are discarded.
Loads Q equations from STRING. Any equations loaded by previous calls to q:load-rules! or q:set-rules! are discarded.
Loads the value of the Q tuple ARGV from the arguments ARGS. If an argument is not a string, it is converted to a string as if by display.
Defines the Q variable VAR, specified with a Scheme symbol, to have the value VALUE, specified as a Q expression in S-expression format.
Defines the Q variable VAR, specified with a Scheme symbol, to have the value VALUE, specified as a Q expression in source code format.
Causes the Q variable VAR, specified with a Scheme symbol, to have no value.
Copyright 2006 John Cowan. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.