java.lang.Object
com.memoire.silk.SilkSchemeUtils
com.memoire.silk.SilkProcedure
com.memoire.silk.SilkPrimitive
- public class SilkPrimitive
- extends SilkProcedure
A primitive is a procedure that is defined as part of the SilkScheme report,
and is implemented in Java code.
|
Constructor Summary |
SilkPrimitive(int id,
int minArgs,
int maxArgs)
|
|
Method Summary |
(package private) static java.lang.Object |
append(java.lang.Object args)
|
(package private) static java.lang.Object |
append2(java.lang.Object x,
java.lang.Object y)
|
java.lang.Object |
apply(SilkScheme interp,
java.lang.Object args)
Apply a primitive to a list of arguments. |
static int |
charCompare(java.lang.Object x,
java.lang.Object y,
boolean ci)
Return <0 if x is alphabetically first, >0 if y is first,
0 if same. |
(package private) static java.lang.Object |
gcd(java.lang.Object args)
|
(package private) static long |
gcd2(long a,
long b)
|
static SilkEnvironment |
installSilkPrimitives(SilkEnvironment env)
|
(package private) static boolean |
isExact(java.lang.Object x)
|
(package private) static boolean |
isList(java.lang.Object x)
|
(package private) static java.lang.Object |
lcm(java.lang.Object args)
|
(package private) static SilkPair |
map(SilkProcedure proc,
java.lang.Object args,
SilkScheme interp,
SilkPair result)
Map proc over a list of lists of args, in the given interpreter. |
static java.lang.Object |
memberAssoc(java.lang.Object obj,
java.lang.Object list,
char m,
char eq)
|
(package private) static java.lang.Object |
numberToString(java.lang.Object x,
java.lang.Object y)
|
static java.lang.Object |
numCompare(java.lang.Object args,
char op)
|
static java.lang.Object |
numCompute(java.lang.Object args,
char op,
double result)
|
(package private) static SilkInputPort |
openInputFile(java.lang.Object filename)
|
(package private) static java.io.PrintWriter |
openOutputFile(java.lang.Object filename)
|
(package private) static int |
sign(int x)
Return the sign of the argument: +1, -1, or 0. |
static char[] |
stringAppend(java.lang.Object args)
|
static int |
stringCompare(java.lang.Object x,
java.lang.Object y,
boolean ci)
Return <0 if x is alphabetically first, >0 if y is first,
0 if same. |
(package private) static java.lang.Object |
stringToNumber(java.lang.Object x,
java.lang.Object y)
|
| Methods inherited from class com.memoire.silk.SilkSchemeUtils |
chr, chr, cons, equal, eqv, error, first, inPort, length, list, list, listStar, listToString, listToVector, num, num, outPort, p, p, rest, reverse, second, setFirst, setRest, str, stringify, stringify, stringify, sym, third, truth, truth, vec, vectorToList, warn, write |
minArgs
int minArgs
maxArgs
int maxArgs
idNumber
int idNumber
EQ
private static final int EQ
- See Also:
- Constant Field Values
LT
private static final int LT
- See Also:
- Constant Field Values
GT
private static final int GT
- See Also:
- Constant Field Values
GE
private static final int GE
- See Also:
- Constant Field Values
LE
private static final int LE
- See Also:
- Constant Field Values
ABS
private static final int ABS
- See Also:
- Constant Field Values
EOF_OBJECT
private static final int EOF_OBJECT
- See Also:
- Constant Field Values
EQQ
private static final int EQQ
- See Also:
- Constant Field Values
EQUALQ
private static final int EQUALQ
- See Also:
- Constant Field Values
FORCE
private static final int FORCE
- See Also:
- Constant Field Values
CAR
private static final int CAR
- See Also:
- Constant Field Values
FLOOR
private static final int FLOOR
- See Also:
- Constant Field Values
CEILING
private static final int CEILING
- See Also:
- Constant Field Values
CONS
private static final int CONS
- See Also:
- Constant Field Values
DIVIDE
private static final int DIVIDE
- See Also:
- Constant Field Values
LENGTH
private static final int LENGTH
- See Also:
- Constant Field Values
LIST
private static final int LIST
- See Also:
- Constant Field Values
LISTQ
private static final int LISTQ
- See Also:
- Constant Field Values
APPLY
private static final int APPLY
- See Also:
- Constant Field Values
MAX
private static final int MAX
- See Also:
- Constant Field Values
MIN
private static final int MIN
- See Also:
- Constant Field Values
MINUS
private static final int MINUS
- See Also:
- Constant Field Values
NEWLINE
private static final int NEWLINE
- See Also:
- Constant Field Values
NOT
private static final int NOT
- See Also:
- Constant Field Values
NULLQ
private static final int NULLQ
- See Also:
- Constant Field Values
NUMBERQ
private static final int NUMBERQ
- See Also:
- Constant Field Values
PAIRQ
private static final int PAIRQ
- See Also:
- Constant Field Values
PLUS
private static final int PLUS
- See Also:
- Constant Field Values
PROCEDUREQ
private static final int PROCEDUREQ
- See Also:
- Constant Field Values
READ
private static final int READ
- See Also:
- Constant Field Values
CDR
private static final int CDR
- See Also:
- Constant Field Values
ROUND
private static final int ROUND
- See Also:
- Constant Field Values
SECOND
private static final int SECOND
- See Also:
- Constant Field Values
SYMBOLQ
private static final int SYMBOLQ
- See Also:
- Constant Field Values
TIMES
private static final int TIMES
- See Also:
- Constant Field Values
TRUNCATE
private static final int TRUNCATE
- See Also:
- Constant Field Values
WRITE
private static final int WRITE
- See Also:
- Constant Field Values
APPEND
private static final int APPEND
- See Also:
- Constant Field Values
BOOLEANQ
private static final int BOOLEANQ
- See Also:
- Constant Field Values
SQRT
private static final int SQRT
- See Also:
- Constant Field Values
EXPT
private static final int EXPT
- See Also:
- Constant Field Values
REVERSE
private static final int REVERSE
- See Also:
- Constant Field Values
ASSOC
private static final int ASSOC
- See Also:
- Constant Field Values
ASSQ
private static final int ASSQ
- See Also:
- Constant Field Values
ASSV
private static final int ASSV
- See Also:
- Constant Field Values
MEMBER
private static final int MEMBER
- See Also:
- Constant Field Values
MEMQ
private static final int MEMQ
- See Also:
- Constant Field Values
MEMV
private static final int MEMV
- See Also:
- Constant Field Values
EQVQ
private static final int EQVQ
- See Also:
- Constant Field Values
LISTREF
private static final int LISTREF
- See Also:
- Constant Field Values
LISTTAIL
private static final int LISTTAIL
- See Also:
- Constant Field Values
STRINQ
private static final int STRINQ
- See Also:
- Constant Field Values
MAKESTRING
private static final int MAKESTRING
- See Also:
- Constant Field Values
STRING
private static final int STRING
- See Also:
- Constant Field Values
STRINGLENGTH
private static final int STRINGLENGTH
- See Also:
- Constant Field Values
STRINGREF
private static final int STRINGREF
- See Also:
- Constant Field Values
STRINGSET
private static final int STRINGSET
- See Also:
- Constant Field Values
SUBSTRING
private static final int SUBSTRING
- See Also:
- Constant Field Values
STRINGAPPEND
private static final int STRINGAPPEND
- See Also:
- Constant Field Values
STRINGTOLIST
private static final int STRINGTOLIST
- See Also:
- Constant Field Values
LISTTOSTRING
private static final int LISTTOSTRING
- See Also:
- Constant Field Values
SYMBOLTOSTRING
private static final int SYMBOLTOSTRING
- See Also:
- Constant Field Values
STRINGTOSYMBOL
private static final int STRINGTOSYMBOL
- See Also:
- Constant Field Values
EXP
private static final int EXP
- See Also:
- Constant Field Values
LOG
private static final int LOG
- See Also:
- Constant Field Values
SIN
private static final int SIN
- See Also:
- Constant Field Values
COS
private static final int COS
- See Also:
- Constant Field Values
TAN
private static final int TAN
- See Also:
- Constant Field Values
ACOS
private static final int ACOS
- See Also:
- Constant Field Values
ASIN
private static final int ASIN
- See Also:
- Constant Field Values
ATAN
private static final int ATAN
- See Also:
- Constant Field Values
NUMBERTOSTRING
private static final int NUMBERTOSTRING
- See Also:
- Constant Field Values
STRINGTONUMBER
private static final int STRINGTONUMBER
- See Also:
- Constant Field Values
CHARQ
private static final int CHARQ
- See Also:
- Constant Field Values
CHARALPHABETICQ
private static final int CHARALPHABETICQ
- See Also:
- Constant Field Values
CHARNUMERICQ
private static final int CHARNUMERICQ
- See Also:
- Constant Field Values
CHARWHITESPACEQ
private static final int CHARWHITESPACEQ
- See Also:
- Constant Field Values
CHARUPPERCASEQ
private static final int CHARUPPERCASEQ
- See Also:
- Constant Field Values
CHARLOWERCASEQ
private static final int CHARLOWERCASEQ
- See Also:
- Constant Field Values
CHARTOINTEGER
private static final int CHARTOINTEGER
- See Also:
- Constant Field Values
INTEGERTOCHAR
private static final int INTEGERTOCHAR
- See Also:
- Constant Field Values
CHARUPCASE
private static final int CHARUPCASE
- See Also:
- Constant Field Values
CHARDOWNCASE
private static final int CHARDOWNCASE
- See Also:
- Constant Field Values
STRINGQ
private static final int STRINGQ
- See Also:
- Constant Field Values
VECTORQ
private static final int VECTORQ
- See Also:
- Constant Field Values
MAKEVECTOR
private static final int MAKEVECTOR
- See Also:
- Constant Field Values
VECTOR
private static final int VECTOR
- See Also:
- Constant Field Values
VECTORLENGTH
private static final int VECTORLENGTH
- See Also:
- Constant Field Values
VECTORREF
private static final int VECTORREF
- See Also:
- Constant Field Values
VECTORSET
private static final int VECTORSET
- See Also:
- Constant Field Values
LISTTOVECTOR
private static final int LISTTOVECTOR
- See Also:
- Constant Field Values
MAP
private static final int MAP
- See Also:
- Constant Field Values
FOREACH
private static final int FOREACH
- See Also:
- Constant Field Values
CALLCC
private static final int CALLCC
- See Also:
- Constant Field Values
VECTORTOLIST
private static final int VECTORTOLIST
- See Also:
- Constant Field Values
LOAD
private static final int LOAD
- See Also:
- Constant Field Values
DISPLAY
private static final int DISPLAY
- See Also:
- Constant Field Values
INPUTPORTQ
private static final int INPUTPORTQ
- See Also:
- Constant Field Values
CURRENTINPUTPORT
private static final int CURRENTINPUTPORT
- See Also:
- Constant Field Values
OPENINPUTFILE
private static final int OPENINPUTFILE
- See Also:
- Constant Field Values
CLOSEINPUTPORT
private static final int CLOSEINPUTPORT
- See Also:
- Constant Field Values
OUTPUTPORTQ
private static final int OUTPUTPORTQ
- See Also:
- Constant Field Values
CURRENTOUTPUTPORT
private static final int CURRENTOUTPUTPORT
- See Also:
- Constant Field Values
OPENOUTPUTFILE
private static final int OPENOUTPUTFILE
- See Also:
- Constant Field Values
CLOSEOUTPUTPORT
private static final int CLOSEOUTPUTPORT
- See Also:
- Constant Field Values
READCHAR
private static final int READCHAR
- See Also:
- Constant Field Values
PEEKCHAR
private static final int PEEKCHAR
- See Also:
- Constant Field Values
EVAL
private static final int EVAL
- See Also:
- Constant Field Values
QUOTIENT
private static final int QUOTIENT
- See Also:
- Constant Field Values
REMAINDER
private static final int REMAINDER
- See Also:
- Constant Field Values
MODULO
private static final int MODULO
- See Also:
- Constant Field Values
THIRD
private static final int THIRD
- See Also:
- Constant Field Values
EOFOBJECTQ
private static final int EOFOBJECTQ
- See Also:
- Constant Field Values
GCD
private static final int GCD
- See Also:
- Constant Field Values
LCM
private static final int LCM
- See Also:
- Constant Field Values
CXR
private static final int CXR
- See Also:
- Constant Field Values
ODDQ
private static final int ODDQ
- See Also:
- Constant Field Values
EVENQ
private static final int EVENQ
- See Also:
- Constant Field Values
ZEROQ
private static final int ZEROQ
- See Also:
- Constant Field Values
POSITIVEQ
private static final int POSITIVEQ
- See Also:
- Constant Field Values
NEGATIVEQ
private static final int NEGATIVEQ
- See Also:
- Constant Field Values
CHARCMP
private static final int CHARCMP
- See Also:
- Constant Field Values
CHARCICMP
private static final int CHARCICMP
- See Also:
- Constant Field Values
STRINGCMP
private static final int STRINGCMP
- See Also:
- Constant Field Values
STRINGCICMP
private static final int STRINGCICMP
- See Also:
- Constant Field Values
EXACTQ
private static final int EXACTQ
- See Also:
- Constant Field Values
INEXACTQ
private static final int INEXACTQ
- See Also:
- Constant Field Values
INTEGERQ
private static final int INTEGERQ
- See Also:
- Constant Field Values
CALLWITHINPUTFILE
private static final int CALLWITHINPUTFILE
- See Also:
- Constant Field Values
CALLWITHOUTPUTFILE
private static final int CALLWITHOUTPUTFILE
- See Also:
- Constant Field Values
NEW
static final int NEW
- See Also:
- Constant Field Values
CLASS
static final int CLASS
- See Also:
- Constant Field Values
METHOD
static final int METHOD
- See Also:
- Constant Field Values
EXIT
static final int EXIT
- See Also:
- Constant Field Values
SETCAR
static final int SETCAR
- See Also:
- Constant Field Values
SETCDR
static final int SETCDR
- See Also:
- Constant Field Values
TIMECALL
static final int TIMECALL
- See Also:
- Constant Field Values
MACROEXPAND
static final int MACROEXPAND
- See Also:
- Constant Field Values
ERROR
static final int ERROR
- See Also:
- Constant Field Values
LISTSTAR
static final int LISTSTAR
- See Also:
- Constant Field Values
SilkPrimitive
public SilkPrimitive(int id,
int minArgs,
int maxArgs)
installSilkPrimitives
public static SilkEnvironment installSilkPrimitives(SilkEnvironment env)
apply
public java.lang.Object apply(SilkScheme interp,
java.lang.Object args)
- Apply a primitive to a list of arguments.
- Specified by:
apply in class SilkProcedure
stringAppend
public static char[] stringAppend(java.lang.Object args)
memberAssoc
public static java.lang.Object memberAssoc(java.lang.Object obj,
java.lang.Object list,
char m,
char eq)
numCompare
public static java.lang.Object numCompare(java.lang.Object args,
char op)
numCompute
public static java.lang.Object numCompute(java.lang.Object args,
char op,
double result)
sign
static int sign(int x)
- Return the sign of the argument: +1, -1, or 0.
charCompare
public static int charCompare(java.lang.Object x,
java.lang.Object y,
boolean ci)
- Return <0 if x is alphabetically first, >0 if y is first,
0 if same. Case insensitive iff ci is true. Error if not both chars.
stringCompare
public static int stringCompare(java.lang.Object x,
java.lang.Object y,
boolean ci)
- Return <0 if x is alphabetically first, >0 if y is first,
0 if same. Case insensitive iff ci is true. Error if not strings.
numberToString
static java.lang.Object numberToString(java.lang.Object x,
java.lang.Object y)
stringToNumber
static java.lang.Object stringToNumber(java.lang.Object x,
java.lang.Object y)
gcd
static java.lang.Object gcd(java.lang.Object args)
gcd2
static long gcd2(long a,
long b)
lcm
static java.lang.Object lcm(java.lang.Object args)
isExact
static boolean isExact(java.lang.Object x)
openOutputFile
static java.io.PrintWriter openOutputFile(java.lang.Object filename)
openInputFile
static SilkInputPort openInputFile(java.lang.Object filename)
isList
static boolean isList(java.lang.Object x)
append
static java.lang.Object append(java.lang.Object args)
append2
static java.lang.Object append2(java.lang.Object x,
java.lang.Object y)
map
static SilkPair map(SilkProcedure proc,
java.lang.Object args,
SilkScheme interp,
SilkPair result)
- Map proc over a list of lists of args, in the given interpreter.
If result is non-null, accumulate the results of each call there
and return that at the end. Otherwise, just return null.