<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 <ajnirp>as do the cl guys, come to think of it <cluck>(and yeah, we should have those) <Mikko->I'm still a newb to programming myself, what would you recommend? <ijp>Mikko-: gardening. it's a much less frustrating hobby <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) <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" <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>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 <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 <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. <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>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>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. <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 <sg2002>paroneayea: Oh, lol missed what channel I'm in. ;-) <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>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 <mark_weaver>ijp: that appears to be a different concept from ecmascript. <mark_weaver>see <undefined> in module/language/ecmascript/base.scm <ijp>for one, if I bind it, then try to access it. I get an undefined variable error <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>the comment was commented because of note to self in the file I was working through ;) <paroneayea>nalaginrut: it didn't work because the number part was commented out here <paroneayea> ((make-parser) (make-simple-tokenize port) read-simple))) <paroneayea>and also, confusing to me, because it looks like that should be an error function, not sure how read would help <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. <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 <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>there're so many things worth to write, but I have to spend much time on programing <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>yes, post and polish an article takes much time from me <remi`bd>I believe it’s the case for everyone :o <remi`bd>btw, is there any documentation about how the GC behaves relatively to the Dynamic FFI? <amz3>what is the url ? please :) <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>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>another way is set-pointer-finalizer! to free it automatically <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>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` <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
*davexunit thinks about guile+ssh integration again <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. <nalaginrut>well, Swift will be open sourced, maybe guile-swift? <davexunit>apple is going to liberate swift? wasn't expecting that. <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>but it seems the only successful FP language in business <davexunit>which I like to refer to as the "compromised" lisp. :) <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 <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. <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 <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 <remi`bd>btw, I just noticed there’s already an undocumented `match-lambda` function defined in (ice-9 match) <ijp>match-lambda only takes one argument <ijp>most of the macros are really awful to use <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'm almost always pattern matching on a single argument *nalaginrut is cloning swift... *wingo async but will reply <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 <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? <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 <wingo>that probably means you have a primcall with an incorrect arity <wingo>sounds like our branching-primcalls stuff is borked <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 <ijp>hmm, I seem to be missing a continuation <ijp>everybody check under your seats <wingo>ijp: probably it's a good idea to port to cps2 sooner rather than later, dunno <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. <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>all structures are opaque <amz3>I never interact directly with the pointers *ijp thumps head on table repeatedly <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 <ijp>yeah, I only learned of that conflict after the release <ijp>okay, I think have found my bug