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. <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. <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. <identity>lechner: you do not need either of those for normal-order evaluation, you can just put stuff in thunks <identity>in fact, most SRFIs are just fancy wrapping and portable libraries that you could write in RⁿRS Scheme, with notable exceptions <lechner>Hi, I have a source file with about six thousand define-public's. Compiling takes ten minutes. Why? <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 <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>nvm, i can do define plus export if that helps. <rlb>If it's plausible, might try one bit #:export (...) too. <rlb>I'll also be surprised if that helps, but... <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) <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>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. <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>i can just send the keys through delete-duplicates, I think, followed by map assoc <rlb>Not sure I understand. <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.