[CM] Possible bug in s7_values

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Thu Apr 21 11:02:20 PDT 2022

The printer includes "values" when it is asked to print a list
of values that was not spliced into a caller's argument list.
It is just trying to be helpful.  In the second ("v") case,
it gets the values list unhandled by anything, so it includes
"values" as a sort of warning.

s7_values gives a way to return multiple values from a function
defined in C to a Scheme function (see example below).  It is
often equivalent to (apply func (list...)).  You can capture
the values in a list if you want.

list-values is a special version of list that splices out
(values) (i.e. values without any arguments).  This is expected
in quasiquote, but in s7 other functions (e.g. map) also use it.

static s7_pointer vals(s7_scheme *s, s7_pointer args)
   return(s7_values(s, args));

int main(int argc, char **argv)
   s7_scheme *s = s7_init();
   s7_define_function(s, "vals", vals, 0, 0, true, NULL);
   s7_pointer e = s7_eval_c_string(s, "(+ (vals 1 2 3))");
   s7_display(s, e, s7_current_output_port(s));
   s7_newline(s, s7_current_output_port(s));

What are you actually trying to do?

More information about the Cmdist mailing list