Very small progress.

This commit is contained in:
Simon Brooke 2018-12-20 11:01:13 +00:00
parent 637d78fb1b
commit 7cd2cbf785
4 changed files with 10 additions and 7 deletions

View file

@ -80,8 +80,8 @@ bool equal( struct cons_pointer a, struct cons_pointer b ) {
&& ( equal( cell_a->payload.string.cdr, && ( equal( cell_a->payload.string.cdr,
cell_b->payload.string.cdr ) cell_b->payload.string.cdr )
|| ( end_of_string( cell_a->payload.string.cdr ) || ( end_of_string( cell_a->payload.string.cdr )
&& end_of_string( cell_b->payload.string. && end_of_string( cell_b->payload.
cdr ) ) ); string.cdr ) ) );
break; break;
case INTEGERTV: case INTEGERTV:
result = result =

View file

@ -103,6 +103,7 @@ int main( int argc, char *argv[] ) {
bind_function( "*", &lisp_multiply ); bind_function( "*", &lisp_multiply );
bind_function( "-", &lisp_subtract ); bind_function( "-", &lisp_subtract );
bind_function( "/", &lisp_divide ); bind_function( "/", &lisp_divide );
bind_function( "=", &lisp_equal );
/* /*
* primitive special forms * primitive special forms

View file

@ -390,8 +390,10 @@ lisp_eval( struct stack_frame *frame, struct cons_pointer env ) {
internedp( frame->arg[0], env ); internedp( frame->arg[0], env );
if ( nilp( canonical ) ) { if ( nilp( canonical ) ) {
struct cons_pointer message = struct cons_pointer message =
c_cons(
c_string_to_lisp_string c_string_to_lisp_string
( "Attempt to take value of unbound symbol." ); ( "Attempt to take value of unbound symbol." ),
frame->arg[0]);
result = lisp_throw( message, frame ); result = lisp_throw( message, frame );
} else { } else {
result = c_assoc( canonical, env ); result = c_assoc( canonical, env );

View file

@ -132,8 +132,8 @@ void print( FILE * output, struct cons_pointer pointer ) {
case LAMBDATV: case LAMBDATV:
print( output, make_cons( c_string_to_lisp_symbol( "lambda" ), print( output, make_cons( c_string_to_lisp_symbol( "lambda" ),
make_cons( cell.payload.lambda.args, make_cons( cell.payload.lambda.args,
cell.payload. cell.payload.lambda.
lambda.body ) ) ); body ) ) );
break; break;
case NILTV: case NILTV:
fwprintf( output, L"nil" ); fwprintf( output, L"nil" );
@ -141,8 +141,8 @@ void print( FILE * output, struct cons_pointer pointer ) {
case NLAMBDATV: case NLAMBDATV:
print( output, make_cons( c_string_to_lisp_symbol( "nlambda" ), print( output, make_cons( c_string_to_lisp_symbol( "nlambda" ),
make_cons( cell.payload.lambda.args, make_cons( cell.payload.lambda.args,
cell.payload. cell.payload.lambda.
lambda.body ) ) ); body ) ) );
break; break;
case READTV: case READTV:
fwprintf( output, L"(Input stream)" ); fwprintf( output, L"(Input stream)" );