<wingo>so, weird thing -- call-with-input-file and call-with-output-file will close the port on normal return from the proc <wingo>but the same procedures for strings won't <wingo>i think that is probably just a bug. <wingo>i even have a few call-with-output-string* definitions in guile that are there just to close the port <leoprikler>IIRC none of those functions guarantee immediate closing, though, am I right? <wingo>if the proc returns normally, call-with-*-file guarantees the port is closed <leoprikler>Ah, right, the guarantees just don't extend to non-local exits <surpador>Is there a way to cause Guile to enter a debugging REPL at a specific point in a script? Kind of like python's `pdb.set_trace`? ***rekado_ is now known as rekado
<rekado>surpador: in a REPL you can use ,break and ,break-at-source <surpador>Ah ok. Is there no way to set a breakpoint in source without doing it from the REPL? I don't really have a use case in Scheme yet but I know with a Python project I was working on setting a breakpoint in source was nice since I wanted to break during execution of a much larger program of which the target file was one small part <spk121>surpador: you could always at "(error)" where you want to break <spk121>assuming you aren't catching errors <mfg>Hi, i'm trying to invoke a (syntax-rules) macro like this: (my/macro (make-list 32 0)), i get that the macro literally works with "(make-list 32 0)". Is it possible to actually evaluate the make-list before the macro gets expanded? <dsmith-work>mfg: You would need to do that in the macro I guess. Maybe your macro should really be a function? <dsmith-work>The whole point of macros is that the args are NOT evaluated. So you can make new syntax. <surpador>spk121: ah true, I could try something with that, maybe install whatever the repl uses as the exception handler or something <manumanumanu>mfg: not with syntax-rules, unless you are hard-coding every case for make-list <manumanumanu>((_ 3 val) '(val val val)) (_ 4 val) '(val val val val)) etc. <manumanumanu>with syntax-case you can get the values of make-list if they are constants (or using syntax-local-binding (???) you can get values from other modules) and programmatically build the syntax object you want. <mfg>dsmith-work: Makes sense. I'm just starting out with macros and know not much about them :D <mfg>manumanumanu: Hm, i will have to read the documentation about syntax-case :) <ft>You can always do this: (define-syntax-rule (my-macro x) (let ((v x)) v)) -- which will make the value accessible as āvā when the thing runs. But I agree, sounds like that thing doesn't have to be a macro. <mfg>but you are right, i shouldn't use macros for this :D ***amiloradovsky1 is now known as amiloradovsky
<manumanumanu>mfg: the best docs is the tspl4 (the r6rs part of the chez scheme manual) and "fear of macros" for racket. <manumanumanu>fear of macros is incompatible enough for it to be a PITA. <dsmith-work>That is "JRM's Syntax-rules Primer for the Merely Eccentric" <mfg>Thank you for the links/tips :) <sneek>sneek: later tell dsmith-work Hello <sneek>Welcome back dsmith-work, you have 1 message! <sneek>dsmith-work, dsmith-work says: Hello <sneek>sneek: later tell sneek Testing <mwette>sneek: later tell surpador, It's been years since I tried to put together a guile version of pdb.set_trace() but look at this: https://paste.debian.net/1180849/ where usage is pdb.set_trace() => (jump-to-debugger) <mwette>surpador: stripped down it's: (start-repl #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t)) <surpador>mwette: ah nice, that makes sense, thanks! I'll have to play around with it a bit :) <sneek>surpador, you have 1 message! <sneek>surpador, mwette says: It's been years since I tried to put together a guile version of pdb.set_trace() but look at this: https://paste.debian.net/1180849/ where usage is pdb.set_trace() => (jump-to-debugger)