Re: [CM] pre-parsing scheme code

2022-03-21 Thread bil
Here's an example: #include #include #include #include "s7.h" int main(int argc, char **argv) { s7_scheme *s; s7_pfunc f; s7_pointer body; int i; s = s7_init(); body = s7_list_nl(s, 4, s7_make_symbol(s, "list"), \ s7_make_integer(s, 1), \ s

Re: [CM] pre-parsing scheme code

2022-03-21 Thread bil
If you're running the same code many times, it might be worth it to call s7_optimize, save the function it returns, then call that function rather than eval+expression-writing code. There's an example in snd-sig.c. The idea there is that you're running a function over every sample of some sound,

Re: [CM] pre-parsing scheme code

2022-03-21 Thread bil
Sorry about that repetition -- I seem to have a flakey net connection today -- can't see any squirrels chewing on the cable. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] pre-parsing scheme code

2022-03-21 Thread bil
Gah -- I forgot to eval the expression in the second case -- then it's 1600, which is more what I expected. for (i = 0; i < 200; i++) s7_eval(s, s7_list_nl(s, 4, s7_make_symbol(s, "list"),\ s7_make_integer(s, 1), \ s7_make_integer(s, 2),

Re: [CM] pre-parsing scheme code

2022-03-21 Thread bil
I didn't realize there was such a difference in speed: #include #include #include #include "s7.h" int main(int argc, char **argv) { s7_scheme *s; int i; s = s7_init(); #if 1 for (i = 0; i < 200; i++) s7_eval_c_string(s, "(list 1 2 3)"); #else for (i = 0; i < 200; i++)

Re: [CM] pre-parsing scheme code

2022-03-21 Thread Kjetil Matheussen
Nice code. But isn't the result of doing: s7_eval_c_string("(list 1 2 3)"); the same as the result of doing: s7_list_nl(s, 3, s7_make_integer(s, 1),\ s7_make_integer(s, 2),\ s7_make_integer(s, 3),\ NULL); ? Except that the second version probably runs much faster... On Mon, M