IRC channel logs


back to list of logs

<bananagram>how do you use ellipses in guile?
<ijp>in macros?
<bananagram>at all
<bananagram>I didn't find any documentation of it
<ijp>well macros are the only place they are used that I know of
<ijp>well, we use them in the docs
<ijp>ellipses mean 0 or more
<bananagram>found it in the manual
<nalaginrut>morning guilers~
<ijp>hail satan
<ijp>I mean, whoops
<davexunit>good morning nalaginrut
<nalaginrut>davexunit: heya
<civodul>Hello Guilers!
<jmd>I'm trying to parse a string like '"one", "two", "three and, a half", four, "five"' into a list like ("one" "two" "three and, a half" "four" "five")
<jmd>is there a function to help do that?
<ArneBab>I have a horrible newbe-question, but anyway: How can I call eval-string with the language keyword-argument
<ArneBab>(eval-string "(+ 1 2)" #:language 'scheme)
<ArneBab>I’d like to ensure that it always uses scheme…
<ArneBab>I get ERROR: Wrong number of arguments to #<procedure eval-string (_ #:optional _)>
<dsmith-work>Mornign Greetings, Guilers
<ArneBab>moin dsmith-work
<ArneBab>moin davexunit
<davexunit>hello ArneBab
<ArneBab>davexunit: is there an easy way to take pictures of the displayed scene in guile-2d?
<davexunit>like other than a desktop screenshot tool? no.
<davexunit>there's a keybinding in gnome that allows you to take a picture of the current window.
<ArneBab>ok - I had hoped that I might be able to hack it to play with some visualisations I can save automatically…
<dsmith-work>Hmm. Didn't know that. Looks like it's Alt-Print for me
<davexunit>dsmith-work: yeah
<davexunit>ArneBab: explain.
<davexunit>perhaps it can be made possible in some future release.
<ArneBab>davexunit: If guile-2d works similar to pyglet, I can simply draw images on the surface wherever I want - even multiple times. With that it is easy to construct complex plots.
<jmd>I want to implement a state machine to parse a string. Any procedures which can do that for me?
*ArneBab did not get to really testing guile-2d yet
<davexunit>ArneBab: right now most things are done via sprites
<ArneBab>can I draw them multiple times?
<davexunit>I believe I have a draw-texture procedure that uses GL immediate mode to draw a textured rectangle.
<davexunit>and you can do that many times.
<wingo>ew, immediate mode :)
<davexunit>quick hack. :)
<wingo>hehe :)
<davexunit>how do you draw a rect without immediate mode?
<ArneBab>so that should work.
<davexunit>keep making vertex arrays?
<davexunit>that's expensive on the guile side.
<wingo>i have rects in that example i did a long time ago
<wingo>and yes, vertex arrays, fwiw...
<dsmith-work>jmd: There are lots of things in srfi-13. There is also a PEG parser, and an lalr parser
<davexunit>vertex arrays are good when drawing tons of things.
<wingo>i don't know if it's expensive or not; i recall it running faster than immediate mode
<davexunit>ArneBab: or you can use a sprite batch
<davexunit>sprite batches aren't as performant as I would like, but it's faster than drawing things in immediate mode when you're rendering a bunch of textures.
<ArneBab>davexunit: does it work with transparent PNGs? (is transparency preserved)
<ArneBab>√ ← another required feature is provided :)
<davexunit>I'm interested in your use-case, and I realize that drawing with texture objects and not using the sprite abstraction is probably uglier than it could be.
<davexunit>there's tons of room for improvement, so let me know how things work out and what could be made easier/more elegant/whatever.
<ArneBab>davexunit: the use-case is that I think about using guile to do some of my plotting (to learn more guile while doing the otherwise mostly boring things I need to do)
<dsmith-work>jmd: And of course there are regexps. There is the schemey irregex package in the guildhall (iirc)
<davexunit>ArneBab: like graphs?
<dsmith-work>jmd: And some people have used silex
<jmd>I've looked at a couple of those.
<jmd>In the end the only one which seems to do anyting for me is string-fold but that ends up nasty.
<davexunit>ArneBab: I'd be interested in how it works out, guile-2d is made for games, so rather than rendering one frame we're rendering many times per second.
<ArneBab>davexunit: but non-standard graphs, like the mismatch of x-y data
<ArneBab>davexunit: I can I tell it to just render once?
<davexunit>guile-2d could also use geometric primitives. it has none of those.
<ArneBab>davexunit: do I have direct access to the RGB data of images?
<ArneBab>(for example for color manipulation)
<davexunit>they are OpenGL texture objects.
<davexunit>so you have as much access as OpenGL provides.
*ArneBab knows that its really hard to create a good 2d library
<davexunit>there's probably too much boilerplate for guile-2d to be used as graph plotting software.
<davexunit>I used matplotlib in python before
<ArneBab>davexunit: I normally use matplotlib, too.
<wingo>i started a ggplot2-alike in guile, but never finished it
<wingo>ggplot2 looks sweeeeeeet
<davexunit>ArneBab: I think you'd be better served by a library tailored towards plotting that produces a png or something as output.
<ArneBab>davexunit: the most complex part of matplotlib is basemap, though (I don’t think that I could replicate that myself…)
<ArneBab>davexunit: there are some things which are really hard to produce as plot, but really easy to define as images.
<ArneBab>davexunit: my other usecase is porting my python d6 library and hexbattle, but that will take much longer.
<davexunit>did those use pyglet/
<davexunit>I draw some inspiration from pyglet and the layer above it (cocos2d)
<dsmith-work>jmd: What are you trying to do?
<ArneBab>davexunit: hexbattle is this:
<ArneBab>d6 is just an RPG rules backend
<ArneBab>davexunit: I’m not yet deep enough in guile scheme to really understand all I can do, though.
<ArneBab>davexunit: I think one of the best usecases for guile-2d would be tutorials for programming with guile-scheme: guile-2d would allow to directly see the results visually.
<davexunit>ArneBab: I agree. I want to provide a short screencast and tutorial of guile-2d when I make my first release.
<davexunit>I don't know if I can get away with assuming no prior experience with Guile.
<davexunit>that's pretty tough.
<davexunit>it would have to be a totally separate tutorial.
<ArneBab>davexunit: I would not start with assuming no experience with Guile.
<ArneBab>davexunit: rather guile-2d could be a good base for something like the turtle module in python:
<davexunit>ah good ol' turtle graphics.
<davexunit>that would be possible... when I write geometric primitives.
<davexunit>I've focused all of my attention on sprites
<ArneBab>davexunit: or by constructing the path with turtle footprints :)
<ArneBab>interesting post: The toy will win:
<ruffy>Some functions in guile 2.0.9 have texinfo doc strings and some just have plain text. Which is the old way and which is the new way?
<wingo>we're a little confused right now
<wingo>functions in C are written with texinfo docstrings and preprocessed to make plain text
<wingo>functions in scheme have been written in plain text, but some people are using texinfo too in the expectation that at some point we will start parsing and processing texinfo in all docstrings
<wingo>but that hasn't happened yet
<wingo>so we're in a place between places.
<wingo>sorry :/
<wingo>if you want to live in (a particular vision of) the future, you can import (texinfo reflection) in your .guile
<wingo>and use (help ...) instead of ,d
<wingo>then texinfo gets parsed
<wingo>a patch to tie ,d to parse texinfo would be welcome ;)
<stis>evening guilers!
<stis>I'm looking for the best datastructure to implement a dequeue, conses to both ends and should be optimized for scanning from front to back.
<stis>Oh, and it should be functional!
<stis>ijp: ?
<wingo>have you read okasaki's book?
<wingo>if not you should!
<sneek>Welcome back mark_weaver, you have 1 message.
<sneek>mark_weaver, ArneBab_ says: I would start with using two blank lines for finishing all sexps in a file, too. It’s easy to loosen that restriction later on, but it would be a nightmare to add it retroactively when there is already existing code which relies on the old feature.
<mark_weaver>"Purely Functional Data Structures"
<wingo>heya mark_weaver :)
<mark_weaver>hi wingo!
<stis>Ok I will go for that.
<stis>mark_weaver: what are our take on implement fast datastructures in guile?
<stis>SHould we wait for native?
<mark_weaver>stis: I don't see why we should wait. just implement them in scheme and they'll get faster as our compiler does :)
*wingo agrees :)
<mark_weaver>stis: also, you should check out ijp's 'pfds' (purely functional data structures) library, which is in guildhall.
<wingo>use conses if you really just have two things and always will, otherwise use records
<mark_weaver>it might already have what you need.
<wingo>hopefully the record type checking overhead doesn't kill you, and if it does you can roll your own records without type checks
<wingo>yes, also that!
<stis>Yep, noticed :-) I'll check out ijp's codebase again.
<mark_weaver>note that the new SRFI-9 "functional setters" avoids redundant type checks when copying a record with some fields changed (or more generally, a tree of records with some fields changed).
<mark_weaver>see 'set-field' and 'set-fields' in the manual
<stis>Hmm, good point mark_weaver: If I need to roll my own datastructure here I'll need functional records!
<stis>for the record I will use it for asserta and assertz implementation (remove is included as well)
<stis>I want them to be functioanl beacause I'm targetting guile-log for beeing state restaorable and also the iso-prolog states that
<stis>when one executes a dynamic function it should use the state at evaluation.
<stis>which is a sane spec!
<mark_weaver>jmd: if the string literals use the same syntax as Guile's string literals, and if the commas always immediately follow the close quotes, then you could do something as simple as this:
<mark_weaver>(I haven't tested that with Guile 1.8, but I tried to avoid 2.0-specific features)
<mark_weaver>ah, he's not here anymore...
<mark_weaver>sneek: later tell jmd: if the string literals use the same syntax as Guile's string literals, and if the commas always immediately follow the close quotes, then you could do something as simple as this:
<sneek>Will do.
<mark_weaver>sneek: later tell jmd: if you want to implement a more general state machine to parse the string, then I'd still recommend 'with-input-from-string', and remember that state machines can be implemented very nicely in Scheme using a set of mutually-recursive procedures (one for each state) that tail-call each other.
<davexunit>mark_weaver: do you know of any good resources that could explain the state machines further?
<mark_weaver>davexunit: not off-hand, but I'm writing an example state machine for jmd's problem and will paste it soon.
*stis really likes ijp's dequeue, perfect!
<ijp>stis: if you don't need real-time, there is a simpler way to do it than (pfds deques)
<ijp>er queues
<stis>ijp: it's for prolog asserta functionality with prolog dynamic funcitons.
<ijp>but amortisation and fp don't really go well
<stis>I need to add to the front and to the back and also be able to scan the list quickly.
<ijp>but if you're happy, I'm happy :)
<stis>I'm trying to understand the algorithm, what is the kind of tree you are using there?
<ijp>it's been so long, I'd need to read the code to remember :)
<stis>do you store data in leafs or in the nodes?
<ijp>leaves I think
<stis>Hmm, I want it to be fast at scanning and perhaps a version which stores the data in the nodes would be faster, but I think it's ok.
<ijp>if you've used the (front . tail-reversed) queue representation, it's very similar
<ijp>it's just that instead of reversing all at once, it's done piecemeal as you add/remove from the queue
<ijp>l^ is a pointer into l to make sure that the lazy list is forced
<ijp>the paper is linked in the README anyway
<stis>cool, I have a look.
<ijp>laziness is how you do amortization in fp
<ijp>(to cut down okazaki's phd into a tweet)
<mark_weaver>sneek: later tell jmd: here's an example of how to do a similar job using a state machine:
<mark_weaver>davexunit: ^^
<ijp>hehe, @phdtweets
<mark_weaver>sneek: later tell jmd: note that the syntax recognized by that state machine is a bit different, but you could adapt to whatever syntax you want.
<sneek>Got it.
<mark_weaver>there are certainly ways to make that code nicer, e.g. by using a 'skip-whitespace' helper procedure, but that's a very straightforward example of a state machine in Scheme.
<stis>ijp: I think that although it's a bit complicated, your dequeue is needed to avoid really bad performance for some usage scenarios
<ijp>mark_weaver: and you can macro away a state machine
<mark_weaver>ijp: I find state machines so straightforward to write in Scheme, that I see little point to using a macro to do it.
<mark_weaver>though if you're talking specifically about state machines for lexing strings, that's of course a different matter. it would be nice to have some kind of lexer generator in Guile.
<ijp>I was thinking of the example in
<mark_weaver>right, that's more about writing state machines that do lexical analysis, which I agree could be much nicer with some help from macros.
<mark_weaver>it's a drag not even being able to use 'case' to match EOF.
<ijp>stis: yes, that's really the point. The "normal" version works great when you are not storing the queue. Once you store the queue, you'd need to worry about making sure it doesn't get reversed each time you access it.
<ijp>maybe I should include those too, as (pfds queues naïve) and (pfds deques naïve)
<ijp>except without the diaresis, which emacs kindly filled in
<ijp>muahaha, unicode module names
***ruffy is now known as dje42
***mario-go` is now known as mario-goulart
***wingo_ is now known as wingo
<wingo>mark_weaver: dude i am just now looking at old guile-bugs mails; nice work handling all of weinholt's bugs!
<wingo>from july ;)
<alexei___>hm, this just hangs indefinitely (yes, single quotes): (with-input-from-string 'a' read)
<mark_weaver>wingo: thanks! still more to do there, but it's a bit less than it would have been :)
<ijp>alexei___: not here t doesn't
<ijp>you get a type error
<alexei___>same here (with-input-from-string 1 read)
<mark_weaver>alexei___: what version of
<ijp>what version are you using
<ijp>the first one is really weird, because with-input-from-string is getting two symbols as argument
<wingo>did you somehow compile with --disable-asserts or something?
<weinholt>ijp, maybe not:
<weinholt>scheme@(guile-user)> '(with-input-from-string 'a' read)
<weinholt>$1 = (with-input-from-string (quote a') read)
<wingo>there is some SCM_RECKLESS option...
<mark_weaver>ijp: I don't think so. "'a'" parses as a single symbol named "a'" on my Guile, and I don't think that's changed.
<ijp>okay, that is weird
<mark_weaver>alexei___: does this happen when you type those things at the REPL?
<weinholt>but i do get the hang
<alexei___>here too 'a' parses to a'. it is a type error that is not handled.
<alexei___>Yes in REPL, I mitakengly used singel quotes and discovered this
<wingo>i also get a type error on both of those
<ijp>I would have bet £10 on it being two symbols
<alexei___>wingo: stock ubuntu version. Didnt compile myself
<ijp>I bet I could find a cite in the rnrs, but meh
<wingo>ijp: istr foo' is a valid identifier, but again meh
<mark_weaver>if anyone is tempted to get a Yeeloong, they are significantly discounted right now at 30% off on the high-end one that's based on the Loongson 3A.
<wingo>weinholt: what version are you using?
<wingo>to cross-check
<wingo>mark_weaver: interesting :)
<mark_weaver>(normally 840 €, now 590 €)
<davexunit>mark_weaver: neat. but I *just* bought a used thinkpad yesterday.
<weinholt>wingo, tested with guile 2.0.5+1-3 on debian stable
<ijp>mark_weaver: it would be tempting, if I had that cash spare
<wingo>maybe it is a guile 2.0.5 thing somehow... though i don't know how
<ijp>I tested it in 1.8, and that gives a type error
<weinholt>#3 0x00007ffff7b30049 in scm_dynwind_pthread_mutex_lock () from /usr/lib/
<weinholt>that's in the backtrace when it has hung
<weinholt>#4 0x00007ffff7b2b63e in scm_mkstrport () from /usr/lib/
<ijp>looks like the tekmote discount holds till the middle of november
<wingo>weinholt: ok, will take a look
<ijp>the ultra mini is under 200 euros
<wingo>ah, that must be when throwing an error...
<wingo>weinholt: is there an error on the stack somewhere?
<weinholt>#9 0x00007ffff7abd240 in scm_error () from /usr/lib/
<wingo>yep :)
<wingo>and that would be the port table lock, which doesn't exist in master
<alexei___>same here.
<wingo>will see if it's fixed in 2.0.9, and how
<alexei___>scm_mkstrport is twice in the call stack
<wingo> is related, and contains mention of the fix for this bug
<mark_weaver>line 317 of strports.c verifies that 'str' is a string.
<mark_weaver>if SCM_RECKLESS is defined, that turns into a no-op though.
<mark_weaver>however, I can verify that I also get the hang using the Debian stable version of Guile (2.0.5)
<alexei___>;a=commitdiff;h=03fcf93bff9f02a3d12ab86be4e67b996310aad4 says "prior to 2.0.6"
<mark_weaver>ah, so scm_mkstrport calls scm_wrong_type_arg, and then somewhere down the line the error-message formatting machinery calls scm_mkstrport again, and then there's a deadlock while trying to lock a lock.
<wingo>bipt: looking forward to the summary mail for gsoc 2013 :-)))
<ijp>that smiley needs to lose weight, or maybe some cosmetic surgery
<mark_weaver>it's as if the 'scm_dynwind_end' on line 302 of strports.c is not releasing 'scm_i_port_table_mutex', which was locked using scm_i_dynwind_pthread_mutex_lock (&scm_i_port_table_mutex);
<wingo>not sure if you saw, but it seems ludo did fix this bug.
<wingo>mark_weaver: ^
<mark_weaver>wingo: ah, I see. that's what I get for reading the 2.0.9 code which doesn't actually have the bug :)
<wingo>a time spent reading code is never lost :)
<mark_weaver>true :)
<wingo>s/never/ever/ ? :)
***alexei___ is now known as amgarchIn9
***LAMMJohn1on is now known as LAMMJohnson