Re: Anyone heard of Bee Lisp?
- From: refun <refun@xxxxxxxxxxxxxx>
- Date: Tue, 16 Mar 2010 15:40:19 +0000 (UTC)
In article <hno5pt$lqo$1@xxxxxxxxxxxxxxxxxxxxxxxxxx>, refun@xxxxxxxxxxxxxx
I was a bit bored, so I took a quick look at the documentation. Here is a
complete listing of all functions/special forms:
CAR/CDR/CONS - seems to work on lists instead of cons cells. The documentation
seems to allude that a list might not be built out of CONSes, but it's actually
an array of pointers to objects. Testing (CONS 1 2) in the REPL seems to
generate a list of 2 elements (1 and 2).
READ - seems to either read something from the console or from a string and
coerce it into a list.
QUOTE - Prevents evaluation of the parameter. Strangely, typing random things
which can't be evaluated at the REPL seems to just return them as if quoted..
EVAL - The usual meaning, evaluates an object/quoted list.
PRINT - Prints an object. Strings seem to come with some standard C-like escape
sequences (\n \r \t \\ \")
SETF - I'll quote from manual:
Sets value of object VAL to the value of object ID. If ID is identifier, thenfunction will search for the object with that name, going up through the stack
to higher addresses memory block, where global variables defined. If such an
object is found, its value will be changed to VAL. If such an object doesn?t
exist, then it will be created in local memory of current function. If ID is
list, then it will be evaluated, and assignment will be made to that evaluation
LET - Misleading name. It's actually an assignment operator:
Sets value of object VAL to the value of object ID. If such an object is foundon the local stack frame, its value will be changed to VAL. If such an object
doesn?t exist, then it will be created in local memory of current function. If
ID is list, then it will be evaluated, and assignment will be made to that
Example:list to 5.
(LET myvar ?(3 4 5)) ; assign list to ?myvar? atom
(LET (CAR myvar) 5) ; replace the first element of ?myvar?
DEFUN/DEFBIN/DEFMACRO - Defines a global function, DEFBIN seems to define a
callback (arranges for the executable to have an export with that name that
calls the interpreter). DEFMACRO seems* to make the function inlined.
STRREAD - reads a string from the console
AND/OR - logical and/or, not short circuiting!
NOT - logical not
PLUS/MINUS/DIV/MUL - integer operations
LESS/MORE - comparsion functions
AREF - Returns nth character in a string or nth element in a list
LEN/LENGTH - List or string length
STRCAT - Concatenates strings.
LOOP - C while loop equivalent.
IDIV/IMUL/MOD - Unlike DIV and MUL, these only take 2 arguments.
MALLOC/FREE - Allocate/free a block of memory.
read/write to logical memory of the application. Will work with any memory
pointer it seems, but I suspect they're meant to be used with malloc/free.
CALL - calls a pointer.
CALLAPI - Resolves and calls a Win32 API or DLL function.
S - Quote from documentation:
Converts A to string and forbids automatic type conversion for resultingobject.
(CALLAPI "MessageBoxA" "User32.dll" 0 "Hello World" "12" 0) ; error! 12 is passed as number
(SETF str (S ?12?) )
(CALLAPI "MessageBoxA" "User32.dll" 0 "Hello World" str 0)
FREECONSOLE - "Detaches console from the process"
UNTYPED - "Cancels automatic type conversion for resulting object."
CHR - "Returns string, consisting of object A, which represents symbol ASCII
ORD - "Returns ASCII code of first symbol of string S."
HEX - "Returns hexadecimal number represented by string S."
EXIT - Returns a value from a function.
EXITBLOCK - Returns from a block of code if the passed expression is true.
JMP - "Jumps to k-th function within current block and continue successive
JMPREL - "Jumps to k-th function relative to the current one within current
block and continue successive execution. Zero means next instruction."
CJMP/CJMPREL - Like JMP, but relative. The semantics of these functions are a
mystery to me.
$EVAL_ERROR$ - A global variable which contains the current evaluation error.
GET-PROGRAM-CODE - "Returns program code"
GET-PROGRAM-MEMORY - "Returns virtual machine memory (as object list)"
Other functions/special forms:
* - The documentation is not perfectly clear about the exact semantics of many
such forms, for example, the only line in the DEFMACRO's documentation is:
Defines marco and returns its body. Unlike function, macro body is inserted inplace of its call.
(DEFMACRO println (text)
This seems considerably more low-level than I expected.
- Prev by Date: Re: A pascal generator in CL ?
- Next by Date: Re: lightweight database
- Previous by thread: Re: Anyone heard of Bee Lisp?
- Next by thread: Re: Anyone heard of Bee Lisp?