IRC channel logs


back to list of logs

<dongcarl>HI all, any way to get the path of the .scm file being run in guile?
<RhodiumToad>in particular, (add-to-load-path (dirname (current-filename))) is a useful trick
<dongcarl>RhodiumToad: That's great, many thanks!
***catonano_ is now known as catonano
***terpri_ is now known as terpri
***Aurora_iz_kosmos is now known as Aurora_v_kosmose
<catonano>sneek later tell thchr no, I don't know, sorry
<sneek>Got it.
<tohoyn>sneek, botsnack
***apteryx is now known as Guest29172
***apteryx_ is now known as apteryx
<jlicht>thanks RhodiumToad!
<pinoaffe>is there an "apply" for macros?
<dsmith-work>{appropriate time} Greetings, Guilers
<dsmith-work>pinoaffe: Well, there's a macroexpand, but that's probably not what you are looking for.
<dsmith-work>RhodiumToad: Can you explain to me?: (and (x . y) (not (? list?)))
<dsmith-work>"(? predicate pat_1 ... pat_n) if predicate true and all of pat_1 thru pat_n match"
<dsmith-work>What is the predicate applied to? I don't understand from the doc
<dsmith-work>I would think it would be applied to pat_1 ... pat_n, but your example just has list?, with no pat_s
***rekado_ is now known as rekado
<rekado>pat_1 … pat_n are extra patterns to deconstruct the argument
<rekado>the predicate is applied to the whole structure
<rekado>(match '(foo bar) ((? list? (first . rest)) first))
<rekado>this will return 'foo
<rekado>because (list? '(foo bar)) is true the next pattern is applied, which splits '(foo bar) into (first . rest), with first bound to 'foo
<rekado>you can have multiple patterns following the predicate:
<rekado>(match '(foo bar) ((? list? thing (first . rest)) (cons first thing)))
<rekado>results in '(foo foo bar)
<dsmith-work>rekado: Thanks! That helps a lot.
<dsmith-work>Never used match. Seems like a whole new language.
<civodul>note that 'list?' is implied in patterns like (a b c)
<civodul>beware of 'list?' though, it's linear in the size of the input
<civodul>actually (a b c) does not expand to calls to 'list?', but (a b ...) does
<str1ngs>sneek: later tell daviid. Hello, I think this is a limitation with WebKitView and not g-golf. But to use webkit_web_view_get_tls_info it requires GTlsCertificate and I don't think there is a way to do that with g-golf or GI in general? unless I'm missing something. see
<sneek>Got it.
<str1ngs>sneek: later tell daviid. I mean there is no way to instantiate a GTlsCertificate
<sneek>Got it.
<ane>are the Guile manual docstrings auto generated from code or do people maintain both the docstring and the texinfo manual separately?
<dsmith-work>ane: Seprately.
<dsmith-work>The docstrings go into the builtin help. The manual is all in texinfo off under doc/ref/
<manumanumanu>dsmith-work: to build on what ludo wrote: what he means is that (match blah ((a a* ...) do-stuff-with-a)) will check whether blah is a proper list. That is an O(n) operation, whereas (match blah ((a . rest) do-stuff-with-a)) is O(1). If blah is 1000 elements long, the first example will be a lot less efficient.
<dsmith-work>So now I'm more confused. As far as I know, the only way to check if a list is proper, is O(n) checking the last cdr is '().
<manumanumanu>dsmith-work: but (a . b) does not check if the list is proper. it only matches a cons pair
<manumanumanu>that would match (cons 'a 'b)
<dsmith-work>The original quesiton by <jlicht> wanted to only match proper lists.
<manumanumanu>dsmith-work: then I suspect he/she wanted to match all elements, where my concern about ... is pointless anyway. I usually say this quite quickly in discussions about match, because people tend to write clauses that make algorithms quadratic instead of linear by not understanding ... .
<dsmith-work>manumanumanu: So does ... being quadratic also apply to syntax-rules ?
<manumanumanu>... is not quadratic, but if you use it to bind the rest of the list you can quite easily end up with quadratic algorithms. And yes, that is the case also in syntax-rules. But it matters very little, because macros rarely have that many clauses.
<manumanumanu>dsmith-work: a short example
<jlicht>The stuff I used match for was limited to lists of length ~100 tops, so complexity that is still in O(n^x) for normal x is fine ;-)
<manumanumanu>jlicht: but did you want to match improper lists of that length, or did I understand dsmith wrong?
<jlicht>In theory, yes. In practice, most of them are shorter that ~5 elements
<dsmith-work>manumanumanu: Eww. Yeah, that looks really wrong.
***evhan` is now known as evhan