IRC channel logs

2014-07-15.log

back to list of logs

***petercommand is now known as Guest57381
***Guest57381 is now known as petercommand
<zacts>lo #guile
<zacts>hi #guile
<civodul>Hello Guilers!
<ArneBab_>moin zacts, civodul
<wingo>morning :)
<ijp>greetings earthlings
<janneke>morning!
<nalaginrut>do we have function to convert string into BCD? or hex2bin which convert hex in string to binary code?
<ijp>no, and no
<ijp>I keep functions for converting hex-strings to bytevectors in my (ijputils bytevectors) module, but they depend on foof loop....BCD I have never needed
<ijp>I wasn't aware it was still used, but wikipedia assures me it is
<nalaginrut>so I have to write it myself
<nalaginrut>ok thanks ;-)
<ArneBab>can I quiet the auto-compile messages from guile?
<civodul>ArneBab: no, this is a long awaited feature :-/
<ArneBab>civodul: oh, ok - thanks for your answer!
<ArneBab>civodul: then I’ll just fudge it in my bootstrap script for the time being with a bit of sed and 2>&1…
<civodul>yeah, or pre-compile and then use --no-auto-compile
<ArneBab>but the pre-compile is what I want to quiet ☺
<ArneBab>${guile} -L . -s language/wisp/spec.scm 2>&1 | sed "s/;;;.*//" | grep . 1>&2
<ArneBab>shorter: guile spec.scm 2>&1 | sed "s/;;;.*//" | grep . 1>&2
<ArneBab>this has the disadvantage, though, of merging stderr and stdout into stderr
<ArneBab>real silence: guile example.scm 2>&1 | sed "s/;;;.*//" 2>&1 | grep . 1>&2 ; test ! $$? -eq 0 # grep did not find anything
<ArneBab>this gives an error-code when there is output.
<nalaginrut>interesting
<nalaginrut>maybe ^;;;.*
<ArneBab>nalaginrut: that would be safer, yes
<ArneBab>thanks!
*ArneBab felt a bit strange writing the commit message “safer sed thanks to nalaginrut” ☺
<ijp>ArneBab: you can try using -e '(current-warning-port (%make-void-port "w"))'
<ijp>er -c not -e
<dsmith-work>Hey hey
<janneke>what is good way to create/type a homogeneous list?
<janneke>the best i can come up with right now is something like:
<janneke>(define-class <compound> (<statement>) statements)
<janneke>(define-method (add (o <compound>) (s <statement>))
<janneke> (slot-set! o 'statements (append (slot-ref o 'statements) (list s))))
<janneke>
<janneke>(and then of course, hiding slot access etc) hmm?
<SmurfettePrincip>janneke, you can use r6rs records and a protocol that requires a certain type.
<ijp>SmurfettePrincip: which amounts to the same thing
<ijp>I suppose it's a little better because r6rs records aren't as introspective as clos
<ijp>janneke: you might not want to append to the end if you are going to do it a lot
<janneke>ijp records with a protocol ...
<janneke>that's new for me, could be just right
<janneke>i'm going to check it out, thanks (also for the append clue bat! :-)
<janneke>eh SmurfettePrincip thanks!
<SmurfettePrincip>janneke, one moment, I already sort of have it
<SmurfettePrincip>janneke: http://hastebin.com/raw/oyeduwawih
<SmurfettePrincip>this is basically untested
<SmurfettePrincip>But the protocol basically is to verify the arguments of the record.
<SmurfettePrincip>It should probably also verify that type is a procedure come to think of it
<SmurfettePrincip>THere's also a syntax error
<janneke>untested is already a big step better than generic documentation :-)
<SmurfettePrincip>instead of [protocol [make] it should be [protocol [lambda [make] ...
<janneke>ok
<SmurfettePrincip>Well, the "protocol" part of r6rs records can be a bit complex, but how you should see it is that the protocol should be a function which takes as its single argument the normal basic record constructor and returns as function the new one.
<janneke>what are the semantics of these scary square brackest for lists?
*janneke really needs to read more documentation
<SmurfettePrincip>So if you say want to make rational numbers as a record your protocol would be something like [lambda [make] [lambda [x y] [assert (integer? x)] [assert (integer? y)] [assert (not (zero? y))] (make x y)]]
<SmurfettePrincip>janneke, they are completely identical to round ones and are purely for easy reading.
<janneke>'doh!
<janneke>:)
<janneke>thank you!
<SmurfettePrincip> http://hastebin.com/raw/jenirarose ehh, this example should provide a less complex introduction to record type definitions
<SmurfettePrincip>Fields can also be like [fields [mutable x] y] in which case x is mutable and the binding record-x-set! is also made available
<SmurfettePrincip>But if you do that, somewhere, at some place, a Dutch crude cartoon figure dies of course.
<janneke>of course
<janneke>ah yes, this rational example is very gentle
<janneke>and now homo-list also reads easier
<SmurfettePrincip>janneke, you can actually choose the names of these procedures like make-homo-list etc, these are just the default forms, the syntax is quite flexible in that.
<janneke>ok
<janneke>i now already have some output: hello world
<janneke>string-list: #<r6rs:record:homo-list-of-type>, HEAD, ()
<janneke>
<janneke>and stuff like (define make-string-list (make-homo-list string?))
<janneke>(define* ((make-homo-list type?) car :optional (cdr '()))
<janneke> (make-homo-list-of-type car cdr type?))
<janneke>
<janneke>SmurfettePrincip: http://hastebin.com/doledatofa.lisp
<SmurfettePrincip>janneke, it fully works?