IRC channel logs

2015-06-08.log

back to list of logs

<mark_weaver>ijp: this reminds me of http://bugs.gnu.org/18604
<mark_weaver>quite likely the same underlying issue
<mark_weaver>I told wingo about it long ago, but it hasn't yet been fixed.
***karswell` is now known as karswell
<cluck>davexunit: yeah, we could totally use a few short and sweet screencasts with the basics, just dump them on youtube or something and point to them during faqs
<paroneayea>cluck: video tutorials would be a nice bonus, but having a text based tutorial is key
<ijp>okay, I have enough of a name mangler that srfi 1 compiles with valid identifiers
<paroneayea> https://docs.python.org/3.5/tutorial/ the python tutorial was great for me, I barely knew how to program
<ajnirp>btw, the racket guys already have their own page on xinyminutes, we could steal that maybe? http://learnxinyminutes.com/docs/racket/
<paroneayea>similarly the Emacs Lisp Intro
<ajnirp>as do the cl guys, come to think of it
<cluck>gnu is not hip :\\
<cluck>(and yeah, we should have those)
<python476>ola
<Mikko->I'm still a newb to programming myself, what would you recommend?
<ijp> http://shift-reset.com/tmp/srfi-1.js
<ijp>Mikko-: gardening. it's a much less frustrating hobby
<Mikko->my god, what is that?
<python476>Mikko-: what's behind the curtain
<python476>the redpill
<ijp>Mikko-: I'm working on compiling guile to js. that's the output produced by running my compiler on the module (srfi srfi-1)
<ijp>or rather the output, after uglifyjs -b is done with it
<mark_weaver>Mikko-: do you have any previous programming experience?
<cluck>abandon sanity all ye who enter here =)
<ijp>all 19001 lines of it
<cluck>(well, not really, fortunately)
<cluck>ijp: no asm.js?
<ijp>cluck: not at the moment
<Mikko->mark_weaver: only a little, mostly from going through tutorials
<mark_weaver>Mikko-: to start learning the fundamentals of scheme, I would recommend "The Little Schemer" and its sequel "The Seasoned Schemer"
<python476>no love for htdp ?
<cluck>sicp is also good for those wanting to pursue programming
<mark_weaver>python476: my problem with htdp is that it doesn't teach portable scheme, but rather Racket.
<mark_weaver>SICP is quite good, but it aimed at MIT engineering students who are fluent in math and the calculus.
<ijp>well, the htdp approach is tied to their teaching languages, which is actually a good idea
<python476>mark_weaver: I found the ideas were quite universal way of thinking about 'programming'
<Mikko->I remember getting stuck with sicp because of the math
<python476>and sicp is indeed a bit more heavy on math, first exercises deal with newton roots, a thrill for me but not for everybody
<mark_weaver>for people who are comfortable with calculus-level math, I would heartily recommend SICP.
<Mikko->okay, thanksd. I'll get back to you once I've gone through some of these.
<ijp>fwiw, here is a fontified srfi 1 http://shift-reset.com/pastes/srfi_1.html
<python476>ijp: so much clearer
<ijp>yeah, I know, but you get accustomed to syntax highlighting
<duud`>Some r6rs libs contain "compat.schemeimplname.sls" files. I can't find anything about this in guiles manual. Does somebody know what this is about?
<ijp>it was a convention among some r6rs implementations that if you saw a foo.sls and a foo.impl.sls you would preferentially prefer the latter
<ijp>if you were impl
<duud`>ok, is this supported by guile?
<ijp>you can allow extra extensions with the -x flag to guile, but neither .sls nor .guile.sls are in the default extensions list
<duud`>I see thx. One more some files start with "#!r6rs" is this also only a convention?
<ijp>no, that will modify the reader
<ijp>so it isn't just a no-op
<duud`>Ok, I guess this is explained somewhere in the guile manual. Any clue where?
<ijp>I don't think it is, but it is in the r6rs reference
<ijp>the reader section mentions #!fold-case and #!curly-infix, but not #!r6rs
<duud`>so it's a convention?
<ijp>it is not a convention
<duud`>didn't you say the r6rs reference doesn't mention it?
<ijp>I didn't say that at all
<duud`>:) ok, so you talked about the reader section in the guile manual not in the r6rs reference
<ijp>according to section 4.2.3 "The lexeme #!r6rs, which signifies that the program text that follows is written with the lexical and datum syntax described in this report, is also otherwise treated as a comment."
<duud`>Ok, I guess I have to use the r6rs reference more.
<mark_weaver>duud`: guile supports r6rs, but not the .guile.sls or .sls file extensions by default.
<mark_weaver>ijp's guildhall repository packages several r6rs libraries for easy use by guile, by renaming the files to use a .scm suffix.
<mark_weaver>sneek: guildhall?
<sneek>Its been said that guildhall is https://github.com/ijp/guildhall/wiki/Getting-Started
<mark_weaver>sneek: botsnack
<sneek>:)
<duud`>mark_weaver: Thank you. I found a thread on guile-devel about this. So not supporting this extensions by default is an performance optimization. Not sure how much the additional stats cost, but yes startup time is important
<please_help>any ideas? http://mathb.in/37343?key=674876f2afedb19496933840f50306295de720e0
<nalaginrut>morning guilers~
<please_help>if a list of elements goes out of scope when its cdr is still in scope, do elements in the cdr get collected?
<mark_weaver>please_help: I suspect you are using the terms "out of scope" and "in scope" incorrectly. bindings have scopes, and since scheme is lexically scoped, things don't go "out of scope". the scope of a binding is static: a region of the program.
<mark_weaver>maybe you meant to ask this: if a list of elements becomes unreachable when its cdr is still reachable, do elements in the cdr get collected?
<mark_weaver>and the answer to that question is "no"
<mark_weaver>in that case, the first pair of the list is collectable, but the rest of the list is not collectable.
<mark_weaver>lists are just linked lists, made up of pairs and the special empty list object. the pairs are the objects, and they are individually tracked by the garbage collector.
<amz3>~/join #guix
<civodul>Hello Guilers!
<ijp>moo
<amz3>héllo :)
<ijp>hmm, is there a predicate for the undefined object (different from the unspecified object)
<ijp>I would accept an easy way to get it from scheme and eqv?
<ijp>the obvious make-undefined-variable + variable-ref errors for obvious reasons
<duud>So, how do you guys debug macros? There is ,expand repl command but it is far to verbose - then I read about the "quote the template" trick. Are there other ways to get a more readable macro expansion?
<remi`bd>same experience here :{ I miss CL’s macroexpand-1
<sg2002>remi`bd: duud: There are macroexpand functions like macroexpand and macroexpand-1.
<duud>sg2002: ok, I'll take a look
<paroneayea>sg2002: is there a macroexpand-1 for guile?
<paroneayea>I don't see it...
<sg2002>paroneayea: Oh, lol missed what channel I'm in. ;-)
<paroneayea>:)
<duud>:)
<sg2002>paroneayea: remi`bd: Was thinking I'm in #clojure, which has macroexpand-1, I have keys set up to switch to next irc activity. ;-)
<mark_weaver>ijp: SCM_UNDEFINED is not actually an object. it is rather a special marking on variable objects (and C arguments) that means the variable-argument doesn't exist. it cannot be manipulated by scheme at all.
<mark_weaver>the problem is, you can't sure it in a variable, because doing so indicates that the variable is unbound.
<mark_weaver>s/sure/store/
<mark_weaver>duud: sorry, we don't yet have anything like that. we have the infrastructure in place to build a macro stepper in pure scheme, but it hasn't yet been done.
<ijp>mark_weaver: #<undefined> appears in cps as a constant
<duud>mark_weaver: ok
<mark_weaver>ijp: that appears to be a different concept from ecmascript.
<mark_weaver>see <undefined> in module/language/ecmascript/base.scm
<ijp>I don't think so
<dsmith-work>Monday Greetings, Guilers
<ijp>for one, if I bind it, then try to access it. I get an undefined variable error
<paroneayea>nalaginrut: heya!
<paroneayea>I made it through your http://nalaginrut.com/archives/2014/04/15/simple%2C-but-not-so-simple tutorial
<paroneayea>it was very helpful, thanks
<paroneayea>there are a couple of issues in the tutorial I ran into that I wanted to let you know about, but in general it was great
<nalaginrut>paroneayea: thanks for reply, could you point the issues to me? ;-)
<paroneayea>nalaginrut: in the (defime (make-parser)
<paroneayea>;; ;;; (number (left: + -) (left: * /))
<paroneayea>oops
<paroneayea>the comment was commented because of note to self in the file I was working through ;)
<paroneayea> ;;; (number (left: + -) (left: * /))
<paroneayea>nalaginrut: it didn't work because the number part was commented out here
<paroneayea>but I looked at your git repo
<paroneayea>and used the definition of make-parser
<paroneayea>and then it worked
<paroneayea>though that was structured a bit differently
<paroneayea>so that was the first issue I ran into
<paroneayea>the second
<paroneayea>there's a part that says "test the parser"
<paroneayea>(call-with-input-string "1+1*2/3-4"
<paroneayea> (lambda (port)
<paroneayea> ((make-parser) (make-simple-tokenize port) read-simple)))
<paroneayea>read-simple is not defined there
<paroneayea>and also, confusing to me, because it looks like that should be an error function, not sure how read would help
<paroneayea>otherwise, the tutorial was great
<paroneayea>thanks nalaginrut ! and hope that feedback is useful
<nalaginrut>paroneayea: thanks, I'll try to figure it out now, and feedback to you
<mark_weaver>ijp: oh, okay. our printer will print #<undefined> if it comes across such a value, although such values cannot be stored in variables.
<mark_weaver>well, ask wingo I guess.
<paroneayea>nalaginrut: cool :)
<paroneayea>thanks again!
<nalaginrut>paroneayea: in principle, you don't have to specify the precedence since it's already handled by BNF
<nalaginrut>paroneayea: I can run the code when commented out the precedence
<paroneayea>nalaginrut: it said something about number not being recognized when I ran it with th stuff from the blogpost
<nalaginrut>paroneayea: oh, my mistake, I commented 'number' too
<nalaginrut>paroneayea: will fix it
<nalaginrut>;-P
<paroneayea>nalaginrut: \\o/
<ijp>mark_weaver: yeah, I figured as much. I've just switched to case-lambda, which shouldn't need it, instead of optionals, which do
<ijp>function are so complicated aren't they
<remi`bd>hey nalaginrut thanks for your “quick & dirty with Guile FFI” article, it’s quite helping
<nalaginrut>remi`bd: thanks for encouraging ;-P
<nalaginrut>there're so many things worth to write, but I have to spend much time on programing
<remi`bd>hehe
<davexunit>I should write about Guile/Guix more often
<davexunit>but writing stuff that isn't code or irc chatter is hard
<nalaginrut>yeah folks, don't stop blogging, although I'm lazy too... ;-P
<nalaginrut>it's all in my brain though
<nalaginrut>yes, post and polish an article takes much time from me
<nalaginrut>hope it's helpful
<remi`bd>I believe it’s the case for everyone :o
<paroneayea>more guile tutorials ftw :)
<paroneayea>but yeah, good writing takes time
<remi`bd>btw, is there any documentation about how the GC behaves relatively to the Dynamic FFI?
<nalaginrut>dunno, I haven't put my eyes on this issue yet
<amz3>what is the url ? please :)
<remi`bd> http://nalaginrut.com/archives/2015/03/27/do-some-quick-and-dirty-with-guile-ffi
<remi`bd>let’s suppose I have bound a dummy function `void *foo(void) { return malloc(42*sizeof(char)); }`
<remi`bd>if I do `(define bar (%foo))`, what will happen to `bar` when bar’s lifetime ends?
<remi`bd>will the 42 bytes allocated by the call of %foo be freed?
<nalaginrut>remi`bd: it'll be collected I think, but not at once
<nalaginrut>may not
<nalaginrut>remi`bd: oh, malloc? you should use scm_gc_malloc, IIRC
<nalaginrut>remi`bd: if you can't use gc_malloc, you have two ways to free it
<nalaginrut>remi`bd: one is free it explicitly
<nalaginrut>another way is set-pointer-finalizer! to free it automatically
<nalaginrut>remi`bd: it's noticed in that article ;-)
<remi`bd>yep
<nalaginrut>if you encountered segfault when doing so, I believe it's bug
<nalaginrut>but please make sure you dereference the pointer correctly
<nalaginrut>it became harder when you mixed C and Scheme code
<nalaginrut>especially handling C pointers
<nalaginrut>well, maybe there should be a good FFI framework taking advantage of low-level FFI interfaces of Guile
<remi`bd>hum… I don’t understand… if I `(define bar (%foo))`, then `bar` will hold a wrapped pointer
<remi`bd>and `(pointer-address bar)` will hold the address returned by the C function `foo`
<remi`bd>won’t it?
<nalaginrut>remi`bd: I think it's the actually C address
<nalaginrut>I mean after pointer-address
<nalaginrut>hmm...maybe C address is not proper word
<nalaginrut>but whatever
<remi`bd>thanks :)
<nalaginrut>np ;-)
<nalaginrut>paroneayea: fixed the second issue, should be error handler, dunno why I wrote simple-reader...
***michel_mno is now known as michel_mno_afk
<paroneayea>nalaginrut: \\o/
*davexunit thinks about guile+ssh integration again
<davexunit>(with-ssh "dthompson.us" (gethostname))
<davexunit>would be so cool
<davexunit>wouldn't be so hard with guile-ssh, either.
<davexunit>pipe sexp to ssh, spawn a guile process on remote host that evals the sexp and writes result to stdout, read output on local host and return it.
<paroneayea>that'd be cool davexunit
<nalaginrut>well, Swift will be open sourced, maybe guile-swift?
<davexunit>apple is going to liberate swift? wasn't expecting that.
<davexunit>but good.
<nalaginrut>just got that news few minutes
<davexunit>swift isn't a very good language from what I've seen though.
<davexunit>I suppose if you're stuck writing iphone apps...
<nalaginrut>yeah, since you played Scheme too much... ;-P
<davexunit>a fate worse than being a web developer.
<nalaginrut>but it seems the only successful FP language in business
<davexunit>clojure, too.
<davexunit>which I like to refer to as the "compromised" lisp. :)
<davexunit>they gave up elegance for java interop.
<nalaginrut>you know, people talk lot about Swift, but clojure known in lispers
<nalaginrut>I don't think Swift is good to use now, but people want to play it crazy, its grammar is not even stable
<taylanub>Swift is quite closely tied to Apple's platform, as in language design choices.
<ijp>case-lambda is kicking my ass
<nalaginrut>Apple claimed it'll be in Linux
<nalaginrut>few minutes ago
<ijp>wingo: when you have a minute, I have two things to clarify
<taylanub>well, like Objective-C, I guess it will be possible to use it for non-Apple things, but the language is really being fine-tuned to inter-operate well with existing C and Objective-C code-bases of Apple, and this is likely to make it sub-optimal for other use-cases.
<nalaginrut>yeah, agreed
<remi`bd>isn’t case-lambda supposed to be replaced with something like a `match-lambda` that uses (ice-9 match) ?
<nalaginrut>dunno what's their plan, maybe just want to shame Microsoft
<taylanub>I would probably look into Rust instead, if I were interested in a systems-programming/"high-performance" language
<remi`bd>*when I say “to be replaced”, I mean “to be replaced idiomatically”
<taylanub>hm, if match-lambda compiles to case-lambda to prevent allocation where possible, then I guess it could fully replace it
<davexunit>remi`bd: you could use match-lambda, but sometimes you just want simple case-lambda
<nalaginrut>taylanub: both grammar are not stable ;-)
<taylanub>nalaginrut: I think Rust grammar is now stable since 1.0 is out
<ijp>1) we don't recommend such practice 2) it isn't a drop-in replacement, AFAIK you need match-labda* 3) I'm compiling it, not using it
<ijp>I know how to use it
<nalaginrut>taylanub: oh, worth to take a look now
<remi`bd>okay, thanks :)
<remi`bd>btw, I just noticed there’s already an undocumented `match-lambda` function defined in (ice-9 match)
<davexunit>oh I thought you knew about it
<davexunit>someone should document that
<davexunit>I use it all the time
<paroneayea>match-lambda????!
<ijp>match-lambda only takes one argument
<remi`bd>well, I rewrote it two days ago :-'
<paroneayea>damn nice re: match-lambda
<paroneayea>I hope I remember about it :)
<ijp>most of the macros are really awful to use
<paroneayea>I think I discovered it before and forgot ;)
<ijp>like match-let (particularly the named let version)
<mark_weaver>the entire 'match' module is not well documented in the guile manual. the best docs are in ice-9/match.upstream.scm
<mark_weaver>there's also 'match-lambda*' when you need to match multiple arguments.
<ijp>I have no idea why it was done that way round
<davexunit>I almost never want match-lambda*
<davexunit>I'm almost always pattern matching on a single argument
*nalaginrut is cloning swift...
<wingo>ijp: shoot
*wingo async but will reply
<wingo>ijp: there is match-lambda*
<wingo>which takes multiple arguments
<nalaginrut>hmm...written in Java, I'll try to read the parser and try guile-swift...
<ijp>I know there is, I was even the first person to mention it
<wingo>ah ok :)
<davexunit>nalaginrut: swift is implemented in java???
<ijp>although I typoed
<wingo>reading is hard :)
<ijp>wingo: when compiling optional arguments I end up with a #<undefined> constant. AFAIK, bytecode handles it specially in C, but how can I test for it in scheme?
<nalaginrut>davexunit: I guess it's just the opensourced version
<davexunit>they have a secret proprietary version still?
<nalaginrut>davexunit: oh, is it hard to realize so ;-D
<nalaginrut>anyway, just guessing
<wingo>ijp: see compile-cps2.scm:init-default-value
<amz3>nah.. they don't have enough people to do several versions of the same soft
<wingo>please don't leak the undefined value to user code
<ijp>wingo: secondly, https://gnunet.org/bot/log/guile/2015-06-07#T672986
<wingo>that probably means you have a primcall with an incorrect arity
<ijp>that was in scheme
<wingo>orly
<ijp>yarly
<wingo>sounds like a bug then :)
<wingo>sounds like our branching-primcalls stuff is borked
<wingo>in the cps conversion
<nalaginrut>davexunit: oh, my mistake, it's another lang with similar name
<wingo>it should reify an out-of-line call if the arity is wrong, and there should be a prepass to fix up arities where possible
<davexunit>nalaginrut: heh
<ijp>hmm, I seem to be missing a continuation
<ijp>everybody check under your seats
<wingo>does it start with k
<wingo>ijp: probably it's a good idea to port to cps2 sooner rather than later, dunno
<ijp>noted
<amz3>ark! my binding segfault in bizar way, I will have a look at dynamic ffi
<amz3>uhu... I'm kind of lazy for that now.. I hate it when it happens.
<amz3>I will start my journey with a bit a copy/pasting from https://github.com/ijp/guile-gdbm/blob/master/gdbm.scm :)))
<ijp>an ffi tutorial is about all that module is useful for
<amz3>it looks already more manageable :))
<amz3>I think it's the same kind of API
<amz3>it will do the trick
<amz3>all structures are opaque
<amz3>I never interact directly with the pointers
*ijp thumps head on table repeatedly
<amz3>I am serious
<amz3>I might be wrong though :)))
<mark_weaver>ijp: is there a problem with your guile-gdbm? paroneayea recently added it to guix.
<ijp>mark_weaver: not really, I just don't see much use for gdbm in new software
<mark_weaver>ttn has a package of the same name
<mark_weaver>ah, okay
<ijp>yeah, I only learned of that conflict after the release
<ijp>okay, I think have found my bug
<mark_weaver>\\o/