IRC channel logs

2022-12-14.log

back to list of logs

<daviid>dthompson: tx again for guile-syntax-highlight, which i have used to produce the code example displayed here https://www.gnu.org/software/g-golf/index.html - but as you cn see, to acheive this, i had to manually tweak a few things
<daviid>dthompson: first i added make and connect to (syntax-highlight scheme), compiled install ...
<daviid>dthompson: then i also manually tweaked the sxml output (which then 'breaks' the automatism, so i wanted to ask, how difficult would it be to enhance the scheme lexer, to (a) detect and name what ever follows a define*, i usd syntax-procedure-name but it would also have to work for var, syntax name ... (b) numbers, i changed those to syntax-numbers, and quoted suymbol, which i named syntax-quoted symbol :)
<daviid>dthompson: oh, and type as well, those goops classes .. which i named, well, syntax-type :)
<dthompson>daviid: well, for (a) anything with "define" at the beginning should get highlighted the same. what isn't working there?
<daviid>dthompson: i am taling about the procedure name, not the define
<daviid>*talking
<dthompson>ah okay
<daviid>dthompson: here is the manually tweaked sxml output, so that i can highlight as showned .. - https://paste.rs/Do6.scm
<dthompson>got it
<daviid>but as i wish it would work for any define or syntax name, better name those syntax-name i guess, so we can highlight var name, syntx name ...
<dthompson>daviid: thanks, I added those 3 things to my todo list. not sure when I'll get around to them as I'm quite busy onboarding at a new job right now.
<daviid>dthompson: ok thanks, let me know ... got luck with your new job!
<dthompson>defined identifiers sounds tricky, but the other 2 sound pretty easy. need to remember how to use all this code I wrote ;)
<dthompson>daviid: thanks! and thanks for the good feedback
<daviid>dthompson: fwiw, htmlize (emacs ...) does the identifier detection, maybe a source of inspiration ... don't know
<daviid>dthompson: lexers are not my domain, i wish i could help you and offer a patch, but ... i'd get a few more white hair then :):)
<dthompson>daviid: haha np!
<dthompson>I kinda built this library by stumbling around... then other people started using it
<dthompson>so it goes
<daviid>dthompson: yeah, I understand - it's a very good library though, thanks!
<haugh>the (ice-9 match) doc describes the (= field pat) pattern as "a ``field'' of an object", but what it appears to do in practice is "apply" `field` to the matched term as in and bind the result according to `pat`.
<haugh>I've never used GOOPS; does this perform differently when the matched term is an instance of a class or something?
<haugh>oof, let me try that again
<haugh>(match obj ((= field pat) exp))
<haugh>APPEARS to evaluate
<haugh>(match (field obj) (pat exp))
<haugh>So I can understand if this is normally used for GOOPS methods or something, but right now the documentation doesn't make any sense to me
<haugh>Okay after reading the inline doc in ice-9/match.upstream.scm, I'm concluding that "field" is just a horrifyingly ambiguous word to use for this concept, which could certainly tolerate further documentation in the manual. It's very useful.
<lloda>dgcampea: afaik (ice-9 match) doesn't support bytevectors at all
<haugh>dgcampea, I appreciate you sending me down the rabbit hole on =
<haugh>(use-modules (ice-9 match) (rnrs bytevectors))
<haugh>(match #vu8(1 53 204) ((= bytevector->u8-list (1 53 last)) last))
<lloda>you also cannot use quote-unquote with bytevectors
<lloda>feels a lot like a late addition tbh
<haugh>is there an efficient way to pop bits off the front of 'em like a port?
<haugh>may have just answered my own question
<haugh>hell yeah, open-bytevector-input-port if anyone cares
<ArneBab>sneek: later tell civodul: thank you!
<sneek>Okay.
<chrislck>ACTION throws the aoc2022 towel after 11a
<dsmith-work>UGT Greetings, Guilers
<chrislck>hmm let's say we have a guile-style struct e.g.
<chrislck> (define (make-account)
<chrislck> (define balance 0)
<chrislck> (lambda (arg param)
<chrislck> (case arg
<chrislck> ((add) (set! balance (+ balance param)))
<chrislck> ((get) balance))))
<chrislck>can anyone convert this lambda to a match-lambda?
<chrislck>... (define balance 0) (match-lambda (('add amt) (set! balance (+ balance amt))) (('get) balance))) doesn't work
<old>you need to use match-lambda*
<old>match-lambda only do (lambda (arg) ...)
<old>while match-lambdas* do (lambda args ...)
<old>no `s' to match-lambda sorry
<old>(define (make-account) (let ((balance 0)) (match-lambda* (('add param) (set! balance (+ balance param))) (('get) balance))))
<old>or this
<old>(define (make-account) (let ((balance 0)) (match-lambda* ((amount) (set! balance (+ balance amount))) (() balance))))
<chrislck>oooh
<old>you can use `match-lambda`, but you would need to pass the arguments in a list
<old>(account '(add 10))
<old>(account '(get))
<chrislck>tx so much, keep forgetting about this match-lambda*
<graywolf>Hello, so, --listen seems to listen on 127.0.0.1:37146, is that correct? How can I make it 0.0.0.0:37146?
<graywolf>(I've tried --listen=0.0.0.0:37146 but that does not seem to be accepted)
<old>--listen is either a port or a path for a unix socket I think
<old>Try: `--listen=37146`
<old>Or try: `--listen=/home/me/guile.socket'
<old>I don't think you can change the host part otherwise
<old>Right. From ice-9/command-line.scm: ((@@ (system repl server) make-tcp-server-socket) #:port ,port))
<old>So #:host is always #f which means it's always the loopback address
<graywolf>old: ah, I see, shame; so I guess I'll solve it by ssh forward
<graywolf>but thanks :)
<old>graywolf: You could do something similar in your .guile configuration
<old>Add something like: (@@ (system repl server) make-tcp-server-socket) #:host "0.0.0.0" #:port port)
<old>Ofc that will apply to every instance of guile run by the user .. so maybe not the best solution here
<old>there: https://paste.sr.ht/~old/6e0d9047aa7c2afe472c63e0e19ca3e93cf7bade
<old>Now you could do GUILE_LISTEN="0.0.0.0:37146" guile do get a repl opened there
<old>just put it in ~/.guile :-)
<old>You should pass the resulting socket to `spawn-server' of course
<graywolf>Oh, that is cool! :)
<graywolf>Thank you :)