IRC channel logs


back to list of logs

<daviid>Javyre`: try to find examples, there are some in guile-gnome
<Javyre`>daviid: thanks Ill look around...
<Apteryx>how do I touch a file in Guile? mknod?
<Apteryx>which module defines lambda-match in Guile?
<Apteryx>(ice-9 match)
<amz3>hello all!
<amz3>today, I will work on the query engine for nqql, a sparql-like language adapted to s-expr
<amz3>what is the meta command at the REPL to see the IR?
<amz3>that is nql not nqql
<amz3>it meas neon query langage
<amz3>I will try to forget about the optimization for the time being?
<amz3>too difficult.
<amz3>The optimization is anyway an improvement because the code is more readable, and I want to have a standard solution that will be _readable_ code.
<amz3>the only problem with the traversi vs srfi-41, is that srfi-41 are more easy to construct. In traversi, there is no stream-cons and stream-null, you have to understand the inner working of the abstraction to build a new stream. That said, one layer above, you have a subset of usecases where your library provides an abstraction where the end-user will not need to construct new streams out of nothing. The
<amz3>abstraction expose procedures that create streams, the end-user use that to build new streams out of existing stream with stream-map or traversi-map
<Apteryx>Q: How can a "touch" a file in Guile? Something nicer than (system "touch some-file") ?
<mwette>Did you try `(close (open-file "some-file" "a"))'
<mwette>Though I use (system "touch ..."). The above open-file approach may be risky.
<amz3>I meet exactly what I was in fear with a few month ago: lazy sequence all the things.
<amz3>and the stream is stateful :/
<amz3>that is if you 'force stream' you can't 'force stream' again, because the underlying database cursor already moved to something else
<amz3>I should maybe buffer the cursor stream someone to be able t easly navigate in stream in a functional way
<amz3>but buffering creates a memory constraint stream
<amz3>but buffering creates a memory constraint
<amz3>it makes thinking about the whole control flow much more difficult
<amz3>what is a good name for a procedure that returns a KEY value that is comparable with eq? and that is used as group-by condition
<amz3>I think about predicate, but I am under the impression that predicates always return boolean values
<amz3>that is all values that return the same KEY will be grouped
<amz3>I will call it PROC that is all.
<justin_smith>amz3: my experiene from clojure (where most operations on sequences are lazy) is that laziness and side effects don't often mix well, especially when working with anything that is time-sensitive or relying on contextual bindings that might notbe in place where the sequence is realized
<amz3>you understood very well my issue
<amz3>I really want to stream all the way down
<justin_smith>amz3: laziness is excellent as a function abstraction, but database cursors etc. don't really play along - and I have seen way too many times that pretending something is pure that isn't is a lot worse than just doing some impure stuff
<amz3>justin_smith: I am trying to implement a database cursor on top of another database cursor that is stateful
<amz3>if possible the stream should be pure / stateless
<amz3>I know!
<amz3>what i need is not a stream but a cursor!
<amz3>the only cursors I know rely on call/cc
<amz3>the other thing I can do is convert the initial stateful cursor into stateless stream going through a list, that way I have easily my stateless stream
<amz3>I already done that previously in guile-wiredtiger's grf3 library for implementing gremlin DSL
<amz3>it was not right.
<Apteryx>any idea how to make the following snippet fully create the captured directory hierarchy? So far it descends to the first branch and stops there:
<Apteryx>oh, there might be some guixish things in there such as mkdir-p.
<justin_smith>Apteryx: on line 17 you don't use subdir2 or ...
<justin_smith>so you'll never recurse more than one level down
<justin_smith>I'd also expect subdir1 but not inside a listtobe handled oddly
<Apteryx>is there a way to generalize the make-test-dir-hierarchy call to include subdir2 ...
<Apteryx>what do you mean by "I'd also expect subdir1 but not inside a listtobe handled oddly". Do you mean a list such as ("top" "subdir1" ("subdir2" (...)) ...) ?
<Apteryx>I haven't considered this use case yet (and probably won't as this is just going to be use for unit testing).
<mwette>(begin (make-test-dir-hier subdir1 (...)) (make-test-dir-hier subdir2 ...))
<Apteryx>will try, thanks!
<Apteryx>hmm. not sure I understand how you use the (...) and ...
<Apteryx>Any pointer for a good read?
<mwette>maybe something liek
<Apteryx>Oh. I first tried for-each and found it was giving me problems because of its 'unboxing' effect on my lists. Will try your example to see if it can work.
<mwette>and maybe replace match with (if (pair? ...
<mwette>yeah, seeing that may not work
<Apteryx>Is the reason this is so tricky decause my data is oddly defined? Should I adopt another format for my directory hierarchy representation?
<mwette>I would just do ("dir1" ("dir2" "file1" "file2"))
<amz3>justin_smith: what do you think about this
<mwette>my procedure was assumeing this format
<justin_smith>amz3: I'm not primarily a guile or scheme programmer, so I don't fully understand what I'm seeing there.
<amz3>it doesn't work anyway, I have the famous lexical scoping issue related to the use of delay alone
<amz3>sorry, that is not the issue,
<amz3>basically, I can't capture the value of 'key' in the promise
<amz3>by the use of delay
<Apteryx>mwette: makes sense
<amz3>seems like i got it
<amz3>which means I can convert my cursor to purely functional stream... or something like that
<amz3>I am not sure what difference there is between (delay foo) and (lambda () foo)
<Apteryx>final version: thanks everyone for your help!