IRC channel logs


back to list of logs

***fangism is now known as fangism-ctrl-ZZZ
<nalaginrut>morning guilers~
<lloda>i'd rather make (if #f #f) return (values) than have (values) return *unspecified* ~:-/
<taylanub>lloda: what was the context? looks like I missed some lines
<wleslie>there wasn't any, it was just a statement
<wleslie>lloda: do you mean 'then' rather than 'than' ?
<wleslie>otherwise I think I misunderstand
<taylanub>Well (values) certainly returns zero values here, though (if #f #f) and such return *unspecified* instead of zero values.
<lloda>no, I meant than ... I just saw some discussion on #emacs, and also David Kastrup's post in the ML
*taylanub checks
<lloda>that's it, I think *unspecified* is a bad replacement for zero values and it's only there because of a time when Scheme didn't have multiple return values, so you had to return *something*.
<lloda>or maybe I'm missing something...
<lloda>the only use I see for *unspecified* is for what it says in the tin, e.g.
<taylanub>looks like MV came with R5RS, so probably yeah
<wleslie>a one-legged if should not be used in value position, so *unspecified* seems like the thing to use
<lloda>scheme@(guile-user) [1]> (make-typed-array 's32 *unspecified* 10)
<lloda>$7 = #s32(43100208 0 38205280 0 43086816 0 43086752 0 43086624 0)
<saul><unspecified> is the RnRS behavior.
<lloda>wleslie: but if you use *unspecified*, the continuation will take that... you don't see the error.
<lloda>saul: well should it be.
<saul>What would you have it be?
<lloda>nothing, like (values)
<wleslie>perhaps make-typed-array should raise
<taylanub>R6RS says "unspecified values", IMO that's the best
<lloda>ah, that sounds better
<saul>I don't see "unspecified values".
<taylanub>regarding the spec, that is. in practice, I'd also be fond of zero values, would probably make things more error-resilient together with disallowing excess values, though I also heard arguments in favor of allowing excess values...
<taylanub>saul: "result of the expression is unspecified" sounds OK too
<taylanub>looks like it reuses that phrase often, it might be that it explains elsewhere that this means "any number of (unspecified) values"
<saul>taylanub, I see your point. (But would prefer they'd been explicit if that were their intent.)
<taylanub>"If an expression is said to “return unspecified values”, then the expression must evaluate without raising an exception, but the values returned depend on the implementation; this report explicitly does not say how many or what values should be returned. Programmers should not rely on a specific number of return values or the specific values themselves."
<taylanub>hrm, it should use that exact phrase then, but doesn't :P weird
<taylanub>anyway, clear enough IMO
<saul>Either way, the case should be avoided.
<taylanub>(that's from section 5.9 by the way)
<taylanub>one shouldn't try to use the return values of things like (if #f #f), yes. question is just, should implementations be mandated to signal it as an error?
<taylanub>or, more relevant to this channel, should Guile do so?
<saul>I would say "yes" to the latter.
<wingo>hoo, i have been out of it
<wingo>hacking leads to distraction
<lloda>isn't it the other way around? ;p
<lloda>hacking is what matters
<wleslie>good morning. you have been hacking for nine, nine, nine, nine, nine,
<janneke1>if i were to write a parser for a small c-like language in guile, what would i use?
<wingo>janneke1: probably the lalr parser generator and a custom tokenizer
<wingo>although you can use a tokenizer generator i think, or you could use the parser generator to generate the tokenizer
<wingo>or (but only on master), you could use the PEG parser
<wingo>janneke1: check module/language/ecmascript/parse.scm and module/language/ecmascript/tokenize.scm
<wingo>^ peg docs
<janneke1>thanks wingo!
<janneke1>yes so module/language would be an option besides larl-scm
<janneke1>a newbe question: can you do functional pattern matching in scheme
<janneke1>so, have guile warn me if one of the patterns is missing?
***janneke1 is now known as janneke
<lloda> ?
<nalaginrut>janneke: for new language parser, maybe you'll be interested in this
<janneke>lloda: that's regular expression?
<janneke>lloda: i'm looking for functional pattern matching (not string/regexp)
<nalaginrut>janneke: I think the page lloda gave you is not about regexp
<nalaginrut>it's pattern matching
<janneke>Ok, sorry lloda I'll look into it
<janneke>nalaginrut: this `simple' is actually an example for guile's module/language?
<nalaginrut>janneke: yes, it's a simple enough example for it, and complete in process
<nalaginrut>so you can learn how and what you should do for a language front-end
<nalaginrut>but it doesn't cover 'how to write a parser"
<nalaginrut>or lexer
<janneke>very nice
<nalaginrut>but you may throw questions here, for writing parser, I'm glad to discuss about it ;-D
<janneke>nalaginrut: thanks!
<janneke>simple@(guile-user)> 1+1
<janneke>$1 = 2
<nalaginrut>I'm a big fan of multi-lang in Guile, so I'm glad to see another
<janneke>nalaginrut: ah!
<amgarching>Are the RHS expressions in the let-form evaluated in order? Even if some of the bound variables are not used? I observe "comment-line" being different if I return "rest-of-line" (commented) or do not.
<wingo>hm, i think the scalar replacement stuff is going to really help elisp
<wingo>given that elisp tends to use setq a lot
<civodul>wingo: "scalar replacement"?
<wingo>"scalar replacement of aggregates"
<wingo>replacing (let ((a (box foo))) .... (box-ref a) ... (set-box! a b) ... (box-ref a) ...)
<wingo>with (let ((x foo)) ... x ... ... b ...)
<wingo>you get it for free with a small addition to cse that is already in guile
<wingo>so effectively what we have now is
<wingo>(let ((a (box foo))) .... foo ... (set-box! a b) ... b ...)
<wingo>i have an addition to DCE that can determine when e.g. set-box! wouldn't cause a type check and so doesn't cause a to be live
<wingo>so really we rely on DCE to remove the box and set-box! etc expressions if possible
<wingo>so it's two parts: one is reasoning about what is in an aggregate object; the other is removing the aggregate object
<wingo>in the case of elisp you get a lot of boxes, so that's the application there
<dsmith-work>Hey hey
<davexunit>here's to hoping that guile becomes the VM to run elisp in the near future.
<civodul>wingo: oh, nice
<civodul>i would have thought this was much harder to get
<wingo>it's not that bad
<civodul>but i guess the compiler in 2.2 is very smart nowadays :-)
<wingo>in cse you just make an auxiliary definition each time there is a cons or a set-car or something
<wingo>effectively saying that if, at that position, you do (car x) -- e.g. -- you would get y
<civodul>ok, interesting
<wingo>and you synthesize "read" effects for every write operation
<civodul>hence the "aggregates"
<wingo>so that if you are at label N and you look for the expression (box-ref X) at label M
<wingo>you will end up looking up (box-ref X) in a hash table -- that's what's called "value numbering"
<wingo>so that hash table gives you a list of labels at which (box-ref X) has a value
<wingo>and if any of those labels reaches M, then you can replace
<wingo>or elide, as appropriate.
<wingo>er, my explanation about label N and M was confusing
<wingo>consider N and M to be the same for the purposes of this horrible explanation ;)
<civodul>you have to know whether there were effects between N and M, i guess
<civodul>whether the value of X changed, right?
<stis>wingo: isn't the optimizations of set! semantically difficult in view of call/cc ?
<wingo>basically scalar replacement falls out of CSE -- the same cases in which an expression could be known to be equivalent to another expression are the ones in which you can propagate knowledge of what's in an aggregate data structure
<wingo>stis: the effects analysis we have is very coarse. it lumps all objects of a given kind in the same box
<wingo>and call/cc is considered to have unknown effects
<wingo>which means that it is considered to read and write to all boxes
<wingo>basically making it a barrier to most read/write-related optimizations
<wingo>so you only get the real benefits when you are in a piece of code whose effects are totally known
<stis>yeah that's one of the reason for my earlier quest of redo safe variables.
<stis>To enable semantically ok optimisations of elisp set! intensive code
<stis>even in cases when there is effects
<stis>FYI, the trick is ofcause to mark varibles or use special boces that has semanticall another meaning than normal variables e.g. beeing redo safe
<stis>boces -> boxes
<stis>I think it is a good idea, but i won't stress it anymore.
<stis>I'm using it heavily in guile-log and guile-prolog though on an application level
<civodul>Marco Maggi's "Infix" library looks cool
<civodul>well, for math people, it must be
*stis looks
<stis>\\me loves math
<stis>civodul: would be cool to have something like sage for guile
<civodul>i'm not a "math person", though ;-)
<civodul>i just happen to be acquainted with such people ;-)
<stis>I'm in industry right know but have a sweet tooth for math.
<stis>I'm applying it all the time.
<lloda>maxima is written in lisp, right? if it could run under Guile...
*stis drools
<stis>The problem with porting lisp code is that it's usually very imperative, at least that's my impression.
<stis>But maxima my be different
*stis suffers from bad dreams after porting the sbcl assembler
<wingo>i think mark_weaver wanted to do a maxima in scheme
<stis>Maxima is GPLv2, I would have liked a LGPL.
<wingo>wooo hoo, finally working
*stis waves
<dsmith-work>wingo: wat?
<stis>civodul: maxima is not to bad Maxima has 195 files, of that only 49 uses dolist
<stis>also from looking at some files, they seam to use tail call's a lot
<stis>as a looping
<taylanub>dsmith-work: have my logs:
<wingo>scheme@(guile-user)> (use-modules (ice-9 match))
<wingo>scheme@(guile-user)> ,c (match (vector 1 2 3) (#(a b c) (+ a b c)))
<wingo>Disassembly of <unnamed function> at #xb0:
<wingo> 0 (assert-nargs-ee/locals 1 0) ;; 0 args, 0 locals at (unknown file):2:0
<wingo> 1 (make-short-immediate 0 26) ;; 6
<wingo> 2 (return 0)
<davexunit>wingo: wow!
<davexunit>that's extremely impressive.
<stis>pulled master
<civodul>indeed, wow
<stis>dce.scm takes a looong time to compile
<dsmith-work>wingo: Very cool indeed.
<stis>long long compilation :-)
<stis>anyone: should we team up to port maxima to guile, I'm in.
***ozzloy_ is now known as ozzloy
<dsmith-work>wingo: Any interest in providing some kind of bootstrapping speedup for building guile? Like using an already existing guile, or precompiled .go files?
<dsmith-work>That message from ldconfig about libguile-*-gdb.scm not being ELF is annoying.
<dsmith-work>The ice-9 crystallization is progressing!
<davexunit>"and I would take from the ground some of the blue-white poison that makes statues of men"
<stis>wingo: cool, but
<stis>cheme@(guile-user)> (use-modules (ice-9 match))
<stis>scheme@(guile-user)> (define (f x y) (let ((v (vector x y))) (match v (#(x y) y))))
<stis>scheme@(guile-user)> ,x f
<stis>Disassembly of #<procedure f (x y)> at #x10c94b8:
<stis> 0 (assert-nargs-ee/locals 3 0) ;; 2 args, 0 locals at (unknown file):2:0
<stis> 1 (return 2)
<stis>scheme@(guile-user)> (define (f x y) (let ((v (vector x y))) (match v (#(x y) (set! v y))) v))
<stis>scheme@(guile-user)> ,x f
<stis>Disassembly of #<procedure f (x y)> at #x10ca6d8:
<stis> 0 (assert-nargs-ee/locals 3 0) ;; 2 args, 0 locals at (unknown file):3:0
<stis> 1 (make-short-immediate 0 4) ;; #f
<stis> 2 (make-vector/immediate 0 2 0)
<stis> 3 (vector-set!/immediate 0 0 1)
<stis> 4 (vector-set!/immediate 0 1 2)
<stis> 5 (box 0 0)
<stis> 6 (box-set! 0 2)
<stis> 7 (box-ref 0 0)
<stis> 8 (return 0)
<stis>else pretty cool
<add^_>I think guile has become somewhat simpler to install on ubuntu since the new version.
<add^_>the libiconv-1.14 seems to not want to build though
<add^_>gets being unsecure, and "switch to fgets"..
*add^_ sighs
*add^_ facepalms
<add^_>it seems like I already have it anyway..
*dsmith-work commiserates
<add^_>Ah, not friday yet
<taylanub>ugh, `library' forms only work when I `import'? I hoped they would just emit a usual `define-modules' and stuff so I can treat them as Guile modules in every other way
<taylanub>never mind, looks like I have a different problem. `library' is simply not recognized
<taylanub>"not recognized" was bad wording, I get a "failed to match ...", and apparently I must put the exports before the imports .. weird. It's also that way in R6RS, but I didn't think that was really required, and the manual doesn't reflect it ... patch incoming