IRC channel logs

2023-01-30.log

back to list of logs

<old>Does the GC scan pointers created with make-c-struct, which may contain pointer of Scheme objecT?
<old>For example: (let ((foo (make-foo))) (make-c-struct (list '*) (list (scm->pointer foo))))
<daviid>old: you need to keep a 'hard' ref to the result of make-c-struct calls, unles they'd be gc'ed
<daviid>*unless/otherwise they'd be gc'ed
<old>yes but is keeping only a reference to pointer of the c-struct enough?
<old>In other words, is `foo' protected if I only keep the result here?
<old>Right now I do keep a reference of `foo' somewhere
<old>But it seems like a duplication of data :-/
<daviid>i am not entirely sure - do you have some code that shows you need to ?
<daviid>try to release the foo hard ref and call the gc -
<old>I'm not sure either. It's a tricky part since `foo' is actually a callback in an event loop in C
<old>I prefer to be on the safe side here and keep a hard reference to it to avoid any segmentation fault
<daviid>old: we hould be able to try imple things in the repl
<old>right
<old>a simple example should suffice here
<old>oh well I do get `foo' in a guardian even though a pointer of it is store in a C struct
<old>that answer my question then. I need a hard reference
<daviid>old: yes, same here, i tested as well -
<sneek>civodul: Greetings :D
<abrenon>hello
<abrenon>I've found a link in the documentation pointing to a google site asking for some authentification
<abrenon>is that expected ?
<abrenon>it's in https://www.gnu.org/software/guile/manual/html_node/Syntax-Rules.html (link right before the footnotes: [syntax-rules Primer for the Merely Eccentric](http://sites.google.com/site/evalapply/eccentric.txt))
<civodul>abrenon: hi! that's surprising indeed
<abrenon>I thought so : )
<abrenon>I was trying to learn the syntax for function composition in guile (because since '.' is taken for cons, I have no idea what could be used for composition)
<abrenon>and stumbled upon this
<civodul> https://web.archive.org/web/20121107170134/https://sites.google.com/site/evalapply/eccentric.txt eventually gets to the text
<abrenon>nice trick, thanks !
<BitPuffin>hey everyone!
<BitPuffin>trying to build an epub version of guile manual for my ebook reader but can't get my guix version of texi2any get it to understand that I did in fact install perl-archive-zip
<civodul>abrenon: also: https://gist.github.com/tomjakubowski/3c381534697edeb91343296bb619e7c4
<civodul>BitPuffin: does it work if you do "guix shell texinfo -- texi2any ..."?
<civodul>never tried the epub output
<abrenon>thanks again ! But I haven't found anything regarding function composition in the document (or it's called something else)
<abrenon>maybe it's not idiomatic to express things in terms of composition in guile ?
<BitPuffin>civodul: nope
<BitPuffin>this also did not work
<BitPuffin>guix shell texinfo perl-archive-zip -- texi2any --epub3 guile.texi
<BitPuffin>it just says texi2any: Archive::Zip is required for EPUB file output
<BitPuffin>
<flatwhatson>abrenon: https://www.gnu.org/software/guile/manual/html_node/Higher_002dOrder-Functions.html
<BitPuffin>to be fair this problem is probably more fore #guix
<BitPuffin>but it would be nice to have guile manual in epub!
<civodul>BitPuffin: oh, this appears to work: guix shell texinfo perl perl-archive-zip -- texi2any --epub3 guile.texi
<civodul>but really, it's an omission in the 'texinfo' package in Guix
<BitPuffin>hmm no actually it probably makes sense with how guix works
<BitPuffin>since the environment variables for search paths are in the perl package rather than the perl dependencies
<BitPuffin>but hmm I guess you're right though that texinfo package should also define those search paths
<civodul>yeah
<BitPuffin>not sure if I just pass it guile.texi to build the epub correctly though haha
<BitPuffin>haven't used texinfo before so
<abrenon>exactly what I needed thank you !
<BitPuffin>oh the pdf for guile seems to be built with docbook rather than texinfo
<BitPuffin>has anyone tried to get the nanopass framework working in guile?
<sneek>Yey! dsmith-work is back!!
<dsmith-work>Monday Greetings, Guilers
<dsmith-work>Work inet is really flakey lately.
<old>sneek now detects joined?
<dsmith-work>Sometimes. On people he likes.
<count3rmeasure>perhaps a silly question but... If I wanted to calculate directly in hex, and get the return value in hex, what is the best way to do that, if its possible? Am I going to have to convert to integers first?
<old>What do you by retrun value in hex?
<old>There's a hex reader for number, e.g #xaf
<old>But the `return' value is a number
<old>If you want a reprensetation in hexadecimal: (number->string x 16)
<count3rmeasure>right, I mean if I'm subtracting to hex numbers then I get back a hex number, wanted to try it without having to do conversions
<count3rmeasure>so (- 0x7ffff7f52000 0x7ffff7f52000) returns 0x4000
<count3rmeasure>and by asking I just realized I'm going to have to do a conversion anyway from a string in hex, so I guess it doesn't matter, but I'm still curious
<old>your example return 0 btw
<old>and it would be #x7ffff7f52000
<count3rmeasure>yes it does
<old>to have a number directly
<count3rmeasure>i copied the wrong number into the second position
<count3rmeasure>good catch
<old>okay
<old>If you want to create a number from a string "0x7ffff7f5200" you need to remove the `0x' prefix and passe the result to `(string->number <> 16)'
<count3rmeasure>word! thank you for that
<old>so you need string->number and number->string
<lloda>numbers are numbers. hex is just the representation, so 'hex number' is always a string
<old>true
<count3rmeasure>I get that
<count3rmeasure>but if the representation is consistent across the the data structures that consume these numbers I would prefer to keep it in hex, especially since its easier to read and reason from when I need to debug
<count3rmeasure>hence the question
<dsmith-work>Numbers inside modern machines are *always* binary. In ages past there was also decimal. BCD (Binary Coded Decmial) actually.
<mwette>don't forget about ternary: https://en.wikipedia.org/wiki/Ternary_numeral_system
<old>BCD still exists in some embedded system no?
<old>For some very specific problematic. I can't remember what
<old>Oh I think it was bank or something. Did not want to lose any cent! Something like that
<mwette>BCD may exist in hand calculators - it was used in early (at least) HP's
<dsmith-work>BCD was popular on mainframes (like IBM System/360 and successors) becuse Money.
<dsmith-work>Maybe still is? I've been away from that for about 40 years.
<old>I also remember the CORDIC algorithm
<old>somehow it was related to BCD
<old>Right Wikipedia says that CORDIC was used on pocket calculator that were using BCD
<dsmith-work>A friend of mine sometimes mentions base 1 numbers. I just can't wrap my head around that.
<dsmith-work>A long time ago I was working in Forth, and was printing out BASE.
<dsmith-work>Took the longest time to figure out why it was *always* 10, even though I set it to 16, 8, 2 whatever..
<dsmith-work>!uptime
<sneek>I've been running for 27 days
<sneek>This system has been up 13 weeks, 5 days, 17 hours, 9 minutes
<dsmith-work>There's a good bot
<rendar>guile runs some scheme interpreter?
<old>Base 1 numbers would mean that you could encode 1^N numbers with N cells
<old>In other word, you can only encode 1!
<old>I can't even think of a physical way of encoding a base 1
<dsmith-work>Yep. My head explodes thinking about it.
<old>sneek: apropos string->number
<sneek>(guile): string->number #<procedure string->number (_ #:optional _)>
<old>sneek: what is base 1 number?
<dsmith-work>sneek: guile help string->number
<dsmith-work>sneek: guile help cons
<sneek>No documentation found for:
<sneek>(srfi srfi-1): cons
<cwebber>hello hello!
<dsmith-work>ACTION waves
<cwebber> https://spritely.institute/news/spritely-goblins-v010-for-guile-and-racket.html :D
<cwebber>:D :D :D