IRC channel logs

2014-08-08.log

back to list of logs

<nalaginrut>morning guilers~
***DeeEff_ is now known as DeeEff
<plotr>I've got problems with "bad let in form" - could you have a look into http://paste.org/74033
<plotr>this seems so basic that I'm totally puzzled
<nalaginrut>plotr: you need one more level parens
<plotr>around what?
<nalaginrut>plotr: (let ((a 1) (b 2)) ...)
<plotr>that doesn't seem to help
<plotr>unless I've failed to count all the parenthesis properly :)
*alezost believes plotr has failed to count again
<plotr>could you paste properly-counted example?
<nalaginrut>plotr: actually, an experienced Schemer doens't count it, it's obvious
<plotr>well, not all are born an experienced Schemer
<nalaginrut>plotr: yes, but you should try it at least
<nalaginrut>you should try what I've told you
<plotr>I did - see the updated paste
<nalaginrut>I don't see any change
<nalaginrut>ok I see
<nalaginrut>so what's the current error now
<plotr>he-he
<plotr>let: bad let in form
<alezost>plotr: let is ok now
<nalaginrut>alright, it's another error from let now
<nalaginrut>there should be at least one return value/expr in `let'
<alezost>plotr: there should be something in the let body: (let ((a 1) (b 2) (+ a b)))
<alezost>plotr: i mean: (let ((a 1) (b 2)) (+ a b))
<nalaginrut>plotr: your program has two bugs, you fixed the first, it's the second one now, although it looks like the same let error
<plotr>thanks for explanation
<nalaginrut>np
<janneke>i have submitted two batches of Emacs/Guile integration patches and am waiting for comments
<janneke>this was a first and easy step up to Eclipse (don't shoot me) integration
*janneke hurries to explain that he tries to get his team to adopt Guile
<janneke>converting everyone to Emacs is too much for now
<janneke>do you know of a better scheme/guile starting point for Eclipse than the SchemeWay plugin?
*nalaginrut doesn't use Eclipse
<nalaginrut>but I know there's Emacs mode in Eclispe ,so it's a potential alternative if I can't find Emacs
<janneke>i don't expect anyone here to use Eclips ... but it's always best to ask
<janneke>nalaginrut: hah!
<janneke>my team members are blocking guile adoption (as one of the reasons) for want of lacking editor (emacs as well as Eclipse) support
<janneke>plotr: use paredit.el and hardly ever count a parenthesis again
<nalaginrut>janneke: well, I believe Emacs is the best choice, and I've heard Sublime is cool but not free
<janneke>I believe so too...
<janneke>but it's not about what I believe, it's about what others believe -- and two of them believe they can only use Eclipse
<nalaginrut>hmm...yes, that's a problem, sometimes belief can't make people trust...
<nalaginrut>but, if we don't have to handle bunch of objects, like Scheme, is it so cool to play Eclispse too
<nalaginrut>some guys told me, they love Eclipse because it handles all the objects/classes well
<nalaginrut>I don't know if it's cool when you play FP on it
<nalaginrut>out of topic, last time I tried to play delimited-continuations in Scala, but I realized it's not so easy to configure as the tutorial/stackoverflow described
<nalaginrut>now I have to say I love Guile because you can play delimited-continuation even closing your eyes...
<janneke>nalaginrut: that off topic Scala is interesting
<janneke>although i don't understand what you say about delimited-continuations
<janneke>Scala is mentioned as having great Eclipse integration, and strong compile-time typing and THUS superiour to Guile
<janneke>in my team
<plotr>janneke: thanks for the hint
<plotr>I've got some more questions on http://paste.org/74038 - it fails with "source expression failed to match any pattern in form (let*" - what does that mean?
<plotr>I've added call to function returning value as last element of let as it's been advised here
<janneke>plotr: every function returns a value
<plotr>ok, so what's the reason for "bad let" error we've discussed before?
<janneke>the let does not have a statement
<janneke>try:
<janneke>
<janneke>(define (test-func3 param3)
<janneke> (let* ((gtksck (make <gtk-socket>))
<janneke> (gtk-socket-get-id gtksck))))
<janneke>oops
<janneke>(define (test-func3 param3)
<janneke> (let* ((gtksck (make <gtk-socket>))
<janneke> (gtk-socket-get-id gtksck)))
<janneke> #t)
<janneke>oops again soryr
<janneke>sorry
<janneke>try: (define (test-func3 param3)
<janneke> (let* ((gtksck (make <gtk-socket>))
<janneke> (gtk-socket-get-id gtksck))
<janneke> #t))
<plotr>ahh, no I got it
<plotr>thanks, that make sense now
<plotr>doh! the error messages in guile could really use some clarification :)
<janneke>:-)
<taylanub>plotr: "source expression failed to match any pattern in form" is Guilespeak (or Schemespeak?) for "syntax error" :) well actually more like "you used a macro or special form wrongly" ('special form' includes stuff like `if' and `lambda' which aren't macros)
<taylanub>Indeed I wonder if we would turn that into "wrong usage of special form or macro," whether it would be wrong in some cases (not general enough).
<plotr>so basically "something went wrong around this line" :)
<taylanub>plotr: yeah, but a "syntactic" error (but not "lexical" like unbalanced parens but rather the structure of the sexpr), meaning also it happened during compilation, which might not be obvious in a REPL
<taylanub>contrast that to e.g. (+ "foo" 3) which will raise a wrong-type-argument exception
<plotr>thanks for clarification
<janneke>taylanub: isn't LET defined as a syntax-case or case-lambda?
*janneke easily finds ice-9/psyntax.scm:3035:(define-syntax let*
<taylanub>janneke: definitely not case-lambda, since that makes procedures; let is obviously not a procedure. it can be implemented with syntax-case based on `lambda' though, (let ((var val) ...) body body* ...) is 1-1 equivalent to ((lambda (var ...) body body* ...) val ...)
<janneke>expand.c:159:SCM_SYNTAX ("let", expand_let);
<janneke>
<taylanub>I suppose psyntax might be doing just that, though it's also noteworthy that it will not just naively compile to code that really allocates a procedure and calls it; that would be something you'd expect from a toy implementation that's not very efficient
<janneke>taylanub: yeah, I hoped so. turns out it's in expand.c :-(
<janneke>i still wonder about let*, the easier case...
<janneke>if it isn't possible to add to the syntax-case some common error cases
<janneke>i'm a total newbe with macros... but it seems that psyntax.scm:3035:(define-syntax let*
<janneke>defines just one case
<janneke> (let* ((x v) ...) e1 e2 ...)
<janneke>what happens if we add something like
<janneke> ((let* ((x v) ...)) (syntax-error "missing body on let*")
<janneke>and
<janneke> ((let* (x v) e1 e2 ...) (syntax error "missing parentheses on let*"))
<taylanub>the template (x (y z) t) will match (x ((a b) (c d)) t) where y=(a b) and z=(c d)
<janneke>taylanub: yeah.. :-(
<taylanub>but you can do it by testing for them with `identifier?' or so, that's not really the problem
<taylanub>the question is whether it's worth that; I'd just see if there'd be any drawbacks in changing the generic "failed to match any pattern" message to the hopefully equally generic but more humane "wrong usage of a special form or macro"
<janneke>taylanub: finding (let ((x)) e) ;; v is missing
<janneke>or finding (let ((x v v1))) ;; extra v1
<wingo>improvements are definitely possible
<janneke>if there are no speed penalties, having more specific error messages is a great plus, if you ask me
<wingo>perhaps we should implement syntax-parse
*janneke is just in the process of trying to convert his team to Guile
<taylanub>janneke: it bloats up the code to check for every possible mistake
<wingo>taylanub: that's expansion-time "bloat", and the code would normally never run
<janneke>lowering the barrier to entry is always worth it
<taylanub>wingo: can you think of any drawbacks of changing the cryptic "source expression failed to match any pattern in form" message to something like "wrong usage of a special form or macro"?
<janneke>that's why my emacs/guile debugger/compilation mode patches
<wingo>well, you don't always know what macro is being expanded
<wingo>because syntax-case can run on subcomponents of a form
<taylanub>hm, I suppose one could, theoretically, use `syntax-rules' and `syntax-case' outside of a macro implementation; maybe the "wrong macro usage" thing could just be put in parantheses, prepended with "probably"
<wingo>taylanub: tbh i don't see the difference between the messages you mention
<taylanub>wingo: the second doesn't confuse new users :)
<taylanub>(not as much, anyway, a newcomer to Scheme could yet not know what "special form" means, but that's more or less where I'd draw the line in noob-friendliness)
*janneke would like something even friendlier
<janneke>noob.scm:4:8: missing parentheses: (let (a b) foo)
<janneke> ^ here
<janneke>well, the here is misplaced, but you get the point
<janneke>prolly that's not possible
<taylanub>hm, I agree that'd be nice, even when you're not a noob but just lazy
<janneke>or even how lilypond does it, with a tex-like line-break
<janneke>noob.scm:4:8: missing parentheses: (let (
<janneke> a b) foo)
<dsmith-work>Happy Friday, Guilers!!
<mark_weaver>janneke: 'let' is actually a core form, defined in module/ice-9/psyntax.scm. the one in expand.c is only used for bootstrapping.
<mark_weaver>on the stable-2.0 branch, it's on line 2163, starting with: (global-extend 'core 'let
<mark_weaver>line 2279 on the master branch
<mark_weaver>I agree that it would be helpful to recognize some common mistake patterns and print more newbie-friendly error messages in those cases.
<plotr>speaking of which - could you recommend your favorite guile tutorial?
<mark_weaver>hmm, I think we could use a good tutorial :)
<mark_weaver>I can recommend "The Little Schemer", but it's available only in dead tree form last I checked.
<mark_weaver>on the plus side, #guile often has friendly people around willing to help you get started.
<davexunit>that's probably the reason I stuck with guile
<davexunit>got a lot of help here
<mark_weaver>I learned Scheme from SICP (Structure and Interpretation of Computer Programs), a book which is freely available online, and there are video lectures too. However, it was designed as an introductory course for MIT engineering students, so it assumes that the reader is e.g. comfortable with calculus-level math.
<plotr>I'm more interested in guile specifics rather than in general lisp/scheme books
<davexunit>a tutorial that emphasises the features of Guile would be really cool.
<plotr>for example this thing about extra brackets and function call inside let-form is completely counter-intuitive
<davexunit>that's not guile specific, is it?
<plotr>and it's not immediately obvious from the guile manual
<paroneayea>davexunit: agreed, at several points in the past I went looking for one and got confused by the manual
<paroneayea>not that the manual is confusing
<ft>I think all you need is general familiarity with Scheme, and the "API Reference" and "Guile Modules" from the manual.
<paroneayea>and I'd probably have an easier time now that I know other lisps :)
<davexunit>the manual is really good one you have your feet wet.
<davexunit>s/one/once/
<paroneayea>ft: yeah, that may be true, but having a "guile tutorial" would also be great marketing for the project also
<paroneayea>could help adoption
<paroneayea>(replace marketing with another term if you like)
<mark_weaver>plotr: the problems you were having were with standard scheme constructs. understanding scheme itself is the hard part.
<ft>paroneayea: But aren't the "Hello Guile" And "Hello Scheme" parts of the manual introductions like that?
<mark_weaver>I agree completely that it would be great to have more introductory tutorial-style documentation for guile, btw. but I'm also trying to make suggestions given the fact that we don't really have that now.
<paroneayea>mark_weaver: understood and that's good of you :)
<mark_weaver>plotr: btw, regarding the fact that 'let' needs an inner body: it's worth noting that the variables you bind in a 'let' expression are only available within the inner body. so there's no point in having a let without a body.
<plotr>thanks for hints... I'll try to figure out what the person who decided to call head 'car' and tail 'cdr' was smoking :)
<davexunit>those names have history behind them
<mark_weaver>that comes from the earliest version of lisp.
<ft> http://en.wikipedia.org/wiki/CAR_and_CDR
<mark_weaver>the reason those names stuck is because they can be combined into things like (caddr x) which is shorthand for (car (cdr (cdr x)))
<mark_weaver>although nowadays we prefer to use 'match' for things like that.
<plotr>mark_weaver: so let-form is just a way to make sure that function code have "local" visibility?
<paroneayea>mark_weaver: yeah but even though I enjoy caddr on a hacker enjoyment level
<paroneayea>it's not easy to wrap one's mind around without doing it a bunch of times :)
<mark_weaver>plotr: I'm sorry, I don't understand what that means.
<plotr>it's kinda different from c-like languages where all the variables in function are local "by default"
<mark_weaver>plotr: you use 'let' when you want to bind a variable to a new value.
<paroneayea>oh I didn't know about the alternative terms "first" and "rest"
<paroneayea>man that's so much better :)
<paroneayea>even if it doesn't lead to "my other car is a cdr" type bumper stickers
<davexunit>paroneayea: I need that.
<mark_weaver>the other thing is that the names 'first' and 'rest' only make sense when cons cells are used to make lists. but cons cells can be used to make any kind of tree structure.
<plotr>mark_weaver: isn't it what (define ..) does?
<mark_weaver>or simply to make a structure containing two elements. but again, in modern times we tend to use 'records' for that.
<mark_weaver>plotr: well, 'define' is more limited. you can only use it at the toplevel or at the beginning of a body.
<mark_weaver>you can use 'let' anywhere
<plotr>I'm pretty sure I've seen define inside let while looking through manual
<mark_weaver>yes, the inside of a 'let' is a body, so 'define' can go at the beginning of the inside of a 'let'. or the inside of a procedure defined by 'lambda' or (define (foo ...) <here> ...)
<mark_weaver>anyway, if you're interested in Guile, I do recommend finding a good resource for learning standard Scheme first. The Little Schemer is one excellent choice to get started.
<plotr>thanks, I'll go through it
<mark_weaver>if reading code to solve simple problems would be helpful, I could offer my solutions to the first few dozen problems of Project Euler.
<mark_weaver>but I still recommend something like The Little Schemer first.
<janneke>mark_weaver: thanks for the info!
<mark_weaver>you're welcome!
<janneke>apropos tutorial...
<janneke>i like http://tryhaskell.org
<paroneayea>janneke: I like http://try-hy.appspot.com/ but for different reasons :)
<plotr>I love http://tuhdo.github.io/emacs-tutor.html but it's about The Holy Editor, not the language used in it :)
<paroneayea>plotr: that's awesome.
<plotr>ok, time to do Friday-thing :) was pleasure talking to you guys - so much better than initial impression from some arrogant dude who first said that experienced schemer like him do not count parenthesis... and immediately after that failed while counting it :-D
<mark_weaver>wingo: any chance you could take a look at https://lists.gnu.org/archive/html/guile-devel/2014-08/msg00005.html ? I'm not sufficiently familiar with the Guile debugger to feel comfortable reviewing that patch.
<wingo>mark_weaver: sure
<wingo>and greetings :-))
<janneke>wingo, mark_weaver: thanks!
<mark_weaver>thanks! and yes, it's been a long while since we talked. thanks, as always, for the awesome work on master. it's amazing how much faster it is :)
<janneke>i know that i am doing stupid things in that patch
<janneke>just found (for another patch) scm_sys_search_load_path
<janneke>the main thing is about the output right now, integration with Emacs/GUD
<janneke>and then there's also http://lists.gnu.org/archive/html/guile-gtk-general/2014-07/msg00000.html ...
<janneke>completely unrelated
<wingo>janneke: you can use read-string instead of gulp-port
<wingo>see the manual for read-string
<wingo>humm, will respond on the list; there are a few points there
*mark_weaver goes offline, ttyl!
<wingo>ciao :)
*davexunit is watching a talk by Olin Shivers called "Anatomy of a Loop"
<davexunit>pretty interesting. who else has seen it?
<ft>I have a few month back
<dsmith-work>davexunit: link?
<ft> http://www.youtube.com/watch?v=PCzNwWmQdb0
<ft>dsmith-work: ^- That one.
<davexunit>thanks ft
<dsmith-work>thanks
<davexunit>so, every friday the FSF licensing team hosts a meeting to improve the Free Software Directory <http://directory.fsf.org>
<davexunit>I've been adding/tweaking entries for guile libraries and applications
<davexunit>if anyone is interested in participating, you can jump on #fsf
<janneke>wingo: yes I found out about read-string and scm_sys_search_load_path talking here yesterday with davexunit :-)
<Wasmachine>janneke, what is up with that children's book anyway.
<janneke>Wasmachine: what book?
<Wasmachine>jip & Janneke, of course.
<janneke>dunno
<janneke>she happens to have fore a name what I have for a nick name
<Wasmachine>Ah, I thought you once said you named yourself after that
<janneke>i find that hard to believe, however, all stories are stories...
<janneke>in fact, jip & janneke might make a better story than `jan@gnu.org' was already taken
<Wasmachine>I concur.
<Wasmachine>If only because it's such an awful series of books.
<janneke>terrible
<janneke>she wrote brilliant things, most jip and janneke are not
<janneke>awfully stereotyped
<Wasmachine>I concur.
<Wasmachine>In general though, I'm wary of the influence that children's media has on kids in that regard.
<Wasmachine>If you watch anything from Disney you'll quickly arrive at the conclusion that kids are taught that all ugly people are evil and all pretty people are good for instance.
<Wasmachine>As someone who's vehemently ugly, I feel wronged I say.
<ijp>how do we know you are not evil?
<janneke>*lol*
<Wasmachine>Well, I am evil, because I'm sitting in a chair with a cat right ow.
<Wasmachine>Soon I'll start saying things like "Exactly as I planned."
<janneke>or worse, not ugly at all and still evil?
<ijp>"hes so evil he has even started losing his hair"
<Wasmachine>None of that.
<Wasmachine>Quite the opposite.
<ijp>you cant really blame disney though, that has been a trope for hundreds of years
<janneke>even to the point that there's been 'scientific research' into that area
<janneke>luckily, we have those beautiful round and paired () everywhere
<Wasmachine>ijp, I can blame society though, I always found it interesting that violence is bad for kids, but teaching them that if you blow someone in the face with a gun all that happens is that their face darkens and they're otherwise fine, that's an okay messsage to send to kids because it doesn't feature blood.
<Wasmachine>I'd rather my kids realize the dangers of guns in all its horror than being fed that.
<ijp>I bet you hate the road runner
<Wasmachine>Yes, that's the stuff I'm referring to.
<Wasmachine>Or how Daisy Duck is basically every single stereotype about women they could find compressed into one person.
<Wasmachine>Donald Duck also never fails to send messages like "every single street thug looks like a punker, also, every smart person ever wears glasses."
<ijp>well, all I know is, in my 24 years on this earth, I have never once ran off a cliff, stopped midair, looked down, and only then proceeded to fall
<Wasmachine>But have you ever ran of a cliff?
<Wasmachine>Clearly this requires some experimental testing.
<Wasmachine>Placebo effect must be accounted for of course.
<ijp>anyway, guile master branch build is well into its ninth hour...
<ijp>which makes it over 8 hours longer than the stable branch