And the answer was, eval is a function, not a special form.

This commit is contained in:
Simon Brooke 2018-12-07 06:32:02 +00:00
parent 7f29c11592
commit 1307c65e94
2 changed files with 7 additions and 19 deletions

View file

@ -1,7 +1,7 @@
/** /**
* init.c * init.c
* *
* Start up and initialise the environement - just enough to get working * Start up and initialise the environement - just enough to get working
* and (ultimately) hand off to the executive. * and (ultimately) hand off to the executive.
* *
* *
@ -37,7 +37,7 @@ void bind_special( char *name, struct cons_pointer ( *executable )
int main( int argc, char *argv[] ) { int main( int argc, char *argv[] ) {
/* /*
* attempt to set wide character acceptance on all streams * attempt to set wide character acceptance on all streams
*/ */
fwide( stdin, 1 ); fwide( stdin, 1 );
fwide( stdout, 1 ); fwide( stdout, 1 );
@ -69,14 +69,14 @@ int main( int argc, char *argv[] ) {
initialise_cons_pages( ); initialise_cons_pages( );
/* /*
* privileged variables (keywords) * privileged variables (keywords)
*/ */
deep_bind( c_string_to_lisp_symbol( "nil" ), NIL ); deep_bind( c_string_to_lisp_symbol( "nil" ), NIL );
deep_bind( c_string_to_lisp_symbol( "t" ), TRUE ); deep_bind( c_string_to_lisp_symbol( "t" ), TRUE );
/* /*
* primitive function operations * primitive function operations
*/ */
bind_function( "add", &lisp_add ); bind_function( "add", &lisp_add );
bind_function( "apply", &lisp_apply ); bind_function( "apply", &lisp_apply );
@ -98,14 +98,14 @@ int main( int argc, char *argv[] ) {
bind_function( "-", &lisp_subtract ); bind_function( "-", &lisp_subtract );
/* /*
* primitive special forms * primitive special forms
*/ */
bind_special( "cond", &lisp_cond ); bind_special( "cond", &lisp_cond );
bind_special( "eval", &lisp_eval ); bind_function( "eval", &lisp_eval );
bind_special( "quote", &lisp_quote ); bind_special( "quote", &lisp_quote );
/* bind the oblist last, at this stage. Something clever needs to be done /* bind the oblist last, at this stage. Something clever needs to be done
* here and I'm not sure what it is. */ * here and I'm not sure what it is. */
deep_bind( c_string_to_lisp_symbol( "oblist" ), oblist ); deep_bind( c_string_to_lisp_symbol( "oblist" ), oblist );

View file

@ -1,12 +0,0 @@
#!/bin/bash
expected='5'
actual=`echo "(eval '(add 2 3))" | target/psse 2> /dev/null | head -2 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
exit 1
fi