IRC channel logs

2014-11-17.log

back to list of logs

<cky>mark_weaver: Re the R7RS promises thing, delay-force was a compromise of a sort. From what I remember (apologies for any misremembering I have), foof (Alex Shinn) vehemently opposed the inclusion of lazy; he thinks it's unnecessary and that it's a quality-of-implementation issue (that quality implementations should know to translate (delay (force ...)) into the equivalent of (lazy ...)). Others strongly
<cky>disagreed with him, and asked for it to be included anyway.
<nalaginrut>morning guilers~
<cky>mark_weaver: Anyway, it's named delay-force because it's supposed to have the same semantics as (delay (force ...)).
<cky>nalaginrut: G'day!
<nalaginrut>gday!
<cky>nalaginrut: Re argc == 0, I saw that a month ago you posted a patch to Guile to support it, so I linked to your message in my Quora post. :-D
<nalaginrut>cky: after you mentioned another similar issue, I found there're lot of issues related to argv[0]
<cky>Yes, and they should all get fixed. :-)
<nalaginrut>anyway, I never dig it, so it's fixed 3 years later...
<cky>:-)
<jenia>hello. how can I save a guile session and load is again?
<davexunit>jenia: what do you mean by a "guile session"?
<jenia>the repl: scheme@(guile-user)> '()
<jenia>$1 = ()
<jenia>scheme@(guile-user)>
<jenia>davexunit, ^
<davexunit>you'd like to save the $x variables?
<davexunit>or all top-level variables in the guile-user module?
<jenia>well, reload the entire program. So I want to go through the little listen, enter commands into the REPL and reload tomorrow to continue from the same point.
<jenia>little schemer*
<davexunit>there isn't a built-in way to do that, afaik.
<davexunit>why don't you write your re-usable procedures to a file?
<jenia>hummm. okay. so how would you do something similar?
<davexunit>that way you can open the repl and just evaluate that file
<jenia>yes.
<davexunit>create a module
<jenia>okay. ill read into that
<jenia>thanks
<davexunit>you're welcome
<jenia>davexunit, I just remebered. I can use emacs-babel for that, worse comes to worse ;)
<cluck>i have to admit being able to save an image of the world (like one can do in most CLs/smalltalks) would be a nice feature to have
<sneek>cluck, you have 1 message.
<sneek>cluck, mark_weaver says: The Raspberry Pi is fatally flawed from a perspective of software freedom, see <https://www.fsf.org/resources/hw/single-board-computers>. Also, Guile works just fine on ARM, in fact the bot that just delivered this message to you is Guile running on ARM (beaglebone black). Please don't spread misinformation.
<cluck>mark_weaver: you misunderstood me completely (or i did a fairly bad job of explaining myself), i know full well guile can run atop linux on ARM, i was however talking about the possibility of running it on bare metal
<nalaginrut>cluck: there're so many dependencies of Guile, so IMO it's very unlikely to run on bare metal
<nalaginrut>or you have to port whole Guile to a tiny OS
<nalaginrut>cluck: for bare metal Scheme, I'll recommend picobit
*nalaginrut wants to rewrite picobit with Guile compiler tower
<cluck>mark_weaver: also, if memory serves me the question in the first place got raised in my mind due to the announcement of lowrisc/risc_v (which suffers of no such freedom issues) and i admittedly thought of the pi because despite being ARM and needing non free bits, it's the closest thing available (given price range, hackability, form factor, communities involved) and if it could be done in one platform...
<cluck>nalaginrut: yes, i realize that. tbh my thought process was "hmm... maybe a barebones port atop a rumpkernel isn't entirely impossible"
<nalaginrut>cluck: I don't think Guile is suitable for pure embedded system, if it runs on rpi, it's because rpi is tinyPC
<nalaginrut>one have to look for other Scheme implementation
<cluck>nalaginrut: well, it all started with a discussion/rambling on #emacs i think, about how nice it would be to have a modern lisp machine, so the idea was never an embedded system but cutting down on the non lispy bits between you and the hw
<cluck>nalaginrut: i quickly came to the conclusion that getting rid of all the C parts would be futile (mostly because you'd end up having to maintain your own compiler tower)
<cluck>nalaginrut: i also prefer scheme to cl and i like gnu so guile would be the obvious starting point
<nalaginrut>cluck: it's possible to drop all C part, but for now, it's difficult
<sg2002>Hello. Have a completely lame question - how do I do char operations on ansi characters in guile?
<cluck>nalaginrut: i figured as much
<nalaginrut>short story is: we have to implement VM (high optimized for embedded system), which is written with C
<nalaginrut>to drop all C part, we have to write AOT compiler with pure Scheme, which is possible
<nalaginrut>but challenging ;-)
*nalaginrut go to lunch
<sg2002>For example in racket this would work (char=? (first some-list) #\\b). How do I match "b" in guile?
<sg2002>Sorry, for the lameness of this question, but the reference is not extremely helpful, and my brain is not working that great after so many hours.
<serhart>sg2002: afaik that should work in guile
<serhart>if the thing being returned by (first some-list) is a character that is
<cluck>nalaginrut: anyway, for the thing to take off there would have to be a low entry cost, so a community can grow, it would have to be something like the lowrisc (because we at #emacs love freedom too) but that's not available yet, price wise the pi comes closest (and since i'm not too familiar with guile internals thus my question)
<serhart>and not "b"
<cluck>nalaginrut: yes, i got there eventually. anyway this was more of a "what would it take to do that?", i certainly couldn't do it only on my own but rough figures meekly say it wouldn't be an impossible endeavor for a small dedicated team
<sg2002>serhart: Yeah, it looks like I misunderstood some error message. Thanks.
<cky>sg2002: Did you win in the end?
<sg2002>cky: Yeah.
<sg2002>Ok, now another lame question from me - I have to use guile 1.8.7 and there does not seem to be either fold or reduce functions. They are in the reference, in the SRFI section, but I get unbound variable when trying to call them?
<cky>(use-modules (srfi srfi-1))
<sg2002>cky: Thanks.
<sg2002>Ok, hopefully the last dumb question from me for today at least - how do iterate over a list? I know that it's (do (i init step)(body)). What should be my init and step in case of a list?
<lloda>something like this?
<lloda>(do ((l '(1 2 3) (cdr l))) ((null? l) 'end) (display (- (car l))))
<lloda>this seems so strange. One uses for-each for this, not do.
<nalaginrut>I wonder if `do' is still faster than tail-recursive, or cool guy should drop it
<sg2002>Oh well, if in doubt, use recustion. Just rewrote my loop using a recursive function.
<ArneBab>sneek: later tell davexunit: I think it would be great to have an option to save the whole guile session as a module. ,save-session-as-module "save-the-world-again.scm"
<sneek>Okay.
<nalaginrut>ArneBab: I've ever tried session-store, but it's limited on our current implementation
<nalaginrut>for an instance, we need serializable-continuation at least
<ArneBab>nalaginrut: would it be possible to just store all inputs?
<nalaginrut>ArneBab: then restore session by run them one-by-one? I think it's possible
<ArneBab>yes
<nalaginrut>My approach was to serialize bytecode of current-module
<nalaginrut>and reload it
<ArneBab>that sounds more powerful - but then you can’t save them, right?
<nalaginrut>it works, but there's problem
<nalaginrut>IIRC, you can save
<nalaginrut>but when you restore it, it'll cover your current env
<nalaginrut>so it's better do it when Guile boot, not when you've done something
<ArneBab>so guile would have to include it by default?
<nalaginrut>yes, I think so, if you want to recover, you have to do it in init, or when you enter Guile
<ArneBab>so something like a commandline option --restore <savefile>?
<nalaginrut>but IIRC wingo said this way is not so cool, and limited to the current Guile implementation
<ArneBab>or --restore-session
<nalaginrut>so I think it's not proper to put in guile-core, but another plugin of REPL
<nalaginrut>so sada
<nalaginrut>sad
<ArneBab>yes
<ArneBab>I’m using something like that with python to run a multi-week program on a cluster with a 3-day limit.
<nalaginrut>I think there'll be a nice REPL plugins-set in the future, since our REPL is flexible enough
<nalaginrut>but it's not in high priority now, we need more practical projects to make Guile useful
<nalaginrut>ArneBab: oh, something distributed system?'
<nalaginrut>like termite?
<ArneBab>nalaginrut: running a tracer transport model on a cluster
<ArneBab>nalaginrut: I think it would be useful to find out what the Erlang-using company uses Guile for.
<ArneBab>(did anyone ask?)
<ArneBab>(or even better: Ask for information *and a quote*?)
<nalaginrut>ArneBab: could you elaborate it? I guess it's erlang like, to send session to other nodes
<ArneBab>nalaginrut: I just split the code into several sections (stored as strings), and after every step I serialized the session to disk and submitted the next cluster job to load the session and continue the execution.
<ArneBab>the python-code in that was only the controller which drove a fortran model.
<ArneBab>in guile that could be done even more elegantly: store and resubmit after each top-level form.
<ArneBab>or just creating a macro: (submit-chain submit-command session-name body ...)
<ArneBab>I just realized again how much more powerful guile is compared to python…
*ArneBab is in awe
<nalaginrut>ArneBab: if you don't care about the environment (running context), it's OK to do it with run-string-as-cmd
<nalaginrut>but the environment-related stuff is the advantage of continuations
<nalaginrut>which is the hard part...
<ArneBab>for this you need all the *results* of all forms you evaluated - including stuff like starting an external process and saving the result into a variable
<ArneBab>this is not the simple “save as module” anymore, though.
<nalaginrut>yes, it's serializable-continuation, not just dump bytecode of current-module
<nalaginrut>and to my current understand, it's limited under some situation
<nalaginrut>I mean, you can't serialize all the things, in principle
<nalaginrut>the hard part is how you handle the state between nodes, which is transparent in local when you have continuation
<ArneBab>since continuations are used quite a bit in guile, I guess that it’s pretty hard to get this right…
<nalaginrut>well, for Scheme, I think it's not so easy, but I saw many implementations and papers indicate that this would be cool in Scheme language...
<nalaginrut>so I think it's worth to try anyway
<nalaginrut>I've no idea how hard it's on Guile ;-P
<ArneBab>
<nalaginrut>but it's a trend for the future language I think
<nalaginrut>just like thread (C11 has thread now)
<nalaginrut>we have good delimited-continuations integrated in the core, so maybe we can do better with continuations
<nalaginrut>while people said Scala is good because of delimited-continuations, I tried it but realized it's just a plugin
<nalaginrut>and I wonder if it's a toy to let people play & learn what's delimited-continuations
<civodul>Hello Guilers!
<ArneBab>nalaginrut: likely yes
<ArneBab>moin civodul
<ArneBab>nalaginrut: would you like to have a look at the wisp SRFI I drafted?
<nalaginrut>heya civodul
<nalaginrut>ArneBab: oh it's my honor ;-)
<nalaginrut>but where it is ?
<ArneBab>I’m creating the new version now. The old one is at http://draketo.de/proj/wisp/srfi.html - I’ll upload the new one in a moment.
<nalaginrut>ok, please notice me when you done the new one ;-P
<ArneBab>nalaginrut: it’s updated now: http://draketo.de/proj/wisp/srfi.html
*nalaginrut is reading
<ArneBab>thanks!
<ArneBab>nalaginrut: I just did some additional polishing - if you reload you should get the current version (added the requirements to the syntax and renamed bracket to parenthesis)
*taylanub didn't know Alex Shinn was foof
<nalaginrut>I know it ;-P
<nalaginrut>ArneBab: the colon has to be rounded by two whitespaces ?
<nalaginrut>alright, it's reasonably for s-expr
<ArneBab>nalaginrut: yes
<ArneBab>nalaginrut: I want to avoid breaking code which uses : as part of a names
<ArneBab>a names → names
<ArneBab>nalaginrut: did you already finish reading the SRFI?
<dsmith-work>Morning Greetings, Guilers
<ArneBab>moin dsmith-work
<sg2002>Hello. How do I update an element in a nested vector?
<sg2002>(define test (make-vector 2 (make-vector 3)))
<sg2002>(vector-set! (vector-ref test 1) 0 "r")
<davexunit>sg2002: like #(1 2 #(3 4)) ?
<sg2002>This for some reason updates every element at post 0 in every nested vector.
<davexunit>yes, because you've initialized each element of the vector with a reference to the same vector.
<sg2002>davexunit: Oh!
<davexunit>(make-vector 3) isn't evaluated for each element, the result of that procedure call is passed as the init element to the outer make-vector call
***paroneay` is now known as paroneayea
<sg2002>So what's the idiomatic way to fill a vector with different nested vectors?
<davexunit>sg2002: you could create the vector, and loop from 0 to vector-length and vector-set! each element.
<davexunit>I would then write a procedure to encapsulate that.
<lloda>srfi-43 has (vector-unfold (lambda (i s) (values (make-vector 3 s) s)) 5 0)
<lloda>if all subvectors are the same length I'd use a 2D array instead
<davexunit>lloda: yes, good point. guile's arrays will make this nicer.
<sg2002>What would be advantage of arrays in such scenario?
<sg2002>Oh, I see. Mulitidimensional arrays can be accessed rather easliy.
<davexunit>yes
<ArneBab>sneek: later tell nalaginrut: I’m AFK for now, but I’ll read the backlog. Please tell me when you finish reading the SRFI.
<sneek>Got it.
<mark_weaver>sg2002: why do you need to use guile 1.8? it's been unsupported for many years now.
<sg2002>mark_weaver: I'm writing a script for lilypond. That's the version that it uses.
***spock is now known as Guest33437
***fangism-hongry is now known as fangism
<stis>How do I find the filename tha loaded module has?
<stis>current-filename is not working
<dsmith-work>stis: module-filename I think
<dsmith-work>stis: But it's not the full path to the file from the root.
<stis>np, I know how to use %load-path for that.
<dsmith-work>stis: It's the "offset" from the load-path, IIRC.
<stis>current-filename is interesting tho.
<dsmith-work>module-filename is not doucmented though..
<stis>yeah, hitting tab on module- makes you enter teh swamp of unsuportedness
<dsmith-work>heh
<stis>no I haveing problems, I am trying to piggy pack a prolog module system ontop og guile's
<stis>I need to know the modules file path before it is defined
<stis>as a module
<stis>at compile time
<stis>yeah syntax-source will do it