Aaron said:
> Is there also a specific way to invoke pop-11 from scheme? If so
> scheme users can then get at pop-11 vectors, arrays, etc, and also
> all the X stuff and prolog, etc.
The function-call (pop11) flips from Scheme to pop11, and the
macro Scheme flips back. The VAR macro is used to bind Scheme
variables to POP-11 values. Try <enter> source VAR <return>,
and search for uses of VAR. Ordinary POP functions have to
be wrapped up to act as Scheme functions. Certain POP functions
can be used directly as Scheme functions, e.g. apply_scm and cd_scm
are actually written to be Scheme functions.
Here's a representative variety of VAR bindings:
VAR 'atom?' = Schemify_bool_fun(atom,'atom?');
VAR 'apply' = apply_scm;
VAR 'null?' = Schemify_bool_fun(nonop == (% [] %),'null?');
VAR 'alphaless?' = Schemify_bool_fun(alphaless,"'alphaless?'");
VAR append = append_scm;
VAR append_string = polyadic_from_binary_no_id(append_string);
VAR + = polyadic_from_binary(nonop +,0);
VAR * = polyadic_from_binary(nonop *,1);
VAR - = polyadic_from_binary_l_assoc(nonop -,negate);
VAR = = Schemify_bool_fun(nonop =,false);
VAR cos = SF(cos,"cos");
VAR cd = cd_scm;
and here is the definition of cd_scm. Here n is the number of
actual parameters (this is much like Poplog Common Lisp I think).
define cd_scm(n) with_props 'cd';
let Dir = if n==0 then '~' else /*..*/ endif
in
Dir -> current_directory;
undef_scm;
endlet
enddefine;
Here's the definition of apply_scm
define apply_scm(/*...*/ list,n) with_nargs 0 with_props 'apply ';
let f = subscr_stack(n-1),
val = f(/*...*/ explode(list),n+length(list)-2)
in
-> ;
val;
endlet
enddefine;
Robin.
|