IRC channel logs


back to list of logs

<daviid>sneek: later tell fhmgufs (create-signal <gtk-window> 'bluefox #f '())
<sneek>Got it.
***dje is now known as xdje
***Guest28442 is now known as micro`
<trough>Is there a built-in way to write radians?
<trough>Or, is there a pi constant?
<trough>Nevermind, I think I found the answer: no.
<paroneayea>if you want to join the lisp game jam pre-release party for mudsync
<paroneayea>telnet 8889
<paroneayea>ACTION hack hack hacks
<davexunit>paroneayea: fun!
<davexunit>here's my final WIP gif for my entry
<davexunit>now I need to make a big tarball of all the guile stuff I used and attempt to write a script that will compile it for people.
<paroneayea>davexunit: stellar
<wingo>mark_weaver: found a bug!
<wingo>if you have a port that uses iconv for decoding
<wingo>and the input ends before a character is decoded
<wingo>then the "length" of the invalid byte sequence is not set (the *len arg to get_iconv_codepoint in 2.0)
<wingo>so you could end up advancing the read pointer by a trash value
<wingo>or maybe not
<wingo>maybe in 2.0 len doesn't matter.
<wingo>but i think it does
<wingo>b/c peek-char will unget that number of bytes
<nalaginrut>davexunit: niceļ¼
<wingo>whew, peek-char and read-char in scheme totally done.
<wingo>dunno how much c i can remove though :/
<wingo>for utf-8 and latin-1 encodings it's faster than guile 2.0 (though slower than c)
<wingo>that's for peek-char, i think read-char is similar but it has to do some more work to update positions and we don't compile "case" as well as we could
<wingo>encodings needing iconv appear to be slower than 2.0 currently
<wingo>i'm pretty sure read-line et al can be *much* faster than 2.0 tho
<rekado>davexunit: you probably read about subscriptions in Elm and turning away from signals and FRP in general. I'm curious to hear your thoughts on this.
<rekado>Especially wrt Sly.
<rekado>looks like the Process stuff in Elm is similar to delimited continuations.
<bentanweihao>Hi all! I have a pretty basic question that I'm stumped on
<bentanweihao>Given: (define (foo) (lambda (values) values))
<bentanweihao>How can I use `foo` such that (foo 1 2 3) works?
<bentanweihao>something like how (list 1 2 3) does it
<bentanweihao>and strangely foo 1 2 3 works without parents
<df_>bentanweihao: I'm not clear what you're trying to do, do you want a procedure with a variable number of arguments?
<mejja>try: (define foo (lambda vals vals))
<bentanweihao>yeah @df_
<df_>so something like (define (foo . args) < args is a list containing the arguments > )
<paroneayea>hello #guile!
<bentanweihao>ah interesting
<bentanweihao>hmm why doesn't (define (foo) (lambda (values) values)) work then?
<df_>that defines a procedure that returns a procedure
<df_> might be helpful
<df_>roughly speaking (define (foo ...)) is shorthand for (define foo (lambda ...))
<bentanweihao>so interestingly foo 1 2 3 works too
<bentanweihao>at least in the REPL
<bentanweihao>oh, it's just the REPL printing stuff out i think
<bentanweihao>"$3 = #<procedure foo values>"
<df_>er, yeah, looks like the repl wraps that in an implicit (values)
<bentanweihao>got it
<davexunit>rekado: I haven't heard about that.
<random-nick>would "generator functions" be implemented in guile with prompts where the handler set!s the procedure instance to the new delimited continuation each generation?
<davexunit>generators can be implemented with delimited continuations
<davexunit>I've done something similar in the past
<random-nick>but is the set! necessary?
<davexunit>would depend on the implementation, I think.
<random-nick>is returning (values 'a) the same as returning 'a?
<davexunit>try at the REPL and see :)
<trough>How can I append an integer variable to a string?
<random-nick>as in you want to convert the integer into a string?
<trough>yes, so number->string first?
<trough>thanks I think I found it.
<trough>Is it possible to pad the number with zeros?
<trough>Never mind, I should RTM more.
<davexunit>'format' can help with that stuff
<random-nick>what does #~ before a sexp mean? is that a guix extension?
<davexunit>random-nick: yes. that's a reader macro in guix.
<davexunit>see "g-expressions" in the manual
<davexunit>the guix manual, that is.
<random-nick>so how do they implement a reader macro?
<random-nick>is there some special code in guile that is reserved for guix?
<davexunit>random-nick: no, it just uses guile's reader macro API.
<random-nick>is that in the guile manual?
<davexunit>not sure.
<davexunit>never looked for it or reached for reader macros
<davexunit>so I don't know what is used.
<random-nick>it seems to be a procedure called read-hash-extend
<random-nick>outside any modules
<random-nick>closures are never copied, right?
<davexunit>random-nick: what do you mean by a "closure"?
<davexunit>from the perspective of the Guile implementors, a "closure" is an implementation technique, not something that a user sees.
<friedr>I want to automatically run geiser (for autodoc support) when I'm opening a file in scheme mode unless there's already a running instance. Is there a function to get that information?
<friedr>I thought it's better to ask here, because most of you use Geiser for editing, right?
<davexunit>friedr: add a hook to the scheme major mode?
<davexunit>and figure out a predicate to test for the existence of a geiser repl
<friedr>Yes, that's not the problem, but I need to know whether it's already running.
<friedr>Oh, yes, that's what I need.
<davexunit>(unless (geiser-guile-repl-p) (run-guile))
<roelj>friedr: I'm also interested in this. So far I've had good experience with just running a repl at Emacs startup a
<davexunit>where geiser-guile-repl-p is left as an exercise for you.
<friedr>Actually your geiser-guile-repl-p was what I wanted to ask for. :)
<friedr>Maybe just running one Geiser at startup is good enough.
<davexunit>I usually have 1 or 2 geiser repls running at any given time
<davexunit>and my emacs sessions last for many days at a time
<davexunit>usually weeks
<roelj>davexunit: What's the reason for having multiple REPLs open at any time? (just curious)
<davexunit>roelj: I have a REPL open for random hackery (usually quick math) and often enough I connect to running Guile programs for live hacking
<davexunit>usually a game I'm working on
<roelj>Woah, never thought of that
<davexunit>like this game:
<roelj>Cool. The graphics look a bit like Volfied
<roelj>Ah, I see you're using SDL. That must perform pretty well then
<davexunit>SDL handles a lot of thigns for me.
<davexunit>and OpenGL is used for rendering
<davexunit>it performs okay
<davexunit>could definitely be way better.
<davexunit>there's a lot of overhead in the way I've chosen to implement game state with pure functions
<roelj>Is that inherent to the functional programming style?
<roelj>Or just the time constraints for entering the game competition?
<roelj>davexunit: I wrote an AI for "Planet Wars" about a year ago and I implemented the performance-critical things in C.
<roelj>SDL is doing most of the performance-critical stuff already I guess
<davexunit>guile 2.1 has solved a number of my performance problems
<davexunit>and allowed me to remove the use of a C library for matrix multiplication
<roelj>That's nice
<random-nick>davexunit: closures as functions which preserve at least some variables
<jmarciano>davexunit: nice game to learn from, I have seen the animation on the page (after your email to Guile mailing list=)
<jmarciano>looks similar to something I was making in assembly on Motorola CPU
<sapienTech>hey all, I've been working with guile for a while, but haven't been able to figure out how values like #f #t #:optional... are defined. For example, I can't make my own functions or macros starting with #
<sapienTech>I imagine they are similar to " which lets the parser know that a sting is coming up?
<dsmith-work>sapienTech: Ya, those are somewhat magic.
<dsmith-work>sapienTech: You *can* use string->symbol to create a symbol with any chars. But that's what you are asking.
<dsmith-work>There is way to extend the reader. read-hash-extend I think.
<dsmith-work>s/that's what/that's NOT what/
<sapienTech>dsmith-work: thanks for the response. I will look into reader extensions to give me some practice working with these concepts. At a high level, does the reader designate characters like % & and # as special values that it will interpret differently from other ascii values?
<sapienTech>and if that is the case, what does it do once it reads these characters? for example once it sees #f, how does that get represented in the AST?
<dsmith-work>sapienTech: Well, the reader returns a "datum" per the Scheme specs.
<sapienTech>okay so it seems like there are some things i need to read more about, what would be the best resource for learning about the reader + datums, the SRFI's?
<dsmith-work>sapienTech: For Scheme, I'd read the apprropriate RnRS spec. Note that the read-hash-extend thing is very guile specific.
<dsmith-work>sapienTech: The point is, the reader returns data, not scheme.
<dsmith-work>sapienTech: Try it out at the guile prompt!
<dsmith-work>scheme@(guile-user)> (read)
<dsmith-work>$1 = #f