IRC channel logs


back to list of logs

***catonano__ is now known as catonano
***apteryx_ is now known as apteryx
***sputny1 is now known as sputny
<R1ck77>Hi! Is there any way to add a docstring to function definitions (a-la-elisp/Clojure)?
<sneek>Welcome back R1ck77, you have 2 messages!
<sneek>R1ck77, dsmith says: For embedded, there is Chibi Scheme:
<sneek>R1ck77, dsmith says: "Chibi-Scheme is a very small library with no external dependencies, intended for use as an extension and scripting language in C programs."
<R1ck77>sneek help
<R1ck77>sneek botsnack
<mwette>Rick77. If the first expression in a procedure body is a string, then it serves as the docstring. (define (foo) "does nothing" #t) ; guile> ,d foo
<janneke>hmm, i'm getting a build failure for guile-1.8.8 on x86
<janneke>PASS: test-bad-identifiers
<janneke>ERROR: Value out of range -9223372036854775808 to 9223372036854775807: -9223372036854775808
<topoi>How do i transform '(a (b c)) to '((a) ((b) (c)))? It should be plainsimple but i seem to do overlook something.
<sneek>topoi, you have 1 message!
<sneek>topoi, wingo says: there were problems in guile and g-wrap, but now for me guile-gnome works fine with master
<topoi>I just want to transform the elements in a tree.
<topoi>(resp. the leaves)
<chrislck>this is not straightforward
<chrislck>here's a super ugly version:
<topoi>chrislck: Thx. =) Ugly is better than dysfunctional. I tried with recursion and stateless (foldr like) but seemed to make some stupid mistakes which I could not see.
<justin_smith>this version makes a new list instead of mutating the one you already had
<justin_smith>(stateless, as you say)
<stis>perhaps my-flatten in
<chrislck>topoi, cleaner:
<chrislck>^ this one optimized
<topoi>(I needed it for a better representation of a huffman tree; you need small fun projects for keeping fit. I lost it as it seems. =)
<justin_smith>chrislck: optimized in what sense? less stack usage?
<chrislck>I think so, avoids list-generating map
<justin_smith>but it calls reverse, which walks the entire result at the end
<justin_smith>the job here is making a list
<chrislck>ah true
<topoi>justin_smith: There was a useless layer in it. As I failed to flatten the bottom layer I tried the inverse and failed again, became quite frustrated after a while and then joined #guile to find some friendly folks who arbitrated my anger. =)
<justin_smith>topoi: haha, well hopefully one of our examples help then
<topoi>I'll walk through each of them. Thanks all! =)
<chrislck>(ignore the embarassing ugly one)
<justin_smith>chrislck: well it did respond to the question literally (while the others make new lists)
<chrislck>but is O(N^2) at least
<stis>topoi: non functional version that is avoidingin append, tree traversal with ackumulator. see
<stis>oh I forgot to return the value of the ackumulaotor: (let ((ack (mk-ackumulator))) (tree-traversal x ack) (ack)))
<stis>is the corrected version
<stis>and a functional one avoiding append
<chrislck>prize for someone who writes using fold
<justin_smith>chrislck: I claim my prize
<justin_smith>if fold-right isn't acceptable, pretend I called reverse! on the result of fold
<justin_smith>oh I left out the actual call: (map-tree list '(a (b c))) => ((a) ((b) (c)))
<chrislck> 👏
<chrislck>was looking for something like without
<justin_smith>my map version doeos less work, by actually producing the result in the same order the output needs it
<R1ck77>Hi! Is there in Guile the equivalent of Clojure's interpose?
<R1ck77>(interpose "," '("hello" "there")) -> '("hello" "," "there")
<rgherdt>R1ck77: string-join
<rgherdt>hmm, not the same, sorry. this one merges the strings
<R1ck77>can I add a separator while joining? The stuff I'm doing is actually strings, so..
*R1ck77 testing
<R1ck77>it does exactly what I need, thank you rgherdt!
<R1ck77>(still curious if a general interpose exists btw, so if there is any taker, he/she's welcome)
***Ekho- is now known as Ekho