| Class | Global |
| Name | eval |
| 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)", "(locnotes-set!)", "(read-line)", "(run)" and "(help)".
| (ls ["m" | "x" | "h" | "a" | "q" | "d[mxhqa]"]) | List locus names |
| (nloci) | returns total number of loci |
| (loc <index>) | 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 |
| (locnotes-set! <loc>) | rewrites 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) |
| (substring? <sub> <str>) | returns start of substring in |
| (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 |
| abs | Absolute value |
| and | Logical and |
| append | Append to end of list |
| apply | Apply function to list |
| apropos | List matching functions |
| assoc | Find matching pair in an "alist" (list of paired values) using equal? |
| assq | Find matching pair in an "alist" using eq? |
| assv | Find matching pair in an "alist" using eqv? |
| atom? | Is a simple number or string? |
| begin | Start a block |
| boolean? | Is a boolean? |
| car | First element of pair or list |
| cdr | Remainder of pair or list |
| caar | First element of first element of pair or list |
| cadr | Und so weiter |
| cdar | |
| cddr | |
| caaar | |
| cdddr | |
| caadr | |
| cadar | |
| caddr | |
| cdaar | |
| cdadr | |
| cddar | |
| call/cc | non-local exit from loop or procedure body |
| call-with-current-continuation | non-local exit from loop or procedure body |
| case | Conditional branching |
| closure? | Is a closure |
| close-input-port | Closes a port |
| cond | Conditional branching |
| cons | Create a Lisp pair of elements |
| cons-stream | |
| define | Define a variable or function |
| delay | Delay (lazy) evaluation |
| display | Print a variable or function |
| else | Default 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. |
| error | Print an error message |
| eval | Evaluate a SEXPR (Scheme expression) |
| even? | Test if even |
| exit | Exit Sib-pair completely |
| expt | Integer exponentiation |
| force | Carry out a delayed evaluation |
| for-each | Like map, but used for side-effects only |
| gc | Force a garbage collection |
| gcd | Greatest common divisor |
| get-closure-code | |
| help | Minimal information about Scheme |
| if | Conditional branching |
| integer? | Is an integer |
| lambda | Function |
| lcm | Least common multiple |
| length | Gives length of a list |
| let | Declare local variables |
| let* | Declare local variables sequentially |
| letrec | Declare local variables, allowing recursive definitions |
| list | Create a list |
| list-ref | Gives Nth element of a list |
| list-tail | Drops the first k elements of a list |
| loctyp | Evaluates type of a Sib-pair locus |
| ls | List Sib-pair variables |
| macro | |
| make-string | Create a string of given length |
| map | Apply a function to each element of a list in turn |
| max | Maximum of arguments |
| member | Test if present in a list |
| memq | Test if present in a list using equal? |
| memv | Test if present in a list using eqv? |
| min | Minimum of arguments |
| modulo | Give modulo |
| negative? | Test if negative integer |
| newline | Print a newline |
| new-segment | Memory allocation chunk size |
| not | Logical negation |
| null? | Test if a null |
| number? | Test if an integer number |
| number->string | Convert from number to string |
| odd? | Test if odd |
| open-input-file | Open an input stream (port) |
| or | Logical or |
| pair? | Test if a Lisp pair |
| positive? | Test if a positive integer |
| procedure? | Is a function? |
| quasiquote | |
| quit | Leave the Scheme interpreter |
| quote | Quoted expression left unevaluated |
| quotient | Integer division |
| random | A random integer from U(1, N) |
| read | Read an Scheme object from input |
| remainder | Remainder |
| reverse | Reverse ordering of a list |
| run | Run 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 |
| sqrt | Integer square root |
| string? | Is argument a string? |
| string-append | Concatenate strings |
| string-length | Length of argument string |
| string-set! | Set the value of a substring |
| string->number | Convert from a string to a number |
| string->symbol | Convert from a string to a symbol |
| substring | Get the value of a substring |
| string-split | Convert 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->string | Convert from a symbol to a string |
| system | Passes commands to the operating system |
| unquote | |
| unquote-splicing | |
| write | Write a Scheme object |
| zero? | Test if equal to zero |
| << (let) | Up to index | >> (loop) |