IRC channel logs

2017-04-13.log

back to list of logs

<solrize>hi does guile have any built-in dictionary libraries?
<solrize>oh ok, hash tables
<solrize>nm
<solrize>guile hash tables don't seem to have a way to test for membership, like hash-exists? in srfi-69 :/
<wingo>hashq-get-handle
<wingo>also guile has a srfi-69 module if you prefer that
<solrize>yeah i imported srfi-69 and that works. i thought of using get-handle but it didn't seem right. if you're saying that's decent style then i'll use it
<solrize>it's been a while since i've done any of this
<solrize>thanks
<solrize>is there a functional (persistent) dictionary available? avl tree or whatever i mean
<solrize>like Data.Map in haskell
<wingo>not in guile core, besides alists of course
<wingo> https://wingolog.org/pub/fash.scm is an option
<civodul>or vhash!
<wingo>ah yes indeed
<wingo>look in manual for vhash :)
<civodul> https://www.gnu.org/software/guile/manual/html_node/VHashes.html
<civodul>we should add more though
<civodul>fash looks cool
<random-nick>are VLists slower to iterate than lists?
<civodul>in 2.0 i think they're slower
<civodul>we'd have to check if this is still the case in 2.2
<civodul>vlists have better cache locality but there's a bit more code to run to walk them
<civodul>so it's very dependent on the VM speed
<random-nick>also, aren't alists functional?
<civodul>yes, if you don't mutate the pairs
<random-nick>solrize: you can also make your own since guile exposes the hash function used in hashtables to scheme
<solrize>oh I missed the above discussion. random-nick you can't use hashes for that because the idea is the maps aren't mutable
<solrize>i.e. instead of (insert! map key item) you'd use (set! map (insert map key item)) if you wanted to update in place
<solrize>but the idea is, insert returns a new map that shares most of its structure with the old map, usually a balanced tree
<solrize>so you can have multiple snapshots active at the same time
<random-nick>solrize: there are many functional maps that use hashing
<solrize>random-nick, hmm, how do you insert stuff?
<civodul>solrize: you can check the vhash doc above
<civodul>it's similar to how you'd use alists with alist-cons etc.
<solrize>k
<random-nick>solrize: one I've seen is a prefix tree with a hash of the keys
<solrize>hmm it's pretty late here, i better zonk out, will look at this tomorrow, it looks interesting
<solrize>is insertion and deletion still O(log n) ?
<wingo>yep
<wingo>it's a phil bagwell thing :)
<civodul>for vhashes insertion is O(1) and deletion is O(n) IIRC
<civodul>it's not a tree-shaped structure
<wingo>hmm, you could be right.
<random-nick>alists have constant time insertion too
<wingo>it's just lookup that's o(log n) then
<wingo>fash is log n tho!
<lloda>paroneayea: re: truncation in the repl, in the mail daviid linked above, address@hidden should ofc be ~@y. It does work and it seems to me it's the intended method. It could be simpler, maybe. I mean it's already a one liner.
<lloda>for exceptions it's a different story
<nalaginrut>Artanis' brand new server core Ragnarok works just now! It's too fast to upload a 800M file so that I can hardly test the green-thread blocking issue ;-P
<wingo>:)
<wingo>what do you use for green threads?
<wingo>^ nalaginrut
<dsmith>Greetn's Guilers
<dsmith>Before I sumbit a bug report, this *ought* to work? echo '(help cons)' | guile
<dsmith>for 2.2
<dsmith>sneek: bugs?
<sneek>bugs is send reports to bug-guile@gnu.org, and see bug reports at http://bugs.gnu.org/guile
<lloda>dsmith: it seems to work here. You don't get what you expect?
<dsmith>stat("/usr/local/share/guile/guile-procedures.txt", 0x7ffd5f923330) = -1 ENOENT (No such file or directory)
<dsmith>stat("/usr/local/share/guile/site/2.2/guile-procedures.txt", 0x7ffd5f923330) = -1 ENOENT (No such file or directory)
<dsmith>stat("./guile-procedures.txt", 0x7ffd5f923330) = -1 ENOENT (No such file or directory)
<dsmith>write(1, "No documentation found for:\\n", 28No documentation found for:
<dsmith>) = 28
<dsmith>write(1, "(srfi srfi-1): cons\\n", 20(srfi srfi-1): cons
<dsmith>) = 20
<dsmith>
<dsmith>
<lloda>weird, I get:
<lloda>echo '(help cons)' | guile
<lloda>GNU Guile 2.2.0.25-d9e858
<lloda>Copyright (C) 1995-2017 Free Software Foundation, Inc.
<lloda>
<lloda>Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
<lloda>This program is free software, and you are welcome to redistribute it
<lloda>under certain conditions; type `,show c' for details.
<lloda>
<lloda>Enter `,help' for help.
<lloda>`cons' is a procedure in the (srfi srfi-1) module.
<lloda>
<lloda>- Function: cons _ _
<lloda>
<lloda>scheme@(guile-user)>
<lloda>
<lloda>try -q maybe?
<nalaginrut>wingo: similar to what you did in built-in server, but I've made a more powerful one
<nalaginrut>wingo: maybe we should call it 'coroutine'
<dsmith>lloda: Run guile under strace
<dsmith>Is yours looking in the same place as mine?
<lloda>it looks in PREFIX/share/guile/2.2/guile-procedures.txt, so w/o the 'site'
<lloda>it also looks in the other place later, though
<dsmith>Hm.. It *is* finding my guile-procedures.txt, I wasn't looking at the whole strace output.
<dsmith>But it's still not finding cons in it
<dsmith>!!
<dsmith>Woah. When I grep for cons, I get acons, cons*, and cons-source only
<wingo>everythign is weird
<lloda>yeah, cons isn't in guile-procedures.txt. If /I/ use guile -q, my guile doesn't find cons either. But I have (import (texinfo reflection)) in my .guile, so if I don't use -q, it seems to find doc for cons through that.
<lloda>anyway there're TONS of basic functions that return 'No documentation found'.
<dsmith>Odd
<dsmith>So guile *is* finding things in the .txt file, cons is just no longer there.
<lloda>I was going to say 'if it ever was', but 2.0 does have it. Hmm.
<dsmith>No problem I guess. Except that the help for cons went away. Not that I need to see it. It was just my goto help example.
<dsmith>as in
<dsmith>sneek: guile help cons
<sneek>`cons' is a procedure in the (guile) module.
<sneek>- Scheme Procedure: cons x y
<sneek> Return a newly allocated pair whose car is X and whose cdr is Y.
<sneek> The pair is guaranteed to be different (in the sense of `eq?') from
<sneek> every previously existing object.
<dsmith>Because it's short enough to display in the channel. A longer message would be private.
<dsmith>Sorry for the noise.
<ertes>hi… i have the following problem: guile is not installed at a standard location, so i can't easily use any of the hacks that guile provides to make a script executable
<ertes>doesn't work: #! /usr/bin/env guile -s
<ertes>doesn't work: #! /usr/bin/env guile \\
<ertes>are there any other options?
<ertes>i'm interested in using -e, but if that's not possible, i'll just call 'main' myself manually from within the script
<ertes>also is there a way to silence the BIG AND NOISY "NOTE THIS SOURCE FILE IS NEWER" COMPILATION MESSAGE and just compile silently?
<lloda>ertes: fix PATH? or put a link to your guile somewhere in your path. ~/bin is what I use.
<lloda>re: compile messages, the default advice here is --no-auto-compile
<ertes>lloda: that's not the problem… guile itself is not in a standard location
<ertes>and the system treats everything after the first word on the hashbang line as a single argument
<ertes>"#! /usr/bin/env guile -s" → can't execute the program "guile -s"
<lloda>sorry I don't get it. You can point a link anywhere.
<lloda>ln -s guile_somewhere ~/bin/guile
<ertes>i understand that, but if that's the only option, i'll go for calling 'main' manually… seems less of a maintenance burden
<ertes>thanks for your help
<ertes>"-e main" is pretty much equivalent to having a "(main (command-line))" at the end, right? or are there any subtleties?
<lloda>ertes: there are, look here: https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html#Scripting-Examples
<ertes>i see, thank you
<ertes>#!/usr/bin/env sh
<ertes>exec guile -l fact -e '(@ (fac) main)' -s "$0" "$@"
<ertes>that's pretty clever… i'm going to use that =)
<ertes>is there a variant of 'case' that uses 'equal?' instead of 'eqv?'?
<OrangeShark>ertes: you can try ice-9 match
<ertes>OrangeShark: exactly what i need, thanks!
***berndj-blackout is now known as berndj
***fitzgen_ is now known as fitzgen
***guile-guest1 is now known as Muto
***ertesx is now known as ertes
<amz3`>héllo all
<amz3`>paroneayea: are you using a modified version of guile-websocket in mudsync?
<paroneayea>amz3`: in 8sync more accurately but yes
<paroneayea>amz3`: I'd like to use upstream though
<paroneayea>I snarfed it without being sure how much modification would be needed
<paroneayea>turns out, almost none
<amz3`>ah ok, I am trying to make it work with fibers,
<paroneayea>amz3`: it should work but you'll have to reimplement the server.scm or whatever it's called yourself
<paroneayea>use it as a base and transform that... the rest should work as-is
<amz3`>and it block on 'port-eof?' and 'get-u8'
<amz3`>afaik
<amz3`>afaiu*
<amz3`>then I must have done something wrong
<amz3`>b