Sib-pair Command: eval


ClassGlobal
Nameeval
Arguments [Scheme expression]

Accesses the Scheme read-eval-print-loop. If called without arguments, presents the Scheme prompt "%%", otherwise evaluates the rest of the line as if it were a Scheme expression. Sib-pair macro variables and functions are stored within the Scheme environment, and so can read and written to. The Sib-pair specific extensions to Scheme are "(nloci)", "(ls)", "(loc)", "(loctyp)", "(locord)", "(locnotes)", "(read-line)", "(run)" and "(help)".

(ls ["m" | "x" | "h" | "a" | "q" | "d[mxhqa]"])List locus names
(nloci)returns total number of loci
(loc )returns locus at that position in the locus list
(locord <loc>)returns position of a locus in the locus list
(locnotes <loc>)returns notes for a locus
(loctyp <loc>)evaluates type of a locus ("adhmqx")
(read-line <port>)Read next line from port as a string
(run "<Sib-pair command>")Run a Sib-pair command
(string-split <string> [<sep>]Convert from string to list of words split on white-space (or a specified character separator)
(system "<operating system command>")Run an OS command
(help)Information about this Scheme implementation

For documentation of other Scheme commands, see the Scheme standard: Standard Revised^5 Report on the Algorithmic Language Scheme (R5RS). The Sib-pair Scheme interpreter is fairly minimal in that it does not implement characters, vectors, noninteger numbers (exact or inexact) or hygienic macros. Aside from this, most of the R5RS examples work without problems (the interpreter is a port of Minischeme/Tinyscheme to Fortran 95).

Example:

>> eval  
%% (define  (interval-list m n)
  (if (> m n)
      '()
      (cons m (interval-list (+ 1 m) n))))
(define (sieve l)
  (define (remove-multiples n l)
    (if (null? l)
        '()
        (if  (= (modulo (car l) n) 0)      ; division test
             (remove-multiples n (cdr l))
             (cons (car l)
                   (remove-multiples n (cdr l))))))
  (if (null? l)
      '()
      (cons (car l)
            (sieve (remove-multiples (car l) (cdr l))))))
(define (primes<= n)
  (sieve (interval-list 2 n)))
%% (primes<= 300)
(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 
101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 
193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293)
%% (quit)
Leaving scheme!
>> eval (primes<= 30)
(2 3 5 7 11 13 17 19 23 29)
>>

Scheme keywords:

<Numerically less than
<=Numerically less than or equal
=Numerically equal
>Numerically greater than
>=Numerically greater than or equal to
-Integer subtraction
/Integer division
*Integer multiplication
+Integer addition
absAbsolute value
andLogical and
appendAppend to end of list
applyApply function to list
aproposList matching functions
assocFind matching pair in an "alist" (list of paired values) using equal?
assqFind matching pair in an "alist" using eq?
assvFind matching pair in an "alist" using eqv?
atom?Is a simple number or string?
beginStart a block
boolean?Is a boolean?
carFirst element of pair or list
cdrRemainder of pair or list
caarFirst element of first element of pair or list
cadrUnd so weiter
cdar
cddr
caaar
cdddr
caadr
cadar
caddr
cdaar
cdadr
cddar
call/ccnon-local exit from loop or procedure body
call-with-current-continuationnon-local exit from loop or procedure body
caseConditional branching
closure?Is a closure
close-input-portCloses a port
condConditional branching
consCreate a Lisp pair of elements
cons-stream
defineDefine a variable or function
delayDelay (lazy) evaluation
displayPrint a variable or function
elseDefault arm of a cond
eq?Fussy version of eqv? (same memory location)
equal?Recursively applies eqv?
eqv?True if obj1 and obj2 should normally be regarded as the same object.
errorPrint an error message
evalEvaluate a SEXPR (Scheme expression)
even?Test if even
exitExit Sib-pair completely
exptInteger exponentiation
forceCarry out a delayed evaluation
for-eachLike map, but used for side-effects only
gcForce a garbage collection
gcdGreatest common divisor
get-closure-code
helpMinimal information about Scheme
ifConditional branching
integer?Is an integer
lambdaFunction
lcmLeast common multiple
lengthGives length of a list
letDeclare local variables
let*Declare local variables sequentially
letrecDeclare local variables, allowing recursive definitions
listCreate a list
list-refGives Nth element of a list
list-tailDrops the first k elements of a list
loctypEvaluates type of a Sib-pair locus
lsList Sib-pair variables
macro
make-stringCreate a string of given length
mapApply a function to each element of a list in turn
maxMaximum of arguments
memberTest if present in a list
memqTest if present in a list using equal?
memvTest if present in a list using eqv?
minMinimum of arguments
moduloGive modulo
negative?Test if negative integer
newlinePrint a newline
new-segmentMemory allocation chunk size
notLogical negation
null?Test if a null
number?Test if an integer number
number->stringConvert from number to string
odd?Test if odd
open-input-fileOpen an input stream (port)
orLogical or
pair?Test if a Lisp pair
positive?Test if a positive integer
procedure?Is a function?
quasiquote
quitLeave the Scheme interpreter
quoteQuoted expression left unevaluated
quotientInteger division
randomA random integer from U(1, N)
readRead an Scheme object from input
remainderRemainder
reverseReverse ordering of a list
runRun a Sib-pair command
set!Set the contents of an existing variable
set-car!Set contents of first element of pair or list
set-cdr!Set contents of rest of pair or list
sqrtInteger square root
string?Is argument a string?
string-appendConcatenate strings
string-lengthLength of argument string
string-set!Set the value of a substring
string->numberConvert from a string to a number
string->symbolConvert from a string to a symbol
substringGet the value of a substring
string-splitConvert from string to list of words
string=?Are strings equal?
substring?Is string 1 a substring of string 2?
string<?Is string lexicographically less?
string>?Is string lexicographically greater?
string<=?Is string lexicographically less than or equal?
string>=?Is string lexicographically greater than or equal?
symbol?Is a symbol?
symbol->stringConvert from a symbol to a string
systemPasses commands to the operating system
unquote
unquote-splicing
writeWrite a Scheme object
zero?Test if equal to zero


<< (let)Up to index>> (loop)