IRC channel logs

2019-12-04.log

back to list of logs

<marusich>The Guile manual doesn't talk about any scheme libraries for tree data structures or priority queue data structures (e.g., a min-heap). Do they exist in Guile, or is one expected to use a third-party library or roll their own if they need such data structures?
<daviid>marusich: if something, it will be listed here http://sph.mn/foreign/guile-software.html
<daviid> https://savannah.nongnu.org/projects/guile-aa-tree/
<marusich>Oh, neat page! Thank you for the link.
<daviid>welcome!
<daviid>str1ngs: I pushed a series of patches, mainly to add g-unix-fd-add (and removed g-io-add-watch-fd0, which is a better solution to watch a file descriptor (and slightly more efficient as well), so ... whenever you may, please push and run the make dance ... then, the fd watch example becomes this - https://paste.debian.net/1119386/
<daviid>str1ngs: I still need to work a bit more on this, becaus they all need an optional priority argument, then add soe doc for closures and these idle-add, ... g-unix-fd-add, then get back to work on signals ...
<manumanumanu>marusich: I am just uploading 2 heap datastructures if you are interested. One vector-based mutable heap and a functional pairing-heap.
<RhodiumToad>actually I'm interested in that last one, since pairing heap is one of my usual "learning a new language" exercises
<manumanumanu>RhodiumToad: https://hg.sr.ht/~bjoli/data-structures
<manumanumanu>and of course marusich ^
<manumanumanu>in my benchmarks, it has been ever so sliiightly faster than a leftist tree
<manumanumanu>found a persistent fifo as well. Will add that
<marusich>Thank you for the link!
<zig>marusich: there is srfi libraries also. Not sure about priority queue, but there is red-black tree as known as mapping.
<zig> https://srfi.schemers.org/srfi-146/
<davidl>How do you setup the M-. to jump to an object definition in emacs? I did the add-to-load-path stuff as explained here> https://guix.gnu.org/manual/en/html_node/The-Perfect-Setup.html but it didn't help for the files in that folder. Im still getting the "Couldn't find edit location for.." error.
<davidl>I mean the add-to-list stuff.
<zig>I do not use jump-to-definition, I use silversearcher-ag
<zig>ymmv
<davidl>zig: ok, and you think that is a better tool?
<zig>davidl: it works all the time, I have an emacs bindings for it as C-x C-r overriding the default tool that rely on grep.
<zig>davidl: In guile I do not rely on jump-to-def, but I know it helps in other programming languages, so maybe it is worth settings. The thing is that I always end up using ag or grep
<zig>the drawback of ag or grep is that it look in given directory, it can not search for the entire dependency graph.
<zig>so it doesn't work all-the-time.
<zig>like I wrote earlier.
<davidl>zig: still sounds like a nice tool. I can still use the geiser stuff to look up built-ins, and then ag for my own code. Ill see if I can set it up.
<zig>davidl: I started using ag *because* of the binding C-x C-r that is very handy. There is also C-x r to find a file (it support globing).
<zig>related to ag vs grep... I don't know, I use ag because it is said to be faster, but I can work with grep.
<zig>davidl: btw, talking about file navigation and emacs. I have also bm (aka. bookmark) extension set up. So, there is the following ways I navigate code: C-x C-f to find a file, C-x b to go back to previous buffer or navigate most recently used buffer, C-x C-r to find the definition or uses of a given symbol, then I also rely on manual bookmark using bm and at last I use marks with M-x pop-global-mark and M-x
<zig>pop-to-mark-command
<zig>(global-set-key (kbd "C-c <right>") 'pop-global-mark)
<zig>(global-set-key (kbd "C-c <down>") 'pop-to-mark-command)
<zig>also I extensively use C-s and C-r to search in the current buffer.
<zig>pop-fu-mark work somewhat like internet browser history.
<davidl>zig: your setup seems pretty good. I also got ag setup now and I think its gonna be worth it. Especially the ag-project command seems very useful; for refactoring.
<davidl>zig: so I figured out how to use the geiser-edit-symbol-at-point function; you need to make your scheme file into a module with (define module (mymodule)) and then load the module in the REPL before it works.
<manumanumanu>zig: Andy actually wrote a HAMT-mapping that I added some extra features to: https://hg.sr.ht/~bjoli/guile-fash/browse
<manumanumanu>What it lacks is actually removing mappings, but you could hack that with a <hamt-null> value.
<manumanumanu>The downside being: we are using the current thread as the boundary for when a transient is allowed to be used, which means it probably won't play well with fibers.
<manumanumanu>the same is true for the fectors.
<manumanumanu>(in another repo).
<manumanumanu>Because I suspect a single fiber will be executed over different threads.
<str1ngs>sneek: later tell daviid. looks good thanks.
<sneek>Got it.
<manumanumanu>I have done more funny things than writing tests using guile's test suite...
<manumanumanu>About hash tables: is there any reason to _not_ associate an equality predicate with the hash table upon creation? mixing hashq, hash and hashv seems like a bad idea.
<manumanumanu>I have been using the r6rs hash tables because of that. Now I have to write a procedure that supports all 3 kinds, and not associating an equality predicate complicates things :D
<jcowan>manumanumanu: the native Guiel hash tables are really messy because of that, which is why SRFI 125can't be layered on top of them (but work fine on R6RS hash tables)
<manumanumanu>jcowan: I don't really understand _why_ though. Maybe some C interop?
<jcowan>Shortsightedness, mostly, I think
<jcowan>It's obvious in hindsight that a hash table should support an arbitrary hash function and equivalence predicate, and should provide a way, given a hash table, to make another hash table just like it but empty (short of copying and deleting)
<jcowan>But (at least as of 2015 when I wrote SRFI 125) Gauche, S7, SISC, Scheme48, RScheme, Scheme 9, Rep, Femtolisp, and SCM all failed this test
<manumanumanu>Hash tables seem a little bit like an afterthought for scheme in general :)
<jcowan>Every Scheme has to have one to hold symbols, and the common thing is just to expose the internal API.
<manumanumanu>ah. Because scheme generally has a few well thought out, well chosen primitives. Hash tables seem clunky in just about every scheme out there
<dsmith-work>Hey Hi Howdy, Guilers
<zig>it is clunky based on Scheme standard of clukyness, see other languages hash table are much less featured that the one in e.g. guile.
<zig>o/
<jcowan>One of my objectives with the R7RS-large SRFIs is to improve the mindset that says "<container>s are really the Right Thing here, but there are so many more convenience procedures for lists; I'll use lists."
<manumanumanu>btw: does anyone know how to write a function with multiple arities in texinfo? Not optional arguments, but 2 distinct arities.
<zig>jcowan: the next docket is orange docket? ref: https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/ColorDockets.md
***jao is now known as Guest35115
<jcowan>zig: yes
<jcowan>the bottleneck right now is writing implementations
<zig>I am not very knowledgeable in the subject touched by orange docket, but I could learn... but I am busy with my search engine stuff.
<manumanumanu>ah, @deffnx
*jcowan laments: everybody's busy
*zig nods
<manumanumanu>jcowan: I am elbows deep in writing a srfi from my for loops, fyi :D I simplified the implementation a bit to allow for easier porting
<jcowan>awesome, link?
<manumanumanu>jcowan: no document available for reading just yet, but the for loops can be found here: https://hg.sr.ht/~bjoli/guile-for-loops
<manumanumanu>The documentation on man.sr.ht is out of date, but the docs in the repo are correct.
<manumanumanu>Ignore the "Going forward" part. That is a dream right now :D
<manumanumanu>The changes has been mostly to the #:incr and #:decr part. Now there are specific macro forms instead: (in-range a b #:incr c) becomes (in-range/incr a b c).
<manumanumanu>and removing some things that led to phasing issues in porting to chez.
<manumanumanu>with the downside of compiler errors when "unsupported" sequence creators were used.
<jcowan>long long ago I was working my way through the manual for a proprietary library for terminal control
<jcowan>it was for version 1.0, and I noticed that many routines were marked "1.5 only" or "2.0 only"
<jcowan>On investigation these turned out to mean "We want this but haven't gotten to it" and "This would be great to have, but we have no clue how to do it"
<manumanumanu>:D
<manumanumanu>I know how to do that, making sequence creators return syntax objects and bending hygiene.
<manumanumanu>But it adds little (over for/fold) and complicates things.
*jcowan nods
<jcowan>IMO syntax-parameters are a Really Good Thing; unfortunately they cannot be implemented portably
<jcowan>Note that you will have to relicense or dual-license your code under the SRFI (= MIT) license
<manumanumanu>Sure thing. I did that with the transducers srfi as well. SRFI license or ISC-ish.
<zig>does anybody know a website that is HTTP without TLS, I need it to test something quickly
<zig>that is http://example.org/
<zig>weird behavior: scheme@(guile-user)> (string=? 'symbol)
<zig>$5 = #t
<jcowan>It probably returns #t without checking if there is just one argument
<jcowan>er, if there is just one argument it returns #t without checking anything
<wingo>that is weird behavior tho
<dsmith-work>Also returns #t for no args.
<dsmith-work>!
<manumanumanu>dsmith-work: that is less surprising.
<manumanumanu>that is just the functions identity.
<dsmith-work>I understand, but it still doesn't sit right for me. (*) and (+) make sense to me, for example.
<dsmith-work>I guess no string is pretty much equal to another no string..
<manumanumanu>dsmith-work: I think that is just the case for all equality predicates.
<dsmith-work>Hmm. Never realized that before.
<manumanumanu>I found it handy when writing some macros. Not having to check the amount of arguments, just being able to rely on the predicate having an identity and the partial evaluator to solve the rest :D
<manumanumanu>Kent Dybvig has a nice talk on youtube about "the macro writer's bill of rights" which touches on the subject.
<dsmith-work>Cool. Sounds interesting!
<manumanumanu>I recommend it to everyone with questions about how to manage macro complexity
<manumanumanu>I learned by watching the output of ,expand and ,opt, which makes these things a lot easier.
<zig>manumanumanu: do you know if ,expand can be turned into a procedure that I can use in guile code? like chez expand procedure?
<manumanumanu>zig: there was a thread on guile-user not too long ago about someone wanting an expand-1 where Mark had some tricks up his sleeve
<manumanumanu>zig: but try: (macroexpand ...)
<manumanumanu>:D
<manumanumanu>that expands into tree-il iirc
<dsmith-work>zig: Everytime I see your nick, I have this desire to spout "FOR GREAT JUSTICE!"
<zig>dsmith-work: it is not a reference to the game, but thanks for noticing. It is a word in french that means 'dude' or 'person'
<dsmith-work>Ah
<zig>I am feeling lucky :)
***jao is now known as Guest11460
<jcowan>If we define equality as "false if any pair is different, otherwise true", then the behavior of 1-arg and 0-arg equality makes sense
<jcowan>CL defines /= as "true if all elements are distinct", which means it basically has to sort its arguments
<zig>fwiw, chez has a different approach, every argument must be of string type: Chez Scheme Version 9.5
<zig>Copyright 1984-2017 Cisco Systems, Inc.
<zig>> (string=? 'symbol)
<zig>Exception in string=?: symbol is not a string
*jcowan nods
<jcowan>Scheme is very flexible about "it is an error" situations
<manumanumanu>talking about errors, the new guile error system is neat!
<jcowan>manumanumanu: Pointer?
<decent-username>I acidentally shut down my connection to freenode and didn't notice it.
<decent-username>Q . Q