IRC channel logs

2024-06-13.log

back to list of logs

<cpli>why doesn't this pick out any hyperdiagonal? (define (array-diagonal a) (let ((rank (array-rank a))) (make-shared-array a (cut make-list rank <>) `(0 ,rank))))
<cpli>i.e. which mapping is actually out of range here?
<cpli>when trying to (array-diagonal #3(((1 2) (3 4)) ((5 6) (7 8))))
<cpli>or for a more self-contained example: (make-shared-array (apply make-array 0 '(2 2)) (cut make-list 2 <>) '(0 2))
<cpli>this creates a #3(((0 0)) ((0 0)) ((0 0) (0 0))) and all i'm asking for is the diagonal: #3(((1 0)) ((0 0)) ((0 0) (0 1)))
<euouae>Hello
<euouae>I'm making an Arkanoid game clone and I've realized I need a collision engine and I'm really procrastinating it :)
<efraim>if I have (map function1 (map function2 (list ...))) is there a way to combine the two maps or is it not worth it?
<civodul>efraim: yes, you can do (map (compose function1 function2) (list …))
<janneke>and then add cute, conjoin, and disjoin :)
<civodul>yup, we miss conjoin and disjoin!
<janneke>yeah, been cargo-culting those for quite some time now... https://git.savannah.gnu.org/cgit/dezyne.git/tree/dzn/misc.scm#n45
<janneke>[why] isn't there a srfi for those/such things?
<civodul>good question!
<civodul>i would be in favor of adding them upstream, maybe next to ‘compose’
<civodul>but that’d be in boot-9.scm, in the global set of bindings
<civodul>last time we expanded the set of global bindings, it wasn’t universally acclaimed :-)
<ArneBab>janneke: maybe you could add a SRFI for those?
<kjartanoli>What do they do?
<janneke>civodul: that makes sense, we can always see what the universe thinks of such a patch this time :)
<janneke>kjartanoli: are the doc-strings that bad?
<janneke>civodul: oh wait, that would be tricky as they (currently) use `any' and `every'...hmm
<kjartanoli>janneke: I think I'm understanding them at this point.
<janneke>kjartanoli: good, suggestions always welcome :)
<flatwhatson>there is SRFI 235 for conjoin and friends: https://srfi.schemers.org/srfi-235/srfi-235.html
<janneke>flatwhatson: ah, great!
<janneke>now we "just" need srfi-235
<flatwhatson>it's implemented here: https://github.com/scheme-requests-for-implementation/srfi-235/
<flatwhatson>they all seem pretty straightforward, not the kind of thing that needs impl-specific treatment
<flatwhatson>and the unit tests imply guile is supported already!
<flatwhatson>so it's probably just a matter of adding a guile-srfi-235 to guix from that repo
<flatwhatson>(though i guess it would be even more useful/used if it came in guile core)
<janneke>(yes)
<trev>is there a good one liner to convert an exception to a concise string?
<trev>something simpler than (format #f ... (exception-message) ... )
<trev>i'm going to just use (exception-message err) as a format string for now
<kjartanoli>trev: Does exception-message not already return a string?
<trev>kjartanoli: returns a string, but with a format arg in it, ex "~S"
<trev>then i use (exception-irritants err) to fill the arg...i'm sure it is incorrect though
<cpli>(if (pair? x*) (every (cut = (car x*) <>) (cdr x*)) vs (apply = x*)
<cpli>are unbounded argument lists harmful?
<cpli>i.e. using them in that fashion..