|
Post Scarcity
A prototype for a post scarcity programming environment
|
Go to the source code of this file.
Functions | |
| struct cons_pointer | c_append (struct cons_pointer l1, struct cons_pointer l2) |
| A version of append which can conveniently be called from C. | |
| struct cons_pointer | c_keys (struct cons_pointer store) |
| struct cons_pointer | c_progn (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer expressions, struct cons_pointer env) |
Evaluate each of these expressions in this environment over this frame, returning only the value of the last. | |
| struct cons_pointer | c_reverse (struct cons_pointer arg) |
| reverse a sequence (if it is a sequence); else return it unchanged. | |
| struct cons_pointer | eval_form (struct stack_frame *parent, struct cons_pointer parent_pointer, struct cons_pointer form, struct cons_pointer env) |
| Useful building block; evaluate this single form in the context of this parent stack frame and this environment. | |
| struct cons_pointer | eval_forms (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer list, struct cons_pointer env) |
eval all the forms in this list in the context of this stack frame and this env, and return a list of their values. | |
| struct cons_pointer | lisp_append (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| should really be overwritten with a version in Lisp, since this is much easier to write in Lisp | |
| struct cons_pointer | lisp_apply (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; apply the function which is the result of evaluating the first argument to the list of values which is the result of evaluating the second argument. | |
| struct cons_pointer | lisp_assoc (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
Function; look up the value of a key in a store. | |
| struct cons_pointer | lisp_car (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; returns the first item (head) of a sequence. | |
| struct cons_pointer | lisp_cdr (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; returns the remainder of a sequence when the head is removed. | |
| struct cons_pointer | lisp_cond (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Special form: conditional. | |
| struct cons_pointer | lisp_cons (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; returns a cell constructed from a and b. | |
| struct cons_pointer | lisp_eq (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; are these two objects the same object? Shallow, cheap equality. | |
| struct cons_pointer | lisp_equal (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; are these two arguments identical? Deep, expensive equality. | |
| struct cons_pointer | lisp_eval (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; evaluate the expression which is the first argument in the frame; further arguments are ignored. | |
| struct cons_pointer | lisp_exception (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; create an exception. | |
| struct cons_pointer | lisp_inspect (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function: dump/inspect one complete lisp expression and return NIL. | |
| struct cons_pointer | lisp_keys (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| struct cons_pointer | lisp_lambda (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Construct an interpretable function. | |
| struct cons_pointer | lisp_length (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function: return, as an integer, the length of the sequence indicated by the first argument, or zero if it is not a sequence. | |
| struct cons_pointer | lisp_let (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Special form: evaluate a series of forms in an environment in which these bindings are bound. | |
| struct cons_pointer | lisp_list (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| struct cons_pointer | lisp_mapcar (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| struct cons_pointer | lisp_nlambda (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Construct an interpretable special form. | |
| struct cons_pointer | lisp_oblist (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Return the object list (root namespace). | |
| struct cons_pointer | lisp_print (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; print one complete lisp expression and return NIL. | |
| struct cons_pointer | lisp_progn (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; evaluate the forms which are listed in my single argument sequentially and return the value of the last. | |
| struct cons_pointer | lisp_quote (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Special form; returns its argument (strictly first argument - only one is expected but this isn't at this stage checked) unevaluated. | |
| struct cons_pointer | lisp_read (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; read one complete lisp form and return it. | |
| struct cons_pointer | lisp_repl (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function: the read/eval/print loop. | |
| struct cons_pointer | lisp_reverse (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function; reverse the order of members in s sequence. | |
| struct cons_pointer | lisp_set (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
Function; binds the value of name in the namespace to value of value, altering the namespace in so doing. | |
| struct cons_pointer | lisp_set_shriek (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
Special form; binds symbol in the namespace to value of value, altering the namespace in so doing, and returns value. | |
| struct cons_pointer | lisp_source (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function. | |
| struct cons_pointer | lisp_try (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
OK, the idea here (and I know this is less than perfect) is that the basic try special form in PSSE takes two arguments, the first, body, being a list of forms, and the second, catch, being a catch handler (which is also a list of forms). | |
| struct cons_pointer | lisp_type (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env) |
| Function: Get the Lisp type of the single argument. | |
| struct cons_pointer | throw_exception (struct cons_pointer message, struct cons_pointer frame_pointer) |
| Throw an exception. | |
Variables | |
| struct cons_pointer | prompt_name |
| lispops.h | |
| struct cons_pointer c_append | ( | struct cons_pointer | l1, |
| struct cons_pointer | l2 | ||
| ) |
A version of append which can conveniently be called from C.
Definition at line 1410 of file lispops.c.
References c_append(), c_car(), c_cdr(), c_string_to_lisp_string(), CONSTV, KEYTV, make_cons(), make_string_like_thing(), NIL, nilp, pointer2cell, STRINGTV, SYMBOLTV, and throw_exception().
Referenced by c_append(), c_assoc(), and lisp_append().
| struct cons_pointer c_keys | ( | struct cons_pointer | store | ) |
Definition at line 840 of file lispops.c.
References c_car(), c_cdr(), consp, hashmap_keys(), hashmapp, make_cons(), NIL, and nilp.
Referenced by lisp_keys(), and lisp_loop().
| struct cons_pointer c_progn | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | expressions, | ||
| struct cons_pointer | env | ||
| ) |
Evaluate each of these expressions in this environment over this frame, returning only the value of the last.
Definition at line 1096 of file lispops.c.
References c_car(), c_cdr(), consp, dec_ref(), eval_form(), exceptionp, inc_ref(), and NIL.
Referenced by lisp_cond(), lisp_progn(), and lisp_try().
| struct cons_pointer c_reverse | ( | struct cons_pointer | arg | ) |
reverse a sequence (if it is a sequence); else return it unchanged.
Definition at line 943 of file lispops.c.
References c_cdr(), CONSTV, make_cons(), make_string(), make_symbol_or_key(), NIL, cons_space_object::payload, pointer2cell, sequencep, STRINGTV, SYMBOLTV, and cons_space_object::tag.
Referenced by eval_forms(), lisp_mapcar(), and lisp_reverse().
| struct cons_pointer eval_form | ( | struct stack_frame * | parent, |
| struct cons_pointer | parent_pointer, | ||
| struct cons_pointer | form, | ||
| struct cons_pointer | env | ||
| ) |
Useful building block; evaluate this single form in the context of this parent stack frame and this environment.
| parent | the parent stack frame. |
| form | the form to be evaluated. |
| env | the evaluation environment. |
Definition at line 64 of file lispops.c.
References stack_frame::args, DEBUG_EVAL, debug_print(), debug_print_object(), debug_println(), dec_ref(), exceptionp, EXCEPTIONTV, FREETV, get_stack_frame(), inc_ref(), INTEGERTV, KEYTV, lisp_eval(), LOOPTV, make_empty_frame(), NILTV, pointer2cell, RATIOTV, READTV, REALTV, set_reg(), STRINGTV, TIMETV, TRUETV, and WRITETV.
Referenced by c_apply(), c_progn(), eval_forms(), eval_lambda(), lisp_cond(), lisp_let(), lisp_mapcar(), lisp_progn(), lisp_repl(), lisp_set_shriek(), make_stack_frame(), and read_map().
| struct cons_pointer eval_forms | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | list, | ||
| struct cons_pointer | env | ||
| ) |
eval all the forms in this list in the context of this stack frame and this env, and return a list of their values.
If the arg passed as list is not in fact a list, return nil.
eval all the forms in this list in the context of this stack frame and this env, and return a list of their values.
If the arg passed as list is not in fact a list, return NIL.
| frame | the stack frame. |
| list | the list of forms to be evaluated. |
| env | the evaluation environment. |
Definition at line 129 of file lispops.c.
References c_car(), c_cdr(), c_reverse(), consp, eval_form(), make_cons(), and NIL.
Referenced by eval_lambda(), and make_stack_frame().
| struct cons_pointer lisp_append | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
should really be overwritten with a version in Lisp, since this is much easier to write in Lisp
Definition at line 1456 of file lispops.c.
References c_append(), and fetch_arg().
Referenced by main().
| struct cons_pointer lisp_apply | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; apply the function which is the result of evaluating the first argument to the list of values which is the result of evaluating the second argument.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment. |
fn to args. Definition at line 564 of file lispops.c.
References c_apply(), debug_dump_object(), DEBUG_EVAL, debug_print(), make_cons(), NIL, and set_reg().
Referenced by main().
| struct cons_pointer lisp_assoc | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; look up the value of a key in a store.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
key in store, or nil if not found. Definition at line 835 of file lispops.c.
References c_assoc().
Referenced by main().
| struct cons_pointer lisp_car | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; returns the first item (head) of a sequence.
Valid for cons cells, strings, read streams and TODO other things which can be considered as sequences.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
expression. | if | `expression` is not a sequence. |
Definition at line 735 of file lispops.c.
References c_string_to_lisp_string(), CONSTV, make_string(), NIL, NILTV, cons_space_object::payload, pointer2cell, READTV, STRINGTV, cons_space_object::tag, throw_exception(), and url_fgetwc().
Referenced by main().
| struct cons_pointer lisp_cdr | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; returns the remainder of a sequence when the head is removed.
Valid for cons cells, strings, read streams and TODO other things which can be considered as sequences. NOTE that if the argument is an input stream, the first character is removed AND DISCARDED.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
expression when the head is removed. | if | `expression` is not a sequence. |
Definition at line 779 of file lispops.c.
References c_string_to_lisp_string(), CONSTV, NIL, NILTV, cons_space_object::payload, pointer2cell, READTV, STRINGTV, cons_space_object::tag, throw_exception(), and url_fgetwc().
Referenced by main().
| struct cons_pointer lisp_cond | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Special form: conditional.
Each arg is expected to be a list; if the first item in such a list evaluates to non-NIL, the remaining items in that list are evaluated in turn and the value of the last returned. If no arg (clause) has a first element which evaluates to non NIL, then NIL is returned.
| frame | My stack frame. |
| env | My environment (ignored). |
Each clause is expected to be a list; if the first item in such a list evaluates to non-NIL, the remaining items in that list are evaluated in turn and the value of the last returned. If no arg clause has a first element which evaluates to non NIL, then NIL is returned.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which arguments will be evaluated. |
clause. Definition at line 1161 of file lispops.c.
References args_in_frame, c_car(), c_cdr(), c_progn(), c_string_to_lisp_string(), consp, debug_dump_object(), DEBUG_EVAL, debug_print(), eval_form(), NIL, nilp, pointer2cell, and throw_exception().
Referenced by main().
| struct cons_pointer lisp_cons | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; returns a cell constructed from a and b.
If a is of type string but its cdr is nill, and b is of type string, then returns a new string cell; otherwise returns a new cons cell.
Thus: (cons "a" "bcd") -> "abcd", but (cons "ab" "cd") -> ("ab" . "cd")
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
car is a and whose cdr is b. Definition at line 702 of file lispops.c.
References c_cdr(), end_of_stringp(), make_cons(), make_string(), NIL, nilp, pointer2cell, and stringp.
Referenced by main().
| struct cons_pointer lisp_eq | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; are these two objects the same object? Shallow, cheap equality.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
t if a and b are pointers to the same object, else nil; Definition at line 870 of file lispops.c.
References eq(), NIL, and TRUE.
Referenced by main().
| struct cons_pointer lisp_equal | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; are these two arguments identical? Deep, expensive equality.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
t if a and b are recursively identical, else nil. Definition at line 887 of file lispops.c.
References equal(), NIL, and TRUE.
Referenced by main().
| struct cons_pointer lisp_eval | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; evaluate the expression which is the first argument in the frame; further arguments are ignored.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment. |
expression is a number, string, nil, or t, returns expression.expression is a symbol, returns the value that expression is bound to in the evaluation environment (env).expression is a list, expects the car to be something that evaluates to a function or special form:expression and passes them in a stack frame as arguments to the function;| if | `expression` is a symbol which is not bound in `env`. |
Definition at line 504 of file lispops.c.
References c_apply(), c_assoc(), c_string_to_lisp_string(), CONSTV, debug_dump_object(), DEBUG_EVAL, debug_print(), inc_ref(), internedp(), make_cons(), nilp, pointer2cell, SYMBOLTV, cons_space_object::tag, and throw_exception().
Referenced by eval_form(), and main().
| struct cons_pointer lisp_exception | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; create an exception.
Exceptions are special in as much as if an exception is created in the binding of the arguments of any function, the function will return the exception rather than whatever else it would normally return. A function which detects a problem it cannot resolve should return an exception.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which arguments will be evaluated. |
message, and whose stack frame is the parent stack frame when the function is invoked. message does not have to be a string but should be something intelligible which can be read. If message is itself an exception, returns that instead. Definition at line 1244 of file lispops.c.
References exceptionp, and throw_exception().
Referenced by main().
| struct cons_pointer lisp_inspect | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function: dump/inspect one complete lisp expression and return NIL.
If write-stream is specified and is a write stream, then print to that stream, else the stream which is the value of *out* in the environment.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (from which the stream may be extracted). |
Definition at line 1001 of file lispops.c.
References debug_dump_object(), DEBUG_IO, debug_print(), dump_object(), file_to_url_file(), get_default_stream(), NIL, pointer2cell, and writep.
Referenced by main().
| struct cons_pointer lisp_keys | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
| struct cons_pointer lisp_lambda | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Construct an interpretable function.
| frame | the stack frame in which the expression is to be interpreted; |
| lexpr | the lambda expression to be interpreted; |
| env | the environment in which it is to be intepreted. |
NOTE that if args is a single symbol rather than a list, a varargs function will be created.
(lambda args body)
| frame | the stack frame in which the expression is to be interpreted; |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which it is to be intepreted. |
args and this body. Definition at line 223 of file lispops.c.
References compose_body(), and make_lambda().
Referenced by main().
| struct cons_pointer lisp_length | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function: return, as an integer, the length of the sequence indicated by the first argument, or zero if it is not a sequence.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
any, if it is a sequence, or zero otherwise. Definition at line 818 of file lispops.c.
References c_length(), make_integer(), and NIL.
| struct cons_pointer lisp_let | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Special form: evaluate a series of forms in an environment in which these bindings are bound.
This is let* in Common Lisp parlance; let in Clojure parlance.
Definition at line 1528 of file lispops.c.
References c_car(), c_cdr(), c_string_to_lisp_string(), eval_form(), exceptionp, fetch_arg(), make_cons(), NIL, symbolp, throw_exception(), and truep.
Referenced by main().
| struct cons_pointer lisp_list | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Definition at line 1510 of file lispops.c.
References args_in_frame, fetch_arg(), make_cons(), and nilp.
Referenced by main().
| struct cons_pointer lisp_mapcar | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Definition at line 1468 of file lispops.c.
References c_car(), c_cdr(), c_reverse(), consp, debug_dump_object(), DEBUG_EVAL, debug_print(), debug_print_object(), debug_printf(), debug_println(), dec_ref(), eval_form(), exceptionp, inc_ref(), make_cons(), NIL, and truep.
Referenced by main().
| struct cons_pointer lisp_nlambda | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Construct an interpretable special form.
| frame | the stack frame in which the expression is to be interpreted; |
| env | the environment in which it is to be intepreted. |
NOTE that if args is a single symbol rather than a list, a varargs special form will be created.
(nlambda args body)
| frame | the stack frame in which the expression is to be interpreted; |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which it is to be intepreted. |
args and this body. Definition at line 240 of file lispops.c.
References compose_body(), and make_nlambda().
Referenced by main().
| struct cons_pointer lisp_oblist | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Return the object list (root namespace).
| frame | the stack frame in which the expression is to be interpreted; |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
Definition at line 186 of file lispops.c.
References oblist.
Referenced by main().
| struct cons_pointer lisp_print | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; print one complete lisp expression and return NIL.
If write-stream is specified and is a write stream, then print to that stream, else the stream which is the value of *out* in the environment.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (from which the stream may be extracted). |
Definition at line 1040 of file lispops.c.
References debug_dump_object(), DEBUG_IO, debug_print(), dec_ref(), file_to_url_file(), get_default_stream(), inc_ref(), NIL, pointer2cell, print(), and writep.
Referenced by main().
| struct cons_pointer lisp_progn | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; evaluate the forms which are listed in my single argument sequentially and return the value of the last.
This function is called 'do' in some dialects of Lisp.
| frame | My stack frame. |
| env | My environment (ignored). |
Function; evaluate the forms which are listed in my single argument sequentially and return the value of the last.
This function is called 'do' in some dialects of Lisp.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which expressions are evaluated. |
expression of the sequence which is my single argument. Definition at line 1127 of file lispops.c.
References args_in_frame, c_progn(), consp, dec_ref(), eval_form(), inc_ref(), NIL, and nilp.
Referenced by main().
| struct cons_pointer lisp_quote | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Special form; returns its argument (strictly first argument - only one is expected but this isn't at this stage checked) unevaluated.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
a, unevaluated, Definition at line 594 of file lispops.c.
Referenced by main().
| struct cons_pointer lisp_read | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; read one complete lisp form and return it.
If read-stream is specified and is a read stream, then read from that stream, else the stream which is the value of *in* in the environment.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment. |
Definition at line 906 of file lispops.c.
References debug_dump_object(), DEBUG_IO, debug_print(), dec_ref(), file_to_url_file(), get_default_stream(), inc_ref(), pointer2cell, read(), and readp.
Referenced by lisp_repl(), and main().
| struct cons_pointer lisp_repl | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function: the read/eval/print loop.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment in which epressions will be evaluated. |
Definition at line 1263 of file lispops.c.
References c_assoc(), c_car(), c_cdr(), c_string_to_lisp_symbol(), debug_print(), debug_print_object(), debug_printf(), debug_println(), DEBUG_REPL, dec_ref(), eq(), eval_form(), exceptionp, get_default_stream(), get_stack_frame(), inc_ref(), lisp_read(), make_cons(), NIL, nilp, oblist, pointer2cell, print(), println(), prompt_name, readp, set(), truep, url_feof(), and writep.
| struct cons_pointer lisp_reverse | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; reverse the order of members in s sequence.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
sequence but with the members in the reverse order. Definition at line 981 of file lispops.c.
References c_reverse().
Referenced by main().
| struct cons_pointer lisp_set | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function; binds the value of name in the namespace to value of value, altering the namespace in so doing.
Retuns value. namespace defaults to the oblist.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
value Definition at line 616 of file lispops.c.
References c_string_to_lisp_string(), deep_bind(), make_cons(), NIL, nilp, oblist, symbolp, and throw_exception().
Referenced by main().
| struct cons_pointer lisp_set_shriek | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Special form; binds symbol in the namespace to value of value, altering the namespace in so doing, and returns value.
namespace defaults to the value of oblist.
| frame | my stack_frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
value Definition at line 654 of file lispops.c.
References c_string_to_lisp_string(), deep_bind(), eval_form(), make_cons(), NIL, symbolp, and throw_exception().
Referenced by main().
| struct cons_pointer lisp_source | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function.
return the source code of the object which is its first argument, if it is an executable and has source code.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | the environment (ignored). |
object indicated, if it is a function, a lambda, an nlambda, or a spcial form; else nil. Definition at line 1377 of file lispops.c.
References c_assoc(), c_string_to_lisp_keyword(), c_string_to_lisp_symbol(), FUNCTIONTV, inc_ref(), LAMBDATV, make_cons(), NIL, NLAMBDATV, cons_space_object::payload, pointer2cell, SPECIALTV, and cons_space_object::tag.
Referenced by main().
| struct cons_pointer lisp_try | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
OK, the idea here (and I know this is less than perfect) is that the basic try special form in PSSE takes two arguments, the first, body, being a list of forms, and the second, catch, being a catch handler (which is also a list of forms).
Forms from body are evaluated in turn until one returns an exception object, or until the list is exhausted. If the list was exhausted, then the value of evaluating the last form in body is returned. If an exception was encountered, then each of the forms in catch is evaluated and the value of the last of those is returned.
This is experimental. It almost certainly WILL change.
Definition at line 157 of file lispops.c.
References c_progn(), c_string_to_lisp_symbol(), exceptionp, and make_cons().
Referenced by main().
| struct cons_pointer lisp_type | ( | struct stack_frame * | frame, |
| struct cons_pointer | frame_pointer, | ||
| struct cons_pointer | env | ||
| ) |
Function: Get the Lisp type of the single argument.
| frame | My stack frame. |
| env | My environment (ignored). |
Function: Get the Lisp type of the single argument.
| frame | my stack frame. |
| frame_pointer | a pointer to my stack_frame. |
| env | my environment (ignored). |
expression. Definition at line 1086 of file lispops.c.
References c_type().
Referenced by main().
| struct cons_pointer throw_exception | ( | struct cons_pointer | message, |
| struct cons_pointer | frame_pointer | ||
| ) |
Throw an exception.
throw_exception is a misnomer, because it doesn't obey the calling signature of a lisp function; but it is nevertheless to be preferred to make_exception. A real throw_exception, which does, will be needed.
throw_exception is a misnomer, because it doesn't obey the calling signature of a lisp function; but it is nevertheless to be preferred to make_exception. A real throw_exception, which does, will be needed. object pointing to it. Then this should become a normal lisp function which expects a normally bound frame and environment, such that frame->arg[0] is the message, and frame->arg[1] is the cons-space pointer to the frame in which the exception occurred.
Definition at line 1208 of file lispops.c.
References debug_dump_object(), DEBUG_EVAL, debug_print(), EXCEPTIONTV, make_exception(), NIL, pointer2cell, and cons_space_object::tag.
Referenced by add_2(), add_integer_ratio(), add_ratio_ratio(), c_append(), c_apply(), c_assoc(), lisp_car(), lisp_cdr(), lisp_cond(), lisp_divide(), lisp_eval(), lisp_exception(), lisp_let(), lisp_set(), lisp_set_shriek(), make_ratio(), multiply_2(), multiply_integer_ratio(), multiply_ratio_ratio(), read_continuation(), read_number(), and subtract_2().
|
extern |
List processing operations.
The general idea here is that a list processing operation is a function which takes two arguments, both cons_pointers:
and returns a cons_pointer, the result.
They must all have the same signature so that I can call them as function pointers.
(c) 2017 Simon Brooke simon.nosp@m.@jou.nosp@m.rneym.nosp@m.an.c.nosp@m.c Licensed under GPL version 2.0, or, at your option, any later version.
Set in init to *prompt*
Definition at line 46 of file lispops.c.
Referenced by lisp_repl(), and main().