IRC channel logs

2021-07-20.log

back to list of logs

<iskarian>Is there a way, given a sexp, to get a list of all the symbols that would need to be defined if that sexp were evaluated?
<iskarian>s/symbols/variables/
***rt is now known as robin
<maximed>sneek: later tell iskarian: Maybe compile the S-exp to Tree-IL, and search for "toplevel-define" forms?
<sneek>Welcome back maximed, you have 1 message!
<sneek>maximed, civodul says: re -fexcess-precision=standard, well done! \o/
<sneek>Got it.
<tohoyn>I have a cyclic list structure containing elements of the form (singleton xxx) where xxx is arbitrary data (possibly containing other singletons). How can I replace each (singleton xxx) with xxx so that cycles are handled correctly?
<leoprikler>do the singletons themselves also contain cyclic structures?
<leoprikler>if not, you could simply try a cycle-respecting map
<leoprikler>(if you also want to expand inner singletons, then recursively apply it)
<tohoyn>leoprikler: yes, they do
<tohoyn>leoprikler: we may assume that all cycles point to singletons
<leoprikler>I'm not sure if "all cycles point to singletons" is a helpful property here
<tohoyn>ok
<leoprikler>like, if you have a cycle, what should be the result?
<leoprikler>still a cycle?
<leoprikler>or should it be merged into the larger result in the way that "fringe" would operate?
<tohoyn>leoprikler: consider list (singleton (a (b /cycle/))) where /cycle/ points to the whole list
<tohoyn>leoprikler: now the list should be transformed to (a (b /cycle2/)) where /cycle2/ points to the whole new list
<leoprikler>IIRC the reader has to handle a similar problem, but there those occurrences are already labelled #1# #2#, etc.
<tohoyn>ok
<dsmith-work>UGT Greetings, Guilers
<tohoyn>leoprikler: can you give a link for reading circular lists? I tried to google but didn't find it.
<leoprikler>I think it's SRFI 38
<tohoyn>ok. tx
<tohoyn>here is an initial implementation for singleton removal with list structures having integers as leaves: https://paste.debian.net/1205033/
<tohoyn>the following expression causes guile interpreter to hand: '(#1=(1 2 3 #1#))
<tohoyn>s/hand/hang/
<iskarian>ah, maximed, I did consider that, but I didn't realize that it made a distinction between references that were satisfied by the sexp itself and those that were external
<sneek>iskarian, you have 1 message!
<sneek>iskarian, maximed says: Maybe compile the S-exp to Tree-IL, and search for "toplevel-define" forms?
<iskarian>sneek, botsnack
<sneek>:)
***apteryx_ is now known as apteryx
<iskarian>So it seems like only record types are resolved, not exported variables
<drakonis> https://github.com/mwette/guile-contrib/blob/master/patch-2.2.4/load.patch this is p. great.
<drakonis>what would it take to merge a patch for adding #lang?
<drakonis>actually, this one's still not cooked up enough