IRC channel logs

2018-07-04.log

back to list of logs

***alvina is now known as Guest20693
<amz3>manumanumanu: what did you complete?
<manumanumanu>amz3: my for loops. I lack one feature compared to racket's for loops (post guards), but I haven't understood what they can be used for except for a little more elegant in-value. The macro expansion has gotten a lot faster as well, so now they add very little overhead.
<manumanumanu>next project is to clean up my transducers for guile and make a r7rs library for it and write a draft srfi.
<manumanumanu>the transducers aren't faster for guile than chaining map,filter etc, but is a lot more memory efficient. This will probably become faster as guile becomes faster. In chez they are a lot faster than regular map/filter/take-while etc chaining
<manumanumanu>amz3: and the code they generate is as fast as hand-rolled loops.
<manumanumanu>so now I'll try to roll a guile package.
<manumanumanu>guix*
<rekado_>manumanumanu: let us know on #guix if you need any help to write a package definition
<rekado_>civodul: you may want to change the topic of this channel, which still mentions the release announcement of Guile 2.2.3.
<lloda>I like srfi-71 +1
<civodul>rekado_: right
<civodul>lloda: me too!
***civodul changes topic to 'Welcome to #guile. See https://gnu.org/s/guile for more information. Guile 2.2.4 is out! <https://gnu.org/s/guile/news/gnu-guile-224-released.html>. This channel is logged, see <https://gnunet.org/bot/log/guile>. Bug database at <https://bugs.gnu.org/guile>.'
<wingo>i guess srfi-71 would prevent excess value truncation
<wingo>for better or for worse
<civodul>that's already the case with srfi-11 or anything that explicitly uses call-with-values with a fixed-arity procedure, no?
<wingo>correct -- truncating continuations are those continuations not established by call-with-values
<lloda>is the compiler able to truncate anyway if you do (values a b . _) and don't use _ afterwards?
<civodul>lloda: i truncates on the receiving side
<civodul>*it
***holomorph is now known as ammo
***ammo is now known as ubybzbecu
***ubybzbecu is now known as holomorph
<wingo>lloda: but it does truncate without allocating a list for _
<civodul>i'm looking at https://bugs.gnu.org/31925
<civodul>wingo: upon fork, it seems the child can end up in a state where the alloc lock is taken
<civodul>so it looks like we should call fork() with the alloc lock taken
<civodul>thoughts?
<amz3>manumanumanu: \\o/ nice to see more projects advancing
<manumanumanu>amz3: I'm very happy about the for loops and about that arthur asked me to turn the transducers into a srfi :D
<amz3>arthur? what's his nickname on freenode?
<manumanumanu>no idea. Arthur Gleckler, the current srfi guy
<amz3>manumanumanu: sound good to me
<amz3>manumanumanu: well, the issue I have with scheme, say compared to javascript noosphere, is that scheme builds up like cathedral whereas javascript is full bazaar going in every direction
<amz3>s/scheme/srfi/
<amz3>I had in mind to make srfi for a database abstraction I am working on based on latest microkanren
<manumanumanu>I think both things are happening. the srfi process is just a collection of good ideas in one place that become replaceable standards
<amz3>I don't say it's not a good thing at all :)
<amz3>compared to the mess that javascript is, srfi are a very good entreprise
<amz3>btw latest microkanren is available at https://github.com/TheReasonedSchemer2ndEd/CodeFromTheReasonedSchemer2ndEd
<manumanumanu>The ideas are mostly well-chosen primitives that can be used to build higher abstractions
<amz3>like transducers :)
<manumanumanu>well, yes. They are, in a way, a generalisation of parts of srfi-1
<manumanumanu>(but also not at all because they don't build the same way and have other limitations)
<manumanumanu>which is why they are a good idea. The compose, which srfi-1-things don't, which is why it has append-map and filter-map
<manumanumanu>they*
<amz3>well, it seems to me one feature that is helpful in the situation of filter + map code is srfi 26 'cut'
<amz3>even if, I kind of lazy and avoid it because it requires another import
<manumanumanu>that still does't solve the composability issue, of course. map and filter each builds intermediate collections
<amz3>transducers don't?
<manumanumanu>no :D
<amz3>sorry I am clue less about transducers
<amz3>oh interesting
<manumanumanu>they are really cool
<amz3>please send a mail to mailing list, you already did? I never noticed one
<manumanumanu>amz3: I am remaking them a bit first
<amz3>never midn, release early release often ;)
<manumanumanu>but the idea is that: (transduce (compose (map 1+) (filter odd?) (take 10000)) conj list) does't build intermediate collections, it adds one filters od numbers and takes the first 10000, without building any intermediate lists
<amz3>I am interested because of my project obviously which rely on hand rolled stream implementation + composition
<amz3>exactly what does traversi stuff
<manumanumanu>only the last step is actually aware of what it is building. You can use the same transducer on vectors/streams or in just about any kind of sequential process
<manumanumanu>in guile using transducers is only slightly faster than doing it the regular way, but much more memory efficient. If guile3.0 actually has a jit, it will definitely be faster, since it benefits from inline caches (i believe)
<amz3>the thing is that I build up the input 'stream' of things directly from database cursor prev/next
<manumanumanu>as I said, any computation where you have a bunch of seps
<manumanumanu>in clojure you can use them in their channels. You create a chan (chan [transducer]) where the transducer is applied to every thing passing through
<amz3>here is the implementation of cursor->stream
<amz3> https://github.com/amirouche/zehefyu93/blob/master/guile/neon/wiredtiger.scm#L437
<amz3>where is your code?
<amz3>does it memoize the value given by a single step "automagically"?
<amz3>if I do '(transduce (take 10) some-transducer)'
<amz3>and redo
<amz3>and redo later '(transduce (take 10) some-transducer)'
<amz3>it will it give me the same results all the time or not?
<manumanumanu>no. take is stateful
<amz3>oh
<amz3>traversi is the same, that why I work around it with cursor-return and cursor-move from the above link
<amz3>which slow down a bit the traversal of the table prefix
<manumanumanu>the thing is, it is only stateful for each started transduction; say you have transducer a (compose (map 1+) (take 10)). every time you invoke the transducer, the state of take is reset, so it takes new 10s every time. If the collection it transduces _from_ is at the same place as before, it will start from the same place
<manumanumanu>this is the no-updated branch: https://bitbucket.org/bjoli/scheme-transducers/src/default/
<manumanumanu>I have decided to make some non-compatible changes
<manumanumanu>there is no documentation yet, but look at the linked videos.
<amz3>the thing is that avoid things like (iota 1000000) in my code
<amz3>my seed is a generator or some sort
<amz3>to avoid to load things fully in memory
<manumanumanu>it was just an example. it doesn't matter what the source for the transducer is. transducers are oblivious of their source collectio
<manumanumanu>n
<manumanumanu>it can just as well be a generator
<manumanumanu>or a port or whatever
<amz3>cool
<mwette>amz3: I though ReasonedSchemer was miniKanran, and microKanran is smaller. Look for a paper by Hemann and Friedman on uKanran.
<mwette>amz3: sorry, Kanren, not Kanran
<amz3>not sure, i did not read the latest source code
<amz3>I read minikanren
<amz3>and what's is packaged in guile-wiredtiger as microkanren is smaller that what is called minikanren
<mwette>So you are using microKanren. Neat. Is that working out OK? I did copy the source from the paper. and pasted here: http://paste.debian.net/1032105/. I didn't know it was available anywhere else.
<mwette>ah, here it is: https://github.com/jasonhemann/microKanren
<mwette>I have been reading The Reasoned Schemer.
<amz3>mwette: yes, but the reasoned schemer first edition use minikanren
<amz3>mwette: the second edition use apparantly, the one I posted earlier, but I did not read the second edition yet
<amz3>mwette: I know almost the whole implementation by hearth of ukanren, except bind and mplus which I don't understand what they do, it seems to me they allow the interleaving of the search of the solution space but I'am not sure
<amz3>mwette: yes microkanren works, FWIW, I looked hard to find a better way to query my relational data, i did not find something as neat
<amz3>I did no benchmark yet, so that's the next step benchmark the two solutions I have
<amz3>but from readability point of view, if you know minikanren / microkanren, it's easier to query recursive structure using microkanren
<amz3>and for querying flat structure the overhead (in terms of syntax) is very minimal
<amz3>I may find an example of querying a flat structure somewhere
<amz3>here is an example query https://github.com/a-guile-mind/presence/blob/887e5bf6df511ad719ee93ee5da2368ebd343131/src/web.scm#L891-L894
<amz3>the whole file has microkanren queries, look for fs:queryo
<amz3>mind the fact that Dan Friedman use another syntax for 'out' parameters, he use ^ as a suffix of the variable name that is the output value
<amz3>I use ? instead
<amz3>and I use ?? for intermediate aka. fresh variables
<amz3>ie. variables that don't escape the microkanren computation
<mwette>mplus is defined in the paper: "The mplus operator is responsible for merging streams. In a goal constructed from disj , the resulting stream contains the states that result from success of either of the two goals. mplus simply appends the list returned as the result of the rst call to that returned as the result of the second. In this form it is simply an implementation of append"
<amz3>mwette: where do you read that paper? I looked up the web, I did not find anything, is it available on the openweb?
<mwette>amz3: http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf
<amz3>tx
<amz3>something interesting the microkanren enthusiate might be the implementation of the fs:queryo procedure, it's done here https://github.com/a-guile-mind/presence/blob/master/src/wiredtiger/feature-space.scm#L107
<amz3>in zehefyu93 (formely neon) I will remove the problem that 'a' can not be a variable
<amz3>basically i zehefyu93 everything can be a variable
<stis>there is also: https://gitlab.com/tampe/attributed-minikanren , swip prologs attributes in minikanren
<stis>sorry microkanren
<stis>project name is missleading
<manumanumanu>good evening stis!
<stis>heya guilers!
<amz3>heya stis
<amz3>well, I had an hard wrapping my around minikanren/microkanren now I don't remember how I achieved that
<amz3>getting into attributed is way out of my league
<amz3>getting into attributed _mk_ is way out of my league
<stis>everything that is needed is time and a bottle of bear and good company and you'll manage attributed variables like your own pocket :-)
<amz3>:)
<amz3>maybe
<manumanumanu>I never really grokked the kanren parts. I think I would be more successful trying some other logic programming thing first, and then try to understand kanre through that
<stis>actually to really understand how the search is done in microkanren is quite difficult
<ison[m]>Sorry for the really basic question, but is there any way to sort of save a list containing arbitrary types to a file and the reload it later? Sort of like "pickle" in python
<stis>serilizing lambdas are tricky and not suported without using c code. continuations is really really hard to serialize and I never mangaed to do that for guile 2.2
<stis>so no pickle support for guile. For a list of atoms you may try e.g
<stis>(with-input-from-string (format #f "~S" '(1 (1 2) #(1 a 2 "c"))) read)
<stis>$10 = (1 (1 2) #(1 a 2 "c"))
<stis>note read is unsafe, so commonly a direct reader writer is custom made using for example json as a serializing format
<stis>structs are tricky and does not work with the reader method. But you have conses and vectors as possible containers
<mwette>manumanumanu: your transformers sound useful; seems to have the flavor of (sxml xpath)