IRC channel logs

2022-06-21.log

back to list of logs

<muradm>hi guile
<muradm>where does '(1 2 3) returned by (l1) is stored? https://paste.rs/CQm
<muradm>even more https://paste.rs/T3C
<daviid>muradm: l1 is a procedure, who's body returns the immutable list composed of the 1 2 and 3 elements - l2 is a procedure that returns a new list at each call, hence they will never be equal to any previous incantation ...
<daviid>never be eq?, sorry
<muradm>damn, even more https://paste.rs/Kq7
<daviid>muradm: you really ned to learn scheme and look in the manual
<daviid>*need
<muradm>daviid: yes i figured out the difference between (list ..) and '(..) no issue with that. i wonder where '(1 2 3) is stored to pass (eq? ..) test
<muradm>daviid: that exactly what i'm doing :)
<daviid> https://www.gnu.org/software/guile/manual/html_node/Equality.html#index-eq_003f
<daviid>muradm: perfect, now you have to accept that's how it is :)
<muradm>daviid: manual didn't answer my question
<daviid>it does, carefully re read
<daviid>'... Return #t if x and y are the same object,'
<daviid>it even gives the exact same example then the one you pasted
<muradm>(define (l1) '(1 2 3)) (define (l3) '(1 2 3)) (eq? (l1) (l3)) returns #f
<daviid>exactly, they are not the same object
<daviid>they are twice an immutable (new) representation of the immutable list composed of 1 2 and 3
<muradm>(define (l1) '(1 2 3)) (eq? (l1) (l1)) returns #t
<daviid>yes, of course
<daviid>just like the manual example
<muradm>so my question is where '(1 2 3) is store to be different in l1 and l3 and same for l1 and same for (eq? '(1 2 3) '(1 2 3))
<muradm>there should be some kind of object cache? basically l1 and l3 looks like dependend type
<muradm>manual does not say that
<muradm>or i didn't see it
<muradm>or memoization may be, not sure
<muradm>what is this behavior would be called in guile?
<daviid>muradm: ask in #scheme, this question has nothing todo with guile in particular, and they have more time to help nbeginners ...
<muradm>guile> (eq? '(1 2 3) '(1 2 3)) => #t
<muradm>chicken> (eq? '(1 2 3) '(1 2 3)) => #f
<muradm>asked in #scheme as you suggested
<muradm>daviid: cse common subexpression elimination https://wingolog.org/archives/2012/05/14/doing-it-wrong-cse-in-guile
<jpoiret>in any case, you shouldn't use eq? to compare lists
<jpoiret>equal? is the way to go
<dsmith-work>Hey Hi Howdy, Guilers
***Furor is now known as Colere
<chrislck>muradm: I am not a scheme expert; you can consider the '(1 2 3) is stored within the procedure definition for l1, and l3 has its own '(1 2 3)
<chrislck>another r7rs-vs-guile question: is (define-module) a guileism and (define-library) the r7rs equivalent?
<chrislck>ditto guile's (use-module) is equivalent to r7rs (import) ?
***X-Scale` is now known as X-Scale
***chris is now known as Guest3103
***chris is now known as Guest5160
***Guest5160 is now known as chrislck
<jpoiret>yes, seems like so
***X-Scale` is now known as X-Scale
***rgherdt_ is now known as rgherdt
<stis>Hej guilers!