Couple of questions regarding handling exceptions

2025-02-04 Thread Tomas Volf
Hello, I would like to dispatch exceptions based on errno, in particular to return #f on ENOENT, and re-raise the exception otherwise. My current (working as far as I can tell) solution is: --8<---cut here---start->8--- (with-exception-handler (λ (exc

Re: How to work with the tree produced by (ice-9 peg)'s match-pattern?

2024-12-06 Thread Tomas Volf
Hello, Zelphir Kaltstahl writes: > Without getting into the details, perhaps my peg utils module could be useful > for you: > > https://codeberg.org/ZelphirKaltstahl/advent-of-code-2024/src/commit/3f64ee60297ccc89085c9425522bd8b8e83fe99d/utils/peg-tree-utils.scm That does definitely look very u

How to work with the tree produced by (ice-9 peg)'s match-pattern?

2024-12-04 Thread Tomas Volf
Hi :) I recently discovered the (ice-9 peg) module, and it seems really useful. However I have to admit I struggle a bit with processing the tree produced by it. Let me put forward an example: --8<---cut here---start->8--- (use-modules (ice-9 peg)) (define-

Re: Keywords in GOOPS methods

2024-11-22 Thread Tomas Volf
edures (mainly due to the assumption of there being a performance impact). Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature

Re: How to use ~c with v parameter in (ice-9 format)?

2024-11-13 Thread Tomas Volf
Matt Wette writes: > This looks like a bug in the compiler to me. Will send a bug report. > For example, check the `format-analysis' procedure in > language/tree-il/analyze.scm I had a look, but have to admit that procedure is beyond me, at least for now. > > try this: (apply format #f "~65c"

Re: How to use ~c with v parameter in (ice-9 format)?

2024-11-10 Thread Tomas Volf
PS: The subject is misleading. I originally noticed the warning with ~vc, but during writing the email realized that ~65c warns as well and forgot to adjust it. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

How to use ~c with v parameter in (ice-9 format)?

2024-11-10 Thread Tomas Volf
Hello, when reading the documentation for (ice-9 format), this part of description of ~c caught my eye: > If the charnum parameter is given then an argument is not taken but > instead the character is (integer->char charnum) (see > Characters). This can be used for instance to output characters

Re: PEG tutorial example doesnt work

2024-08-12 Thread Tomas Volf
Hello, On 2024-08-11 21:52:42 -0500, Diego Antonio Rosario Palomino wrote: > Hello, i am a new scheme user trying to exploit the peg library but have > encountered the following error : > > guile c.scm > ;;; note: source file /home/diego/Documents/Guile/c.scm > ;;; newer than compiled > /hom

How to have an optional dependency?

2024-06-24 Thread Tomas Volf
tional dependency without any warnings? For example, is there a way to convince the Guile that those specific variables will be bound? How do people commonly approach this? Thanks, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature

Re: Weird import behaviour of digital modules

2024-06-08 Thread Tomas Volf
and use-modules. Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature

Re: warning: possibly unused local top-level variable `%foo?-procedure'

2024-06-06 Thread Tomas Volf
your no-computer time :) > > -- > Linus Björnstam > > On Wed, 5 Jun 2024, at 17:02, Tomas Volf wrote: > > Hello, > > > > I am getting following warning from a guild compile: > > > > warning: possibly unused local top-level variable `%foo?-procedure

warning: possibly unused local top-level variable `%foo?-procedure'

2024-06-05 Thread Tomas Volf
truct in Guile? Are there other options? How are you approaching it? Thank you and have a nice day, Tomas Volf PS: I am not even sure why this warning happens, the `foo?' syntax transformer is exported and *does* reference it (as far as I can tell from ,expand). -- There are only tw

Re: How to gradually write a procedure using Guile?

2024-05-16 Thread Tomas Volf
op-level pollution, but with bit of care it seems to be manageable. Sometimes, when I mess up, it requires restarting the REPL, but I can skip the expensive parts of the setup, so it is pretty fast. Thank you both again and have a nice day, Tomas Volf 0: The full procedure is an install scrip

How to gradually write a procedure using Guile?

2024-05-02 Thread Tomas Volf
uot; way of "write a function, run it whole against a test". Since this is Scheme, and I *can* evaluate single expressions in the procedure body, I would like to use that to my advantage. Somehow. I realize this is a very open-ended question/email. Have a nice day, Tomas Volf -- The

Re: Some issues with guile

2024-04-26 Thread Tomas Volf
On 2024-04-26 03:05:51 -0400, Nikolaos Chatzikonstantinou wrote: > Hello list, > > I want to talk about some issues I've encountered with Guile. I'll > quickly summarize the points and I'll expand below. > > 1. Can't connect geiser from emacs to a remote REPL server unless > versions match. > 2. Do

Re: Writing to closed network port causes guile to exit with error 141, not error message

2024-03-22 Thread Tomas Volf
/guile.c:94 If you check module/web/server/http.scm in the guile's repository, you will notice there is this line: (sigaction SIGPIPE SIG_IGN) Which caused the signal to be ignored instead of using the default handler (which is to die). Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature

Re: Quiet compilation for scripting

2024-03-15 Thread Tomas Volf
ompilation-quiet or something would work. I would actually want that as well, but never got to writing the patch. Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature

Re: using a module : rename a single definition

2024-03-03 Thread Tomas Volf
popen) ((ice-9 popen) #:select ((open-pipe . foo-bar After that you have both `open-pipe' and `foo-bar' available, pointing to the same procedure. At this point you could just re-define `open-pipe' to something else and use the `foo-bar'. Maybe there is

Re: How to abort a read from a socket after some time?

2024-01-22 Thread Tomas Volf
bigger) file descriptors than select. > > So I suggest using poll, not select. I did not realize there is (ice-9 poll), seems to be undocumented. I can live with being linux-only, so poll should work for me. Thanks :) Have a nice day, Tomas Volf -- There are only two hard things in Compu

How to abort a read from a socket after some time?

2024-01-21 Thread Tomas Volf
)) It still does not work: read-char (non-block): Alarm! ;; Result: # ;; 51.581392s real time, 0.000371s run time. 0.00s spent in GC. I would have expected to receive EWOULDBLOCK. But let's not get distracted by the non-blocking variant. So, what would be a good way to do

Re: symbol is nested in #{ ...... }#

2024-01-04 Thread Tomas Volf
rd from it: scheme@(guile-user)> (eq? #:hello (symbol->keyword (string->symbol "hello"))) $1 = #t There might be a direct way, but this is what I managed to put together after digging in the manual. Have a nice day, Tomas Volf -- There are only two hard things

Re: How to globally replace core binding?

2023-11-27 Thread Tomas Volf
Hi, thanks for the answers. On 2023-11-28 01:51:46 +0100, Maxime Devos wrote: > (set! copy-file improved-copy-file) > > This replacement 100% functioning assumes no inlining, nobody capturing the > old copy-file on the top-level, nobody calling the C function directly ... In that case this is w

How to globally replace core binding?

2023-11-26 Thread Tomas Volf
Hello, I would like to replace a core binding. I know that I can define a module like this: (define-module (foo)) (define-public (copy-file a b) (display "TODO: implement file copy\n")) And I can later use it scheme@(guile-user)> ,use (foo) scheme@(guile-user)> (copy-file