IRC channel logs

2023-09-15.log

back to list of logs

<daviid>minima: welcome
<rlb>...I did get the r7rs-benchmarks to run against current main, and that with the utf-8 patches, and from some hacked up matplotlib/xkcd graphs the performance difference wasn't dramatic, tilting both ways, depending on the test. For now, that seemed fine. Though it's also arguably not testing the bits that are more likely to vary -- guessing that those tests are effectively ascii-only.
<mwette> rlb: you are saying you think your implementation favors ascii strings?
<mwette>wrt the previous implementation
<rlb>Sure? i.e. before, non-latin-1 was O(1) (well all strings) for string-set! and string-ref, and UTF-8 can't be. Or rather, with the sparse indexes it might still be nominally O(1) for string-ref (with a higher constant factor), but string-set!'s going to be O(N) more or less.
<rlb>And in the branch, right now, I think there might still be at least some mutation in-place of writable ascii strings -- one of the open questions wrt "what we want" (see the README-utf8-conversion) for more details).
<minima>sorry, if i have a record (an instance as opposed to the type), is it possible to retrieve its type?
<minima>e.g. (record-type first-employee) -> <employee>
<civodul>yes, it’s called ‘record-type-descriptor’
<civodul>or ‘struct-vtable’
<minima>oh nice, thanks ludo!
<civodul>yw :-)
<RhodiumToad>ACTION contemplates transducers
<RhodiumToad>does it seem reasonable/unreasonable/evil/impossible to do a transducer that takes a reducer as arg, uses it to reduce all its input, then (given that the reducer produces a collection of some sort) feeds the elements of that result to its oridinal reducer?
<RhodiumToad>*original
<RhodiumToad>ACTION suspects it to be impossible, based on a defect in the transducer implementation
<RhodiumToad>the problem being that it's impossible to get the correct initial value, since the transduce functions call (reducer) to get the initial value, and not ((xform reducer))
<rrobin_>is there something like -Werror to treat warnings as errors?
<civodul>rrobin: nope, there’s no -Werror
<dsmith>sneek, botsnack
<sneek>:)
<chrislck>sneek: botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been serving for 6 days
<sneek>This system has been up 23 weeks, 5 days, 20 hours, 23 minutes
<dsmith>!uptime
<sneek>I've been aware for 15 seconds
<sneek>This system has been up 23 weeks, 5 days, 20 hours, 35 minutes
<tohoyn>sneek: botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been faithfully serving for 1 hour and 47 minutes
<sneek>This system has been up 23 weeks, 5 days, 22 hours, 22 minutes
<lilyp>minima: since the strings will be properly quoted, that's fine
<lilyp>In fact, Tsukundere uses read+pretty-print for implementing its history loading
<lilyp>(It's a bit of a hack, but it works)
<dthompson>lilyp: how's tsukundere these days? haven't seen you in a lisp game jam in a bit
<lilyp>yeah, it's pretty much in the same state as back when I last entered one
<dthompson>btw the next lisp game jam starts on october 20th! https://itch.io/jam/autumn-lisp-game-jam-2023
<dthompson>ah okay. was just curious. :)
<lilyp>probably have to at least upate it towards newer dependencies
<lilyp>how's chickadee and starling (is that written correctly?) going?
<RhodiumToad>anyone have a good way to loop over the 1 bits in an integer?
<dthompson>lilyp: chickadee is slowly but surely chugging along. trying to get some graphics backend improvements in before the jam. starling got renamed to catbird because it turns out there's already a game engine called starling oops.
<lilyp>RhodiumToad: as in their positions, or …?
<dthompson>still haven't properly released catbird. it's more of a collection of hacks that I drag from game jam to game jam. one day I'll clean it up...
<lilyp>any incompatibilities on guile-sdl2 I need to look out for?
<RhodiumToad>lilyp: yeah, so #b100101 would iterate on 0, 2, 5
<RhodiumToad>ACTION has a solution
<lilyp>I mean good old shift and test would work
<RhodiumToad>(logand mask (- mask)) returns just the least significant 1 bit
<RhodiumToad>and integer-length applied to that gives 1 more than the bit index
<lilyp>hmm, let's both code up our solutions and compete, shall we?
<dthompson>RhodiumToad: have you seen logbit?
<RhodiumToad>yes
<dthompson>does it not work for you?
<RhodiumToad>but that means iterating over 0..n and testing the bits, which isn't good if the value tends to be sparse
<mwette>(rnrs arithmetic bitwise) may help
<dthompson>hmm ok, guess I don't understand what you're doing. carry on, ignore me :)
<dthompson>just wanted to mention logbit? since I used it recently to implement i32.popcnt/i64.popcnt in a webassembly interpreter and I had no idea it existed before I went digging.
<lilyp>tbf popcnt implemented in terms of logbit is constant time :)
<dsmith>I remember a dsp I used to work with had a op that shifted until a bit changed. Was used for converting to floating point. Is that or something like it available on modern machines?
<lilyp>dsmith: IIRC x86 has a popcount instruction among others
<lilyp>RhodiumToad: I think Guile lacks a "lowest set bit" instruction
<lilyp>also called ffs in C
<RhodiumToad>srfi-60 has log2-binary-factors, but it's just implemented as the C version of (logxor mask (- mask 1))
<dsmith>Gcc has _builtin_ffs() (find first set, I believe)
<RhodiumToad>(with logcount applied to the result)
<RhodiumToad>builtins like __builtin_ctz (count trailing zeros), __builtin_clz (count leading zeros) are more usually used
<lilyp>actually, first-set-bit from SRFI-60 should be what you're asking for
<lilyp>(same as log2-binary-factors, but with a readable name)
<RhodiumToad> https://dpaste.org/sXarZ
<lilyp>Why a syntax rule tho
<RhodiumToad>why not?
<lilyp>well, traditionally, for-each takes a proc and calls that with an argument
<lilyp>though I guess you have good (performance) reasons for not doing so?
<RhodiumToad>performance shouldn't be much different
<dsmith>RhodiumToad, I'm curious. What are you are working on?
<RhodiumToad>experimenting, mainly
<dsmith>Nice
<dsmith>Something really nice is when using geiser and ssh tramp into a remote box: It works! Can evaluate expressions there with the remote guile.