IRC channel logs

2024-06-12.log

back to list of logs

<flatwhatson>graywolf: re: shell syntaxes, here are a couple of inspirations that might be useful:
<flatwhatson>SCSH process notation: https://scsh.net/docu/html/man-Z-H-3.html#node_chap_2
<flatwhatson>Chicken's scsh-process egg: http://wiki.call-cc.org/eggref/5/scsh-process (source: https://code.more-magic.net/scsh-process/tree/)
<flatwhatson>Chibi process: https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/process.scm
<cpli>is it advised to n-ary-ize commutative binary operations?
<cpli>and how do you do it without fly-evaluation overhead?
<cpli>say if you simply implemented it as:
<cpli>(define (f a . bs) (if (null? bs) a (apply f (f-binary a (car bs)) (cdr bs))))
<flatwhatson>cpli: if you're concerned about performance, you can use case-lambda to implement optimized versions for common arities, eg. https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/boot-9.scm#n214
<flatwhatson>generally it's not worth worrying about, apply doesn't imply "fly evaluation"
<cpli>flatwhatson i remembering reading in srfi 200: Unfortunately, the applicability of this [syntax-case's] language is limited to syntax objects [..]. This limitation is hurtful to the souls of those Scheme programmers who are in love with minimalism, as it requires duplication [..]
<cpli>flatwhatson: are there any approaches to unifying arglist matching, syntax matching, and.. matching?
<flatwhatson>not that i'm aware of. guile's (ice-9 match) syntax for lists is very similar though.
<cpli>flatwhatson: that was the ".. matching" part.. it feels as though one could simply implement a version of ashinn's match and remove the non-quasiquote parts and apply it to both syntax and arglists..
<flatwhatson>yes maybe! it's a nice idea :)
<flatwhatson>i'm not deep enough into macrology to identify problems that kind of thing might run into. it would be a good discussion for the #scheme wonks or the srfi lists :)
<mwette>what gcc flags do I need to load with load-foreign-library; I keep getting 'only ET_DYN and ET_EXEC can be loaded'
<attila_lendvai>the semantics of with-exception-handler with #:unwind? #f is to keep the handler alive while the handler is called? i.e. if there's an error in the handler then the handler is called recursively?
<attila_lendvai>this semantics is so baffling that i didn't even consider that to be the case... but it seems to be the case.
<attila_lendvai>"Note: SRFI-18 specifies the exception handler installed with with-exception-handler will be called with exactly the same dynamic environment, including the exception handler settings. It means if an exception is raised within the handler, it will be caught with the same handler. The reasoning is that with-exception-handler is the bottom layer and kept as simple as possible, and further semantics should be built on top
<attila_lendvai>of it."
<attila_lendvai>"However, the bare SRFI-18 semantics turned out to be error prone–users tended to assume errors from a handler would be handled by outer handler, and were perplexed when they ran into infinite recursion of handlers", and apparently R7RS changes to the non-baffling semantics...
<cpli>how does one responsibly shadow core bindings?
<cpli>i.e. renaming `*` to `scalar*`
<cpli>and making `*` accept matrixes and vectors
<dsmith>cpli, Goops
<dsmith> https://www.gnu.org/software/guile/manual/html_node/Extending-Primitives.html
<cpli>dsmith am i allowed not to want goops q-q i'm currently implementing it by ((and (array? a) (array? b)) (@lm@mn* a b))
<dsmith>Hmm. I wonder how the compiler will handle renaming things like *
<cpli>dsmith it really shouldn't "handle" it at all.. q-q since the binding for `*` should stay the same everywhere apart from where i `(use-modules (ugly-hacks linear-operators))`
<cpli>plus so long the arguments are all `number?` it behaves exactly the same..
<cpli>this works (define-module (hack tensor) #:use-module ((scheme base) #:select ((* . scalar*))) #:export (*))
<rlb>cpli: if I understand you, there's also #:pure and #:hide in that direction, e.g.: https://codeberg.org/lokke/lokke/src/branch/main/mod/lokke/core.scm#L5-L8
<rlb>Depending on what you need.
<rlb>(Elsewhere, I also created/used a (re-export-all! '(some module))).
<cpli>rlb thanks #:replace gets rid of the warning that i override *
<rlb>Right, and there's also #:re-export-and-replace (in guile 3+) when that's appropriate.