| Portability | portable |
|---|---|
| Stability | experimental |
| Maintainer | github.com/justinethier |
Language.Scheme.Primitives
Contents
Description
This module contains primitive functions written in Haskell. Most of these map directly to an equivalent Scheme function.
- car :: [LispVal] -> ThrowsError LispVal
- cdr :: [LispVal] -> ThrowsError LispVal
- cons :: [LispVal] -> ThrowsError LispVal
- equal :: [LispVal] -> ThrowsError LispVal
- buildVector :: [LispVal] -> ThrowsError LispVal
- vectorLength :: [LispVal] -> ThrowsError LispVal
- vectorRef :: [LispVal] -> ThrowsError LispVal
- vectorToList :: [LispVal] -> ThrowsError LispVal
- listToVector :: [LispVal] -> ThrowsError LispVal
- makeVector :: [LispVal] -> ThrowsError LispVal
- hashTblExists :: [LispVal] -> ThrowsError LispVal
- hashTblRef :: [LispVal] -> ThrowsError LispVal
- hashTblSize :: [LispVal] -> ThrowsError LispVal
- hashTbl2List :: [LispVal] -> ThrowsError LispVal
- hashTblKeys :: [LispVal] -> ThrowsError LispVal
- hashTblValues :: [LispVal] -> ThrowsError LispVal
- hashTblCopy :: [LispVal] -> ThrowsError LispVal
- hashTblMake :: [LispVal] -> ThrowsError LispVal
- buildString :: [LispVal] -> ThrowsError LispVal
- makeString :: [LispVal] -> ThrowsError LispVal
- doMakeString :: forall a. (Num a, Eq a) => a -> Char -> String -> LispVal
- stringLength :: [LispVal] -> ThrowsError LispVal
- stringRef :: [LispVal] -> ThrowsError LispVal
- substring :: [LispVal] -> ThrowsError LispVal
- stringCIEquals :: [LispVal] -> ThrowsError LispVal
- stringCIBoolBinop :: ([Char] -> [Char] -> Bool) -> [LispVal] -> ThrowsError LispVal
- stringAppend :: [LispVal] -> ThrowsError LispVal
- stringToNumber :: [LispVal] -> ThrowsError LispVal
- stringToList :: [LispVal] -> ThrowsError LispVal
- listToString :: [LispVal] -> ThrowsError LispVal
- stringCopy :: [LispVal] -> ThrowsError LispVal
- symbol2String :: [LispVal] -> ThrowsError LispVal
- string2Symbol :: [LispVal] -> ThrowsError LispVal
- charCIBoolBinop :: (Char -> Char -> Bool) -> [LispVal] -> ThrowsError LispVal
- charPredicate :: (Char -> Bool) -> [LispVal] -> ThrowsError LispVal
- charUpper :: [LispVal] -> ThrowsError LispVal
- charLower :: [LispVal] -> ThrowsError LispVal
- char2Int :: [LispVal] -> ThrowsError LispVal
- int2Char :: [LispVal] -> ThrowsError LispVal
- isHashTbl :: [LispVal] -> ThrowsError LispVal
- isChar :: [LispVal] -> ThrowsError LispVal
- isString :: [LispVal] -> ThrowsError LispVal
- isBoolean :: [LispVal] -> ThrowsError LispVal
- isDottedList :: [LispVal] -> ThrowsError LispVal
- isProcedure :: [LispVal] -> ThrowsError LispVal
- isList :: LispVal -> ThrowsError LispVal
- isVector :: LispVal -> ThrowsError LispVal
- isNull :: [LispVal] -> ThrowsError LispVal
- isEOFObject :: [LispVal] -> ThrowsError LispVal
- isSymbol :: [LispVal] -> ThrowsError LispVal
- unpackEquals :: LispVal -> LispVal -> Unpacker -> ThrowsError Bool
- boolBinop :: (LispVal -> ThrowsError a) -> (a -> a -> Bool) -> [LispVal] -> ThrowsError LispVal
- unaryOp :: (LispVal -> ThrowsError LispVal) -> [LispVal] -> ThrowsError LispVal
- strBoolBinop :: (String -> String -> Bool) -> [LispVal] -> ThrowsError LispVal
- charBoolBinop :: (Char -> Char -> Bool) -> [LispVal] -> ThrowsError LispVal
- boolBoolBinop :: (Bool -> Bool -> Bool) -> [LispVal] -> ThrowsError LispVal
- unpackStr :: LispVal -> ThrowsError String
- unpackBool :: LispVal -> ThrowsError Bool
- makePort :: IOMode -> [LispVal] -> IOThrowsError LispVal
- closePort :: [LispVal] -> IOThrowsError LispVal
- currentOutputPort :: [LispVal] -> IOThrowsError LispVal
- currentInputPort :: [LispVal] -> IOThrowsError LispVal
- isOutputPort :: [LispVal] -> IOThrowsError LispVal
- isInputPort :: [LispVal] -> IOThrowsError LispVal
- isCharReady :: [LispVal] -> IOThrowsError LispVal
- readProc :: [LispVal] -> IOThrowsError LispVal
- readCharProc :: (Handle -> IO Char) -> [LispVal] -> IOThrowsError LispVal
- writeProc :: (MonadError LispError m, MonadIO m) => (Handle -> LispVal -> IO a) -> [LispVal] -> m LispVal
- writeCharProc :: [LispVal] -> IOThrowsError LispVal
- readContents :: [LispVal] -> IOThrowsError LispVal
- load :: String -> IOThrowsError [LispVal]
- readAll :: [LispVal] -> IOThrowsError LispVal
- fileExists :: [LispVal] -> IOThrowsError LispVal
- deleteFile :: [LispVal] -> IOThrowsError LispVal
- gensym :: [LispVal] -> IOThrowsError LispVal
- _gensym :: String -> IOThrowsError LispVal
Pure functions
List
car :: [LispVal] -> ThrowsError LispVal
cdr :: [LispVal] -> ThrowsError LispVal
cons :: [LispVal] -> ThrowsError LispVal
equal :: [LispVal] -> ThrowsError LispVal
Vector
buildVector :: [LispVal] -> ThrowsError LispVal
vectorLength :: [LispVal] -> ThrowsError LispVal
vectorRef :: [LispVal] -> ThrowsError LispVal
vectorToList :: [LispVal] -> ThrowsError LispVal
listToVector :: [LispVal] -> ThrowsError LispVal
makeVector :: [LispVal] -> ThrowsError LispVal
Hash Table
hashTblExists :: [LispVal] -> ThrowsError LispVal
hashTblRef :: [LispVal] -> ThrowsError LispVal
hashTblSize :: [LispVal] -> ThrowsError LispVal
hashTbl2List :: [LispVal] -> ThrowsError LispVal
hashTblKeys :: [LispVal] -> ThrowsError LispVal
hashTblValues :: [LispVal] -> ThrowsError LispVal
hashTblCopy :: [LispVal] -> ThrowsError LispVal
hashTblMake :: [LispVal] -> ThrowsError LispVal
String
buildString :: [LispVal] -> ThrowsError LispVal
makeString :: [LispVal] -> ThrowsError LispVal
stringLength :: [LispVal] -> ThrowsError LispVal
stringRef :: [LispVal] -> ThrowsError LispVal
substring :: [LispVal] -> ThrowsError LispVal
stringCIEquals :: [LispVal] -> ThrowsError LispVal
stringCIBoolBinop :: ([Char] -> [Char] -> Bool) -> [LispVal] -> ThrowsError LispVal
stringAppend :: [LispVal] -> ThrowsError LispVal
stringToNumber :: [LispVal] -> ThrowsError LispVal
stringToList :: [LispVal] -> ThrowsError LispVal
listToString :: [LispVal] -> ThrowsError LispVal
stringCopy :: [LispVal] -> ThrowsError LispVal
symbol2String :: [LispVal] -> ThrowsError LispVal
string2Symbol :: [LispVal] -> ThrowsError LispVal
Character
charCIBoolBinop :: (Char -> Char -> Bool) -> [LispVal] -> ThrowsError LispVal
charPredicate :: (Char -> Bool) -> [LispVal] -> ThrowsError LispVal
Determine if given character satisfies the given predicate
charUpper :: [LispVal] -> ThrowsError LispVal
charLower :: [LispVal] -> ThrowsError LispVal
char2Int :: [LispVal] -> ThrowsError LispVal
int2Char :: [LispVal] -> ThrowsError LispVal
Predicate
isHashTbl :: [LispVal] -> ThrowsError LispVal
isChar :: [LispVal] -> ThrowsError LispVal
isString :: [LispVal] -> ThrowsError LispVal
isBoolean :: [LispVal] -> ThrowsError LispVal
isDottedList :: [LispVal] -> ThrowsError LispVal
isProcedure :: [LispVal] -> ThrowsError LispVal
isList :: LispVal -> ThrowsError LispVal
isVector :: LispVal -> ThrowsError LispVal
isNull :: [LispVal] -> ThrowsError LispVal
isEOFObject :: [LispVal] -> ThrowsError LispVal
isSymbol :: [LispVal] -> ThrowsError LispVal
Utility functions
unpackEquals :: LispVal -> LispVal -> Unpacker -> ThrowsError Bool
boolBinop :: (LispVal -> ThrowsError a) -> (a -> a -> Bool) -> [LispVal] -> ThrowsError LispVal
unaryOp :: (LispVal -> ThrowsError LispVal) -> [LispVal] -> ThrowsError LispVal
strBoolBinop :: (String -> String -> Bool) -> [LispVal] -> ThrowsError LispVal
charBoolBinop :: (Char -> Char -> Bool) -> [LispVal] -> ThrowsError LispVal
boolBoolBinop :: (Bool -> Bool -> Bool) -> [LispVal] -> ThrowsError LispVal
unpackStr :: LispVal -> ThrowsError String
unpackBool :: LispVal -> ThrowsError Bool
Impure functions
All of these functions must be executed within the IO monad.
Input / Output
makePort :: IOMode -> [LispVal] -> IOThrowsError LispVal
closePort :: [LispVal] -> IOThrowsError LispVal
currentOutputPort :: [LispVal] -> IOThrowsError LispVal
currentInputPort :: [LispVal] -> IOThrowsError LispVal
isOutputPort :: [LispVal] -> IOThrowsError LispVal
isInputPort :: [LispVal] -> IOThrowsError LispVal
isCharReady :: [LispVal] -> IOThrowsError LispVal
readProc :: [LispVal] -> IOThrowsError LispVal
readCharProc :: (Handle -> IO Char) -> [LispVal] -> IOThrowsError LispVal
writeProc :: (MonadError LispError m, MonadIO m) => (Handle -> LispVal -> IO a) -> [LispVal] -> m LispVal
writeCharProc :: [LispVal] -> IOThrowsError LispVal
readContents :: [LispVal] -> IOThrowsError LispVal
load :: String -> IOThrowsError [LispVal]
readAll :: [LispVal] -> IOThrowsError LispVal
fileExists :: [LispVal] -> IOThrowsError LispVal
deleteFile :: [LispVal] -> IOThrowsError LispVal
Symbol generation
gensym :: [LispVal] -> IOThrowsError LispVal
Generate a (reasonably) unique symbol, given an optional prefix. This function is provided even though it is not part of R5RS.
_gensym :: String -> IOThrowsError LispVal
Version of gensym that can be conveniently called from Haskell.