Re: [CM] cload rebuilds don't consider *load-path*

2021-08-22 Thread bil
I changed the load process to keep more of the filename -- haven't had time to test it much. Pleas let me know of any problems. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] length of output_string

2021-08-24 Thread bil
In scheme there's a port-position function that would return the length; it could be exported as s7_port_position. Or a new function, say s7_output_string could return an s7_string (which can contain nulls), rather than a C string, and s7_string_length would give its length. Do these sound

Re: [CM] creating text code from s7 objects?

2021-08-31 Thread bil
but now that I think about it (with an ever-widening smile), s7 could include some reasonable facsimile of the continuation stack and let chain. To be callable, it might also need the rootlet entries that it references. ___ Cmdist mailing list

Re: [CM] creating text code from s7 objects?

2021-08-31 Thread bil
(object->string ... :readable) also format with ~W (which calls the same code). There are a few things that resist serialization: continuations for example. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] possibly a file output bug

2021-08-31 Thread bil
Are you sure that /Users/iainduncan/from-s4m.txt is not a directory? s7 just calls fopen with the desired name (and mode), and if that call fails, uses strerror to report what happened -- about as simple as IO can get. I tried both Linux and OSX cases, and had no problems with hyphens.

Re: [CM] reading text from file to eval (as in... the other way!)

2021-08-31 Thread bil
I need to know the max file size You mean max-string-length, I think -- it defaults to 2^30. There is no downside to making it as big as you want. Loading is not noticeably more expensive than evalling -- I would just load the file again to pick up the new data. Maybe I misunderstand the

Re: [CM] cload rebuilds don't consider *load-path*

2021-08-21 Thread bil
Thanks for the bug report. I think port-filename can include the load-path, but I'll need to look at the code more. Then realpath could give the full filename, if it is needed. I can't remember if you can get the full filename from the FILE* pointer (this would be the best option because the

Re: [CM] s7_load_c_string

2021-09-01 Thread bil
I'd expect a free cell complaint if it was the GC. Didn't Christos run into a similar problem in early July (unbound variable from s7_load_c_string)? -- I think it turned out to be a missing null at the end of the string (and maybe off-by-1 length?). I believe a file might not end in 0, so

Re: [CM] s7_load_c_string

2021-09-01 Thread bil
Yes, s7 could null-terminate the string, but it would need to make room for the string + the null, copy the string, etc. s7_load does this (actually it adds 2 nulls -- I wonder what that's about...). I was hoping to avoid the copy and eventual free. I added an error check to s7_load_c_string

Re: [CM] s7_load_c_string

2021-09-02 Thread bil
Should the length include the null byte or not? not. It's the C string length (strlen etc). There are some simple examples in ffitest.c. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] s7_load_c_string

2021-09-02 Thread bil
short of turning off the GC while i'm loading my C string, how can i debug this? GC bugs can be hard to track down, but I always start by running with S7_DEBUGGING=1. This adds tons of checks (s7 will run 5 to 10 times slower), and save GC info about every cell (see the end of the s7_cell

[CM] Snd 21.7

2021-09-05 Thread bil
Snd 21.7 s7: added (*s7* 'muffle-warnings?) and s7_output_string bool s7_flush_output_port (was void) checked: notcurses 2.3.13, sbcl 2.1.8 notcurses 2.3.17 behaves very strangely in row 0, so I've covered row 0 with a header box. It's probably some new notcurses configuration

Re: [CM] OT a few pieces

2021-09-08 Thread bil
Thanks for the pieces! I'm glad Snd has been useful. Took me back to the days when people were trying out new sounds. Does this happen much anymore? ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] setting heap size preemptively at startup?

2021-09-10 Thread bil
To see heap and gc stats, set gc-stats to 3 -- I should dream up names for these bits. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] setting heap size preemptively at startup?

2021-09-10 Thread bil
I'm willing to add gc-hook -- I'd also like to move all the other built-in hooks into the *s7* environment. While writing that previous message, it occurred to me that the type field could be separate from the cell, and then the amount of memory the GC has to read in is cut by a factor of 5 or

Re: [CM] setting heap size preemptively at startup?

2021-09-10 Thread bil
Elijah is correct, but I/m worried there might be some ambiguity. The s7_cells (the s7 objects) are allocated permanently (except s7_free frees them), and the heap itself is an array of pointers to those objects. The objects themselves are not copied or moved by the GC. In normal use the GC

Re: [CM] question about s7_gc_protect

2021-09-15 Thread bil
They will be safe as long as they are accessible from the protected object. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] Snd 21.7

2021-09-06 Thread bil
One reason for the early release was that I wanted to use __has_include to make mus-config.h optional (that is you don't have to make an empty file anymore). It works in gcc and clang, and I think it works in MS C++ from after 2017 (it's in the C20 standard, or is it C23?). It will be in-place

Re: [CM] adding regex handling to scheme for max question

2021-09-16 Thread bil
You can see for yourself by running (*s7* 'memory-usage), perhaps calling (gc) first. It does add some names and so forth to the *libc* environment, but I doubt it is significant. If you want just the regex functions, you can extract them from the file that libc.scm writes, libc_s7.c.

Re: [CM] adding regex handling to scheme for max question

2021-09-16 Thread bil
The example starts with (require libc.scm) -- this loads libc.scm or the resultant C shared object which has various regex functions (from C's libc). ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] Question: hash-table vs lists for fast processing

2021-09-18 Thread bil
There's no difference in GC; I'd expect a hash-table to be faster once you have more than 3 or 4 entries. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] setting heap size preemptively at startup?

2021-09-11 Thread bil
So is it correct that one cannot get the heap down to below the starting heap value without changing it and recompiling s7? Yes. The s7 I always use is built with -DINITIAL_HEAP_SIZE=6400. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] setting heap size preemptively at startup?

2021-09-11 Thread bil
You do mean 64 000 though right? (not 6400?) No, 6400 -- not sure how low it can go. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] need macro help!

2021-09-08 Thread bil
This isn't helpful, in fact it's ugly, but I can't resist mentioning: (set! *#readers* (cons (cons #\% (lambda (str) (list 's4m-expr-inputs (string->number (substring str 1) *#readers*)) (+ #%1 (+ #%2 #%3)) which returns 66 after

Re: [CM] need macro help!

2021-09-08 Thread bil
I think the "sexp" argument to map is just the macro argument name 'sexp, so map can't figure out what to do, and asks make-iterator to do something (hence the make-iterator error). I would write the macro: (define-macro (run-expr sexp) `(eval (map (lambda(token) (if

Re: [CM] s7 issues?

2021-07-15 Thread bil
Hi! You can report issues here, or to me personally. In s7, keywords are symbols that happen to start or end with a colon (and are constants evaluating to themselves). Thanks very much for the link to your docs and demos -- I'll check them out later today. I don't think I've ever heard of

[CM] Snd 21.6

2021-08-02 Thread bil
Snd 21.6: s7.h: added s7_is_random_state, s7_make_normal_vector, s7_array_to_list s7.c: I changed the default heap size to 64k (half its previous size) -- my timing tests and benchmarks seem to indicate that this is usually faster (perhaps cache-related?). Pushing it down to 32k

Re: [CM] value of 'define'

2021-07-30 Thread bil
maybe (define-macro (my-define symbol value) `(begin (define ,symbol ,value) ',symbol)) ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] define* and :rest bug

2021-07-30 Thread bil
But then what would (my-apply + 1 2 3 :debug #t 4 5 6) expect? Perhaps this would be usable: (define-macro* (my-apply debug :rest rest) `(if (not (boolean? ,debug)) (apply ,debug ',rest) (begin (when ,debug (format *stderr* "debugging\n")) (apply

Re: [CM] Possible s7_load bugfix

2021-07-29 Thread bil
Thanks! Now that I look at that code, I'm surprised I never hit that problem. Your changes do make sense, but we need to unstack the gc protections. I'll send you a possible new version later today. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] S7: empty values list

2021-07-31 Thread bil
(values) in that context returns # for historical reasons, and to make code more readable; otherwise we get stuff like (abs -1 (f)). list-values is intended for use with quasiquote -- the special case of () is explained in s7.html. ___ Cmdist mailing

Re: [CM] Sending code to the REPL from Emacs

2021-07-31 Thread bil
eval-string trailing junk: "(- 4 5 6)" This happens because the string passed to eval-string should contain just one expression to be evaluated. If you want more than one, wrap them in (begin ...) or (list ...) etc. ___ Cmdist mailing list

Re: [CM] define* and :rest bug

2021-07-30 Thread bil
I'm not sure I understand the desired functionality. The arguments after the rest argument should be like auxiliary arguments in CL (or whatever they are called) -- basically variable declarations? Ah, I looked it up -- in the CL lambda list -- I never used those!

Re: [CM] When does a let get created?

2021-09-24 Thread bil
Yes, that's bug -- curlet should not be a safe function, or perhaps it should copy the current environment (like owlet). Thanks! The "temporary" business refers to C-side functions; in Scheme the optimizer tries to find functions that do not capture/export their arguments, and uses the old

Re: [CM] format output to file port fails

2021-10-09 Thread bil
Did you close or flush the file port? Normally output is buffered. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

[CM] Snd 21.8

2021-10-13 Thread bil
Snd 21.8 sndlib: Kjetil updated the Jack support in audio.c. s7: now using __has_include if it is defined (gcc has it) this means mus-config.h is optional in gcc/clang (you don't need an empty file). s7_make_byte_vector and friends (s7.h) added (*s7* 'profile-prefix), a

Re: [CM] syntax-rules etc.

2021-10-18 Thread bil
Any chance s7 could support define-syntax et al? No. I think there are r5rs implementations, but I can't remember any names -- ppsyntax? alexandria?? ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] Multiple catch syntax

2021-10-19 Thread bil
catch uses eq? to match the tag to the error type -- I can't find any mention of this in s7.html -- will make it explicit. The expected usage for the (or 'a 'b) case would be to have two catches. Kinda ugly, now that I think about it. I borrowed catch from Guile, and now I don't remember if they

Re: [CM] extending the reader?

2021-10-08 Thread bil
I can't think of a way to do this in scheme code. *read-error-hook* is not currently called at the point of the error (probably line 69449 in s7.c). I suppose it could be called, but I'd need to back out with the new input (if any), which would take a ton of testing. You could change the C code,

Re: [CM] emacs support for s7 repl?

2021-09-26 Thread bil
The Snd repl (xen_repl in the scheme section in xen.c) uses the function stdin_check_for_full_expression (snd-xen.c) to get a full expression from emacs. It might be more straightforward in s7 to use the missing-close-paren-hook or the underlying error to do something similar. But currently the

Re: [CM] profile: prepend namespace to the function name

2021-09-28 Thread bil
I was thinking along the lines Christos mentioned -- that there might be any number of "inits" or whatever. I can pass the profile position to the profiler functions (I think), so it won't be necessary to use the function name for that, so my current idea is to pass into scheme via (*s7*

Re: [CM] profile: prepend namespace to the function name

2021-09-29 Thread bil
The profiler now returns the local let-name, if any, and the function location (file name and line-number) to scheme via (*s7* 'profile-info). (*s7* 'profile-prefix) identifies the name used for the local let name. Also each separate function in the source now has its own info. I haven't yet

Re: [CM] pipewire Snd and SndLib

2021-10-04 Thread bil
I'll make a new sndlib tarball in a week or so. In the meantime you can fix configure.ac by commenting out lines 298 and following: #if test "$with_jack" = yes ; then # A_INSTALL=":" # A_LD=":" #fi Run autoconf to remake the configure script. Then, at least in Ubuntu, you

Re: [CM] Specifying struct types in cload.scm C entities

2021-09-20 Thread bil
The example in cload.scm does seem to be broken, probably because the symbol prints itself as (symbol ...) -- I'll look at it tomorrow. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] nrepl build error

2021-09-20 Thread bil
Thanks for the bug report. I removed s7_integer_checked from s7, but forgot I was using it in notcurses_s7.c. So just remove the #if S7_MAIN and its #endif. On the lint problem -- apparently nrepl.scm could not find lint.scm -- I think the later reference to lint needs to be wrapped in (when

Re: [CM] polyoid-partial-amps-and-phases gen

2021-10-01 Thread bil
Thanks for the bug report. That example is obsolete; polyoid is now a wrapper around polywave. I didn't notice it because it is commented out. noid and polyoid play games with initial phases -- they were part of the minimum-peak-amplitude project (see sndscm.html#peakphasesdoc).

Re: [CM] pipewire Snd and SndLib

2021-10-03 Thread bil
Why is it looking for libsndlib.a? Snd's makefile uses the .o files like io.o, so the library is unneeded. The warning appears to be from sndjack_init in audio.c ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] pipewire Snd and SndLib

2021-10-03 Thread bil
That is the sndlib makefile -- I thought you were using Snd's. It does not create libsndlib.a in the --with-jack case, but still refers to it; that is a bug. I'll look at it tomorrow. Thanks! ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] pipewire Snd and SndLib

2021-10-04 Thread bil
I have made those changes to my version of audio.c -- thanks very much! I'll update the ccrma versions later today, or maybe tomorrow morning. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] pipewire Snd and SndLib

2021-10-04 Thread bil
Will Kjetil's patch also migrate to Sndlib's audio.c ? yes. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] pipewire Snd and SndLib

2021-10-04 Thread bil
You need to add -lpthread to JACK_LIBS -- not sure why this has to be done by hand. With this change it works in fedora 34. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] profile: prepend namespace to the function name

2021-09-27 Thread bil
An interesting problem! I lean toward (*s7* 'profile-prefix). And I'd omit "rootlet/" so that "normal" cases are easier to read. The second solution sounds problematic to me -- there's currently no space in the function cell for the profile position.

Re: [CM] s7_make_byte_vector ?

2021-09-22 Thread bil
I can't remember any reason. The byte-vectors were added a lot later. I'll add that function. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] Specifying struct types in cload.scm C entities

2021-09-21 Thread bil
I think this bug is fixed; the cload.scm example has been updated to reflect some other changes since 2012; remember to use "list" not "quote" here because the (symbol ...) needs to be evaluated. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] Bug regarding hooks

2021-12-30 Thread bil
Thanks for the very clear bug report! I don't immediately see what's causing it -- will poke at it tomorrow. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

[CM] Snd 22.0

2022-01-01 Thread bil
Snd 22.0: The spectrogram now notices dont-normalize. checked: notcurses 2.4.9|3.0.0 (the latter is needed for nrepl.scm), sbcl 2.1.11 Thanks!: Tito Latini, Chris Chafe, Kjetil Matheussen, Woody Douglass, Christos Vagias ___ Cmdist

Re: [CM] Bug regarding hooks

2021-12-31 Thread bil
Here's a change that might be interesting. Change call_setter (ca line 46598) to: static s7_pointer call_setter(s7_scheme *sc, s7_pointer slot, s7_pointer new_value) { s7_pointer func = slot_setter(slot); if (!is_any_procedure(func)) return(new_value); if (is_c_function(func))

Re: [CM] s7_load_c_string_with_environment & windows

2022-01-01 Thread bil
s7_load_c_string_with_environment behaves well in MSVC Thanks for the info! I'll uncomment that procedure in the MSVC case. Another thing that seems like it ought to work in Windows is the dynamic loader, but I don't know what is required. ___

Re: [CM] Installation problem version 22 (21.9?)

2021-12-21 Thread bil
Thanks for the info. I'll change --with-gui to be the same as --with-motif. Motif doesn't have pkg-config support, so it's hard to tell whether Motif is available in advance. But --with-gui is going to be confusing in either case. (I was looking for a Gtk replacement for awhile, then other

Re: [CM] Reducing S7 'real' precision

2021-12-22 Thread bil
It might work -- I just tried it and got the sorts of errors from s7test.scm that you'd expect, but nothing horrifying. I haven't changed those typedefs in a very long time -- I think s7_int has to be 64 bits. ___ Cmdist mailing list

Re: [CM] Possible bug with c-object & openlet

2021-12-20 Thread bil
You need to gc protect the methods -- c_object_set_let does not do that. This is partly for speed and to save space in the gc-protected-objects list, and also because you might create the let holding the methods, then any amount of time might go by before you make an object, so the let has to be

Re: [CM] Installation problem version 22 (21.9?)

2021-12-20 Thread bil
The no-gui Snd tries to load repl.scm for its repl unless you pass -noinit (with -noinit you'll get the world's more annoying repl). To load repl.scm you need to be in a directory with s7.h and maybe some other such files -- I forget what's needed. To get a GUI, you need Motif. Snd used to

Re: [CM] Installation problem version 22 (21.9?)

2021-12-20 Thread bil
Another possibility is notcurses (which is also changing rapidly, but the changes don't impact Snd or s7 as much). For that you need the notcurses-core library (the full notcurses library requires more than a GByte of ancillary libraries, overkill for a simple repl). Use the configuration

Re: [CM] *s7* 'cpu-time

2021-11-19 Thread bil
The manpage claims clock is implemented on top of clock_gettime, so I wouldn't expect them to be very different. clock is very slow for some reason, so I went down a level in my_clock (using clock_gettime) mainly for the profiler. I'll use my_clock in the cpu-time calc.

Re: [CM] C Stack Unwinding

2021-11-10 Thread bil
I merged in your changes, and they pass all my bazillion tests. One timing test is 2% slower -- callgrind blames fprintf, but there is no fprintf! I made other changes, so this is probably something unrelated to your code. Thanks again for the improvement!

Re: [CM] C Stack Unwinding

2021-11-10 Thread bil
Thanks -- that looks interesting. One problem is that a Jmp_Buf takes 200 bytes, so the s7_cell size is now 240 bytes (rather than 48) -- I think we'd want a pointer to a Jmp_Buf. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] Multiple s7_gc_protect/unprotect leading to segfault

2021-11-16 Thread bil
I haven't had my coffee yet this morning, but I think you're calling free_vec in s7_free; it tries to unprotect an object, but the sc->protected_objects vector in s7 has already been freed by s7_free. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] Multiple s7_gc_protect/unprotect leading to segfault

2021-11-16 Thread bil
I think this can be fixed by moving the c_objects list to the top of s7_free, so any C++ deallocators have everything in s7 available to them. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

[CM] Snd 21.9

2021-11-16 Thread bil
Snd 21.9 s7: mainly work on error handling checked: Ubuntu 21.10, notcurses 2.4.5|7|8, sbcl 2.1.10, Fedora 35 Thanks!: Christos Vagias, Woody Douglass ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] poly questions

2021-10-27 Thread bil
This is the same problem as before. There are two (or is it 4?) kinds of Chebyshev polynomials. You need to be consistent in which ones you use. For the square wave you want the second kind for a sum of sines: (with-sound (:srate 48000 :channels 1 :play #t) (let ((gen (make-polyshape 100.0

Re: [CM] poly questions

2021-10-26 Thread bil
Here's an example using polywave: (let ((g (make-polywave 100 '(1 1 3 1/3 5 1/5 7 1/7 9 1/9) :type mus-chebyshev-second-kind))) (with-sound () (do ((i 0 (+ i 1))) ((= i 44100)) (outa i (polywave g) You need to set the type to the second kind to get a

Re: [CM] MSVC patch

2021-10-26 Thread bil
Thanks very much! -- I wondered about that setjmp business. And thanks for the other bugfix -- why doesn't gcc complain about it? ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] mus-chebyshev-u-sum

2021-11-05 Thread bil
mus-chebyshev-u-sum takes a list of partial (harmonic) amplitudes: (with-sound (:srate 48000 :channels 1 :play #t) (let* ((dur 1.0) (samps (seconds->samples dur)) (coeffs (float-vector 0 1 0 1/3 0 1/5 0 1/7 0 1/9)) (incr (hz->radians 200.0))) (do ((i 0 (+ i 1))

Re: [CM] C Stack Unwinding

2021-11-03 Thread bil
There is a bug in s7 -- it did not protect against a stack underflow because it incorrectly assumed the s7_call_with_catch was in a context where some scheme code was awaiting a result, not all by itself (hence the "unknown operator" or "stack underflow"). I need to test my bugfix -- I will try

Re: [CM] C Stack Unwinding

2021-11-03 Thread bil
If you had called s7_error, rather than s7_eval_c_string, it would have behaved as you expect, but s7_eval interposes its own set_jmp, so s7_eval_c_string jumps to it. It might be possible to make these more consistent. But it's easy to get around this -- just include a catch in the scheme code,

Re: [CM] C Stack Unwinding

2021-11-04 Thread bil
Looking back, I think s7_define_function returns the symbol because that's the way define used to work, back in 2008 -- backwards compatibility, followed by forgetfulness. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] C Stack Unwinding

2021-11-04 Thread bil
I think these are the same bug as before (stack underflow) -- I didn't fix it correctly yesterday -- will poke at it. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] C Stack Unwinding

2021-11-04 Thread bil
Argh -- this is two problems. First the documentation is incomplete or incorrect (depending on whether you've had lunch), and has been for a long time -- s7_define_function returns the function name as a symbol, whereas s7_make_function returns the function. The comment in s7.h is also wrong.

Re: [CM] Possible bug in `member`

2021-12-08 Thread bil
Thanks for the bug report! This is an inadvertent shared list -- an over-eager optimizer basically. I'll have to trace it back to where the optimizer made its mistake, but in the meantime, change line 38562 (or thereabouts) in g_member from y = list_1(sc, args); to: y = list_1(sc,

Re: [CM] Probably a bug with call/cc

2021-12-05 Thread bil
I think this is more a matter of where the repl loop happens. If (main) is not commented out, the next thing is the repl loop waiting for input; if you type Ctrl-D, you get the rest of the continuation stuff: ;; (main) commented out: /home/bil/test/callcc/ asdf hi from c (main) () foo

Re: [CM] Bug in cload init function generation

2021-07-20 Thread bil
Thanks for the bug report. cload is assuming there is at least one function, so to fix that I think you can just change line 501: 501c501,502 <(format p " s7_pointer ") --- (when (> (hash-table-entries signatures) 0) (format p " s7_pointer "))

Re: [CM] s7 GC bug

2021-07-21 Thread bil
I haven't had time yet to look at that problem in detail, but just to clear up one point: (gc #f) turns off the GC, so the heap can't expand, so if more space is needed, everything goes to hell. Also, you can use *rootlet-redefinition-hook* to see if globals are being redefined. I added these

Re: [CM] s7_string v. s7_object_to_c_string

2021-07-21 Thread bil
No it is not a bug. s7_string returns the bytes of the scheme string (which is not a C string), somewhat like display, whereas s7_object_to_c_string returns a human- readable representation of a scheme object, somewhat like write: <1> (format #f "~A" "asdf") ; display "asdf" <2> (format #f

Re: [CM] Navigation in nrepl

2021-07-18 Thread bil
Wow! Thanks! I'll merge those changes into my version later today. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] s7: segfault on infinitely recursive macro

2021-07-19 Thread bil
Thanks! s7.c line 77444 (and 77457 for macro*) needs check_stack_size(sc); before the push_stack. I think this also covers expansions and bacros. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] s7 GC bug

2021-07-21 Thread bil
Thanks very much for the GC bug. I think I have fixed it, but it needs a bunch of testing. (lambda's new value wan't being GC marked; it took me a couple hours to figure out why). ___ Cmdist mailing list Cmdist@ccrma.stanford.edu

Re: [CM] autoload compiling when shared libs are in *load-path*

2021-07-21 Thread bil
repl.scm adds "libm.scm" as the autoload info for *libm*. This could instead be a function that looks for libm_s7.so in the load-path, checks its write date against the libm_s7.c in that directory, and loads it if up-to-date. If none found, it loads "libm.scm". I'd call it a "lack of

Re: [CM] autoload compiling when shared libs are in *load-path*

2021-07-22 Thread bil
libc_s7.so is special in the repl case because repl can't run (as a repl) if it can't find it; the other *.so files are optional. Ideally the libc dependencies would be built into repl.c, like they are in nrepl.c. I'll add the .repl business to repl.scm.

Re: [CM] metadata on vectors?

2021-07-26 Thread bil
object->let is intended as a low-level portion of a yet-to-be-written debugger. Perhaps one simple solution is to use (cons vector data) and pass that around instead of the bare vector. Most scheme objects in s7 do not have an associated let built-in.

Re: [CM] metadata on vectors?

2021-07-26 Thread bil
Here's one way to do that in scheme: (require mockery.scm) (define (meta-vector v data) (openlet (sublet (*mock-vector* 'mock-vector-class) 'value v 'mock-type 'mock-vector? 'meta-data data))) (define v (meta-vector #(0 1 2) "hiho")) (display (v 1)) 1 (display (v

Re: [CM] question about pretty-print and object serialization

2022-01-15 Thread bil
I think the "..." truncation of vectors depends on the (*s7* 'print-length) setting. It's 12 for historical reasons. I think the :readable argument to object->string (and the `W format option) came after write.scm and pretty-print, so pretty-print might not be as complete in that regard.

Re: [CM] R7RS support

2022-01-17 Thread bil
The with-exception definition in r7rs.scm probably should be (define (with-exception-handler handler thunk) (catch #t thunk (lambda args (apply handler args The define-library code dates from the days (years ago) when s7's define-macro returned the symbol rather than the value. Also, I

Re: [CM] TeXmacs & S7

2022-01-17 Thread bil
Thanks for the observations -- I'm glad s7 has worked out reasonably well. On your questions: 1) would it be possible to have lookup_from implemented via some hash table...? Alternatively, can our patch be made into the official version? Currently, s7's optimizer sometimes depends on the

Re: [CM] TeXmacs & S7

2022-01-17 Thread bil
Why not maintain a hash table whose values are offsets into the flat environment? Then it's a cheap branch or two on lookup to see: 1) is there a hash table; 2) should I build one (is the env big enough, and have there been enough lookups). I call that serious overhead. Environments come and

Re: [CM] TeXmacs & S7

2022-01-17 Thread bil
Another idea is inline caching... And probably better than a hash-table, but it's yet another layer in an already complicated process. I might try that just to see what happens -- thanks for the suggestion! ___ Cmdist mailing list

Re: [CM] TeXmacs & S7

2022-01-17 Thread bil
Do I understand you correclty that the patch I implemented break some assumption of your code In general, yes. I'd have to read through the code -- I glanced at it a few months ago, but can't remember any details, except that it struck me as written for Guile 1.8? and perhaps awkward for s7

[CM] Snd 22.2

2022-03-11 Thread bil
Snd 22.2: moved s7_apply_* from s7.h to xen.h if DISABLE_DEPRECATED. checked: sbcl 2.2.1|2, notcurses 3.0.6|7 Thanks!: Mike Scholz ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Re: [CM] Lint suggests do

2022-03-16 Thread bil
It's mostly stylistic -- I hate named let. But I think a do-loop is nearly always faster in s7 due to its roots in Snd. I can add a flag to control that report if you like. Please let me know of any stupidities in lint -- I use it a lot, but I am set in my ways.

Re: [CM] Bug in (apply set! ..)

2022-02-21 Thread bil
I don't immediately see the bug. apply evaluates all its arguments, and set! evaluates its second argument, so (define x 'foo) (apply set! 'x 'bar ()) becomes (#_set! x bar), but bar is not defined when evaluated by set! Similarly (define bar 'the-bar) (apply set! 'x bar ()) ; bar is

Re: [CM] Bug in (apply set! ..)

2022-02-21 Thread bil
Maybe it's inconsistent with (apply + a b) where there's only one evaluation of a and b? Hmmm. ___ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist

<    1   2   3   4   5   6   >