Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class silk.SchemeUtils

java.lang.Object
    |
    +----silk.SchemeUtils
Subclasses:
Environment, InputPort, Pair, Procedure, Scheme

public abstract class SchemeUtils
extends java.lang.Object

Field Summary
static java.lang.Boolean  FALSE
Same as Boolean.FALSE.
static java.lang.Double  ONE
 
static java.lang.Boolean  TRUE
Same as Boolean.TRUE.
static java.lang.Double  ZERO
 
 

Constructor Summary
 SchemeUtils()
 
 

Method Summary
static char  chr(java.lang.Object x)
Converts a Scheme object to a char, or calls error.
static java.lang.Character  chr(char ch)
Converts a char to a Character.
static Pair  cons(java.lang.Object a, java.lang.Object b)
cons(x, y) is the same as new Pair(x, y).
static boolean  equal(java.lang.Object x, java.lang.Object y)
Check if two objects are equal.
static boolean  eqv(java.lang.Object x, java.lang.Object y)
Check if two objects are == or are equal numbers or characters.
static java.lang.Object  error(java.lang.String message)
A continuable error.
static java.lang.Object  first(java.lang.Object x)
Like Common Lisp first; car of a Pair, or null for anything else.
static InputPort  inPort(java.lang.Object x, Scheme interp)
Coerces a Scheme object to a Scheme input port, which is an InputPort.
static int  length(java.lang.Object x)
The length of a list, or zero for a non-list.
static Pair  list(java.lang.Object a, java.lang.Object b)
Creates a two element list.
static Pair  list(java.lang.Object a)
Creates a one element list.
static java.lang.Object  listStar(java.lang.Object args)
listStar(args) is like Common Lisp (apply #'list* args)
static char[]  listToString(java.lang.Object chars)
Convert a list of characters to a Scheme string, which is a char[].
static java.lang.Object[]  listToVector(java.lang.Object objs)
Convert a list of Objects to a Scheme vector, which is a Object[].
static java.lang.Double  num(double x)
Convert double to Double.
static double  num(java.lang.Object x)
Converts a Scheme object to a double, or calls error.
static java.io.PrintWriter  outPort(java.lang.Object x, Scheme interp)
Coerces a Scheme object to a Scheme input port, which is a PrintWriter.
static java.lang.Object  rest(java.lang.Object x)
Like Common Lisp rest; car of a Pair, or null for anything else.
static java.lang.Object  reverse(java.lang.Object x)
Reverse the elements of a list.
static java.lang.Object  second(java.lang.Object x)
Like Common Lisp second.
static java.lang.Object  setFirst(java.lang.Object x, java.lang.Object y)
Like Common Lisp (setf (first ...
static java.lang.Object  setRest(java.lang.Object x, java.lang.Object y)
Like Common Lisp (setf (rest ...
static char[]  str(java.lang.Object x)
Coerces a Scheme object to a Scheme string, which is a char[].
static java.lang.String  sym(java.lang.Object x)
Coerces a Scheme object to a Scheme symbol, which is a string.
static java.lang.Object  third(java.lang.Object x)
Like Common Lisp third.
static java.lang.Boolean  truth(boolean x)
Convert boolean to Boolean.
static boolean  truth(java.lang.Object x)
Convert Scheme object to boolean.
static java.lang.Object[]  vec(java.lang.Object x)
Coerces a Scheme object to a Scheme vector, which is a Object[].
static Pair  vectorToList(java.lang.Object x)
Convert a vector to a List.
static java.lang.Object  warn(java.lang.String message)
 
static java.lang.Object  write(java.lang.Object x, java.io.PrintWriter port, boolean quoted)
Write the object to a port.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final java.lang.Boolean TRUE
Same as Boolean.TRUE.

FALSE

public static final java.lang.Boolean FALSE
Same as Boolean.FALSE.

ZERO

public static java.lang.Double ZERO

ONE

public static java.lang.Double ONE
Constructor Detail

SchemeUtils

public SchemeUtils()
Method Detail

truth

public static java.lang.Boolean truth(boolean x)
Convert boolean to Boolean.

truth

public static boolean truth(java.lang.Object x)
Convert Scheme object to boolean. Only #f is false, others are true.

num

public static java.lang.Double num(double x)
Convert double to Double. Caches 0 and 1; makes new for others.

num

public static double num(java.lang.Object x)
Converts a Scheme object to a double, or calls error.

chr

public static char chr(java.lang.Object x)
Converts a Scheme object to a char, or calls error.

chr

public static java.lang.Character chr(char ch)
Converts a char to a Character.

str

public static char[] str(java.lang.Object x)
Coerces a Scheme object to a Scheme string, which is a char[].

sym

public static java.lang.String sym(java.lang.Object x)
Coerces a Scheme object to a Scheme symbol, which is a string.

vec

public static java.lang.Object[] vec(java.lang.Object x)
Coerces a Scheme object to a Scheme vector, which is a Object[].

inPort

public static InputPort inPort(java.lang.Object x,
                               Scheme interp)
Coerces a Scheme object to a Scheme input port, which is an InputPort. If the argument is null, returns interpreter.input.

outPort

public static java.io.PrintWriter outPort(java.lang.Object x,
                                  Scheme interp)
Coerces a Scheme object to a Scheme input port, which is a PrintWriter. If the argument is null, returns System.out.

error

public static java.lang.Object error(java.lang.String message)
A continuable error. Prints an error message and then prompts for a value to eval and return.

warn

public static java.lang.Object warn(java.lang.String message)

first

public static java.lang.Object first(java.lang.Object x)
Like Common Lisp first; car of a Pair, or null for anything else.

rest

public static java.lang.Object rest(java.lang.Object x)
Like Common Lisp rest; car of a Pair, or null for anything else.

setFirst

public static java.lang.Object setFirst(java.lang.Object x,
                              java.lang.Object y)
Like Common Lisp (setf (first ...

setRest

public static java.lang.Object setRest(java.lang.Object x,
                             java.lang.Object y)
Like Common Lisp (setf (rest ...

second

public static java.lang.Object second(java.lang.Object x)
Like Common Lisp second.

third

public static java.lang.Object third(java.lang.Object x)
Like Common Lisp third.

list

public static Pair list(java.lang.Object a,
                        java.lang.Object b)
Creates a two element list.

list

public static Pair list(java.lang.Object a)
Creates a one element list.

listStar

public static java.lang.Object listStar(java.lang.Object args)
listStar(args) is like Common Lisp (apply #'list* args)

cons

public static Pair cons(java.lang.Object a,
                        java.lang.Object b)
cons(x, y) is the same as new Pair(x, y).

reverse

public static java.lang.Object reverse(java.lang.Object x)
Reverse the elements of a list.

equal

public static boolean equal(java.lang.Object x,
                            java.lang.Object y)
Check if two objects are equal.

eqv

public static boolean eqv(java.lang.Object x,
                          java.lang.Object y)
Check if two objects are == or are equal numbers or characters.

length

public static int length(java.lang.Object x)
The length of a list, or zero for a non-list.

listToString

public static char[] listToString(java.lang.Object chars)
Convert a list of characters to a Scheme string, which is a char[].

listToVector

public static java.lang.Object[] listToVector(java.lang.Object objs)
Convert a list of Objects to a Scheme vector, which is a Object[].

write

public static java.lang.Object write(java.lang.Object x,
                           java.io.PrintWriter port,
                           boolean quoted)
Write the object to a port. If quoted is true, use "str" and #\c, otherwise use str and c.

vectorToList

public static Pair vectorToList(java.lang.Object x)
Convert a vector to a List.

Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS