Example #1
0
static obj_ptr _cdr(obj_ptr arg, obj_ptr env)
{
    if (NCONSP(arg))
        return MKERROR(MKSTRING("Expected a pair in cdr"), arg);

    return CDR(arg);
}
Example #2
0
File: print.c Project: jaw0/jlisp
int prn_func_macr(Obj a, Obj stream, char* which){
	Obj env  = CADR(a);
	Obj args = CADDR(a);
	Obj body = CDDDR(a);
	
	writestr(stream, "(");
	writestr(stream, which);

	writestr(stream, " ");
	prnobj( args, stream, 1);
	writestr(stream, " ");
	
	a = body;
	while( NNULLP( a )){
		if( NCONSP( a )){
			writestr(stream, " . ");
			prnobj(a, stream, 1);
			break;
		}
		writestr(stream, " ");
		prnobj( CAR(a), stream, 1);
		a = CDR( a );
	}
	writestr(stream, ")");
	return 1;
}
Example #3
0
File: print.c Project: jaw0/jlisp
int prncons(Obj a, Obj stream, int how){
	
	writestr(stream, "(");
	prnobj(CAR(a), stream, how);
	a = CDR(a);
	while( NNULLP( a )){
		if( NCONSP( a )){
			writestr(stream, " . ");
			prnobj(a, stream, how);
			break;
		}
		writestr(stream, " ");
		prnobj( CAR(a), stream, how );
		a = CDR( a );
	}
	writestr(stream, ")");
	return 1;
}