IRC channel logs
2021-05-14.log
back to list of logs
<rekado>terpri: I would love to help in whatever way I can to revive guile-emacs! I have been blindly rebasing and poking things, but I never got it to work with slightly more recent versions of Emacs and/or Guile, because I don’t know what I’m doing. <mbakke>rekado: matplotlib installs jquery to a nonsensical directory, i.e. it has been broken a while. should it be updated or removed? <rekado>matplotlib is pretty essential for this whole science Python thing. <taylan>wingo: quick question: how is (equal? x y) compiled? doesn't seem to call scm_i_equal_p from eq.c unless I eval it. <taylan>or at least does some quick-fail stuff before calling it. <taylan>I seem to have found it: module/language/tree-il/compile-cps.scm, starting from line 2477 there's some quick-success and quick-fail cases being added to eqv? and equal? calls <manumanumanu>taylan: If any of the variables are comparable using eq? or eqv?, the comparison is cahnged to that. At least if it can be decided during compile time I don't know if that helps you <RhodiumToad>it looks like that at compile time it also peels out one layer of "eq?" comparison <RhodiumToad>i.e. if the values are eq? then they must also be eqv? and equal?, if they're not eq? then they're eqv? if they are equal numbers, <RhodiumToad>if they're not eq? and one or other is not a heap object then they can't be equal? <taylan>yeah, (equal? x y) is compiled to (if (eq? x y) #t (if (or (immediate? x) (immediate? y)) #f (c-equal? x y))) <taylan>(it's compiled to something equivalent to that in logic, I mean) <taylan>(the immediate? and c-equal? above are pseudo-code) <RhodiumToad>I should have said that "if they're not eq? then they're eqv? IFF they are equal numbers" <taylan>ugh, apparently there's a further place where (equal? #nil '()) gets optimized to #f, because now I get #t when I (define (test x y) (equal? x y)) then call (test #nil '()), but if I compile (equal #nil '()) directly it's #f <taylan>of course, it constant-folds it. now on to find where that happens... :P <taylan>oh nice, that was easy, since I had already looked around module/language/tree-il/peval.scm before. <RhodiumToad>you defined an equal? that treats #nil and '() as equal? <taylan>I think it makes sense but maybe I'm missing something. I'll let the higher ups decide :P <RhodiumToad>I think having them be equal? but not eq? will be a problem. <terpri>RhodiumToad, it might be equal to both <terpri>it ought to be equal to both, i should think <RhodiumToad>the problem is that equal? must be transitive, and '() is not equal to #f <terpri>(boolean? #nil) ⇒ #t, (not #nil) ⇒ #t, (null? #nil) ⇒ #t <terpri>RhodiumToad, you're quite right, thanks for dredging up memories of logic class :p yeah, that would make equal? not an equivalence relation which is required by r5rs <taylan>yeah, I made it equal to '() but not #f based on the assumption that we want to keep the transitiveness of equal? <terpri>i think i got confused by the different behavior in elisp, where #nil, '() and #f are all equal <RhodiumToad>it's exactly that different behavior that leads to having #nil in the first place <roptat>I have a C source file with a function that takes a pointer to a structure as argument in my project, and I'd like to call it from guile. How can I create the structure pointer in guile (ideally at compile time), and how can I call that function? <roptat>I'm not sure where to look at in the manual <roptat>mh, I've used foreing interface before, to use code from other libraries, but this time I it's a C source file from my own repo, so I think I want an extension instead? <roptat>but all the examples I see are about using int and double