IRC channel logs

2026-02-16.log

back to list of logs

<loquatdev>Hello, everyone. Is there a normative means for syntax highlighting guile scheme? I'm looking to add some syntax highlighting to a static site generator I'm working on.
<loquatdev>That and I'd also like a direction to look regarding syntax highlighting for my next text editor.
<mwette> /date
<rlb>mwette: hmm, what were the previous options (if you know)?
<mwette>rlb: Before I had erc-hide-list of JOIN PART and QUIT. On rework, it had become `nil'. But it turns out I'm still getting the welcome(?) message with the list of all logged-on users like every 10 min.
<rlb>Oh sorry, I meant wrt libguile size, though that's interesting too :)
<mwette>Before the only args to configure were --prefix and --disable-tmpnam.
<rlb>So perhaps the size difference was in part was the (I think) -g default.
<mwette>That's what I guess.
<rlb>I see that libguile.a is also bigger (13M) in one of my worktrees with mostly defaults, and via "make V=1" that we do default to -g.
<rlb>makes sense
<lechner>Hi, why does Scheme need additional "primitives" for lazy evaluation, please? Isn't that what quotes and 'eval' do? https://srfi.schemers.org/srfi-45/
<identity>lechner: you do not need either of those for normal-order evaluation, you can just put stuff in thunks
<identity>SRFI 45 is just fancy wrapping for that
<identity>in fact, most SRFIs are just fancy wrapping and portable libraries that you could write in RⁿRS Scheme, with notable exceptions
<lechner>identity / okay, thanks!
<lechner>Hi, I have a source file with about six thousand define-public's. Compiling takes ten minutes. Why?
<identity>because that is a lot
<lechner>but they are all integer constants!
<mwette>Try `guild compile -O1'.
<lechner>I am in the REPL
<rlb>I wonder if there'd be any difference between 6k define-publics vs 6k exports, though offhand I'm surprised if 6k "trivial" define-publics is slow in the first place.
<mwette>((@ (system base compile) default-optimization-level) 1)
<mwette>my only guess is devirtualize-integers optimization, if it's really only integers
<lechner>mwette / you may know this file better than I https://juix.org/linux.scm
<mwette>For compile-ffi generated files on big packages, -O2 became unwieldy.
<mwette>That could be trying to inline cdata calls.
<lechner>it doesn't have the issue without my modifications, which create define-public's for the constants in symbol-tab
<mwette>so maybe rlb is right, generating so many more slots is slow
<lechner>malloc for each one?
<lechner>nvm, i can do define plus export if that helps.
<lechner>one minute
<rlb>If it's plausible, might try one bit #:export (...) too.
<rlb>I'll also be surprised if that helps, but...
<rlb>s/bit/big/
<mwette>it looks like hash table updates: define-public called module-export! which calls module-add!
<mwette>I doubt separate define export will help.
<mwette>There is a "call-with-deferred-observers". I wonder what that does.
<mwette>In repl I typed: ,optimize (define-public a 1)
<lechner>yeah, it does not help
<mwette>I'd look into boot-9.scm(call-with-deferred-observers)
<mwette>Maybe one big export will work better (export a b c )
<lechner>i'll try that. what would the thunk for call-with-deferred-observers, please?
<mwette>Instead of messing with call-with-deferred-observers, try (define foo 1) (define bar 2) ... (export foo bar ...)
<mwette>Maybe I need that for the ffi-helper.
<mwette>to see how call-..vers is used, repl this: ,optimize (export a)
<mwette>Or, (define xl '()) (define foo 1) (set! xl (cons 'foo xl)) ... (call-with-deferred-observers (lambda () (module-export! (current-module) xl)))
<lechner>after removing the exports altogether, I get a sense that the define could be the issue. Is that possible?
<lechner>okay, maybe not. that finished earlier
<lechner>mwette / rlb / i think the big export helped!
<rlb>(I wonder if --statprof (or ,profile) would show anything useful.)
<mwette>The big export uses call-with-deferred-observers once versus define-public calls it for each one.
<dsmith>So does one-big-export get a chance to pre-size the exports hash table (assuming there is one)
<mwette>the deferred thingy looks like the issue to me: https://paste.debian.net/hidden/be4c9950
<lechner>here is the file with the big export list, if anyone wants to play with it https://juix.org/linux.scm
<mwette>dsmith: to your Q, my reading is "no"
<lechner>mwette / well, it definitely works much better. for the public-defines (I didn't wait for the define plus exports to finish) Guile also lost definitions, as in While executing meta-command: Undefined variable: _CS_POSIX_V7_ILP32_OFF32_CFLAGS
<lechner>Hi, what's a way to drop elements with duplicate keys from an association list, please? Don't care which candidate survives.
<mwette>srfi-1 delete-duplicates ?
<rlb>If you mean "drop all duplicate alist entries (wrt key) except the first", then perhaps srfi-1 (delete-duplicates alist (lambda (x y) (eq? (car x) (car y)))), iirc. -- at least if your alist isn't big.
<rlb>(If it's big enough, you might need a fancier "reduction" using a filter set or another, more optimized approach.)
<rlb>(e.g. sort, then compare, or...)
<lechner>hash-table?
<lechner>i can just send the keys through delete-duplicates, I think, followed by map assoc
<rlb>Not sure I understand.
<lechner>rlb / maybe like this? https://bpa.st/IN4Q
<rlb>What are you trying to do overall? Are you only trying to remove duplicate (keywise) alist entries other than the first?
<rlb>if so, what mwette and I proposed above should be sufficient, i.e. one delete-duplicates call.
<rlb>e.g. (delete-duplicates symbol-definitions (lambda (x y) (eq? (car x) (car y)))) or similar.
<lechner>rlb / okay, that's better. thanks!
<rlb>yw