IRC channel logs

2017-06-14.log

back to list of logs

<reepca>Does the #:select part of use-modules only work with exported symbols?
<ijp>I would assume so, but it occurs that I've never bothered to check this assumption
<reepca>Well, I assumed otherwise, and just now bothered to check it - as far as I can tell it does indeed only work with exported symbols, which was a bit confusing as the reference spoke about a "custom interface" as opposed to a "public interface", but it seems that actually just means a subset of the public interface.
<ijp>reepca: it is possible to access "private" bindings, if that is your goal, or was this just idle curiousity
<reepca>I was just looking for a more convenient way to do it
<dsmith-work>Hey hey
<OrangeShark>hello
<OrangeShark>on reddit there was a post about functional programming and object oriented programming. It was mostly on how you handle dependencies in these languages, so for something like a database or a logger. OOP usually has dependency injection while FP would have to pass in the dependencies to each function. Some people mention using closures and others mention how haskell has this sort of thing which you just add to
<OrangeShark>the function signature. What would be the guile/lisp way to handle this?
<OrangeShark>the reddit post, the top comment is the one talking about dependencies https://www.reddit.com/r/programming/comments/6gzn2z/why_pure_functions_4_benefits_to_embrace/
<random-nick>OrangeShark: well, wouldn't the solution in guile be to make a record then have the functions take the record as the first argument?
<OrangeShark>but then you have to pass that record everywhere you eventually need it.
<roelj>I keep on running into this.. Is there a way to (define-public (symbol->string ...) ...) in a map-style way?
<roelj>Like (map (lambda (pair) (define-public (string->symbol (car pair)) (cadr pair)) ...)?
<random-nick>OrangeShark: well, if you need it a lot of times in a block of code then you can make it a parameter and define a with-<record> macro
<random-nick>like the port functions in guile
<quigonjinn>roelj: i think you need to write a macro for that.
<roelj>quigonjinn: How would that look like? (define-syntax-rule (define-public-for-each list) (primitive-eval `(define-public ...)))?
<roelj>I've got it!
<quigonjinn>roelj: you beat me to it. what was it?
<roelj>quigonjinn: It's somewhat specific to what I am doing: http://paste.lisp.org/+7H2F. I have a list of samples that look like '("sample1" "sample2").
<roelj>I'd love to see the macro though
<roelj>And this means that Guile evaluates all code in *.scm files it finds..
<quigonjinn>roelj: i almost got it
<quigonjinn>roelj: http://paste.lisp.org/display/348714 maybe something like this? I don't know if this is an overkill, or if it even works for your case
<quigonjinn>works for me in the repl
<ArneBab_>hey, Guile is fastest in one test of ecraven: pi (though it looks like a very close win, a tie between guile, chez and petite, could change on the next run):
<ArneBab_> http://ecraven.github.io/r7rs-benchmarks/benchmark.html
<roelj>quigonjinn: Wow, that is really cool
<ArneBab_>cmaloney: makeworks really well for me, regardless of the environment. I wish that every project would at least include a Makefile which tells me the commands I need to build it (even if it just shells out to another build system).
<cmaloney>ArneBab_: Agreed. I can at least parse a Makefile
<cmaloney>though I have seen certain projects go way too far with Makefiles where it becomes too opinionated
<cmaloney>and obscures things
<cmaloney>(one of the projects I worked on has a Makefile that the developer created which made installing one way really nice, but downloaded a bunch of files to make a mini-pypi)
<cmaloney>(which was great if you were on ubiquitous wifi like he was, and absolutely sucked if you were using, say, Subway Wifi with a bunch of other folks on a PyOhio Sprint)
<cmaloney>:)
<CustosLimen>hi
<CustosLimen>is there a simpler way to do this: (car (cdr (cdr (list 1 2 3)))) ?
<cmaloney>CustosLimen: What are you looking to do? :)
<CustosLimen>I want to get last element of list/pair
<CustosLimen>or nth element
<cmaloney>how portable do you need it to be? Guile-specific OK?
<CustosLimen>list-ref
<roelj>CustosLimen: (list-ref lst n)
<CustosLimen>cmaloney, ye guile specific ok
<roelj>And for the last (list-ref lst (length lst))
<cmaloney> https://www.gnu.org/software/guile/manual/html_node/SRFI_002d1-Selectors.html <- I think there's also a "last" that will work
<cmaloney>Though that's a separate library
<CustosLimen>cmaloney, thanks - list-ref is fine
<CustosLimen>I'm just a nawb is all
<cmaloney>no worries. :)
<cmaloney>same here. :)
<CustosLimen>I was looking at array-ref and other stuff
<cmaloney>I'm planning on presenting for my local UNIX user group in July
<cmaloney>But I'm also covering Racket so that's why I asked if you wanted something guile-specific or something more portable
<cmaloney>because I _think_ Racket has last baked in
<CustosLimen>no I'm trying to still fix the regex memory leak
<cmaloney>hah, fun stuff
<CustosLimen>it does not happen often - just sometimes - and its not easy for me to figure out what call path results in realloc from inside parse_expression()
<CustosLimen>or I mean - it does not happen in all cases where regex is parsed
<CustosLimen>but anyway - simple test case is not really doing it
<cmaloney>interesting
<CustosLimen>rebuilding with ggdb3 on solaris now - hopefully I can get some more details of call path to realloc that is leaking
<cmaloney>I think you'll need to subtract 1 to get the last item of the list if you use length
<cmaloney>(list-ref lst (- (length lst) 1))
<cmaloney>(is there a better way to do this?)
<roelj>I have a list '(a b c d e f) and a 'g. I'd like to make pairs like so: (a . g) (b . g) (c . g) ...
<roelj>What's a convenient way to do it?
<cmaloney>Thinking you might want to use map for that
<cmaloney>(he said, looking up how to use map for that)
<roelj>(map cons '(a b c) '(g g g)). But I don't want to repeat g..
<cmaloney>You might need to make a function that takes the value from '(a b c) and returns the list (a . g)
<bavier>(map (cut cons <> 'g) '(a b c d e f))
<cmaloney>where does one find cut?
<bavier>cmaloney: (srfi srfi-26) iirc
<roelj>bavier: Nice! Thanks
<bavier>but a simple lambda would work fine too
<roelj>Like so: (map (lambda (v) `(,v . g)) '(a b c d e f))
<cmaloney>Ah, that's the first I'm seeing the backtick syntax. Thanks for that.
<cmaloney>very cool
<ijp>cmaloney: srfi 1 has last & last-pair
<cmaloney>ijp: tx. I'm still feeling around what is available to me
<cmaloney>like moving into a new kitchen and seeing where the utensils are
<cmaloney>(Hey, the C Language has this awesome drawer full of knives and shotguns!)
<ijp>you should become very familiar with srfi 1
<cmaloney>Thank you. I'm still in the learning phase so I'm not sure which drawer has what utensils.
<cmaloney>I think guile has some of these already baked in if I'm understanding properly
<cmaloney>eg: map and filter
<ijp>yes some are
<geppy>paroneayea: hihi!
<paroneayea>hi geppy !
<paroneayea>geppy is a participant in the W3C Social Community Group, and working on an ActivityPub implementation
<paroneayea>they're going to look into helping with Pubstrate / the ActivityPub test suite
<paroneayea>good to have you here, geppy :)
<geppy>Thanks! I'm new to Guile, I've mostly just played with Racket.
<paroneayea>#guile is a fun place, I find :)
<OrangeShark>hello geppy, welcome to #guile :)
<geppy>OrangeShark: Hi! Thanks.
<catonano_on_mobi>Hi geppy !
<ArneBab_>cmaloney: I also saw quite a few horrible Makefiles, but I actually went from Makefiles to cmake, scons, and waf, to return to Makefiles in the end — or rather: to full autotools because the files from all the other tools get more cluttered over time and none of them can provide a distcheck.
<ArneBab_>cmaloney: I think the worst problem of Makefiles and autotools is that they are missing easy-to-use documentation and good templates. I try to tackle the latter with conf: https://bitbucket.org/ArneBab/conf/
<catonano>ArneBab_: very interesting
<cmaloney>ArneBab_: I think you're right, and I'm glad you're working on a solution
<cmaloney>geppy: Awesome to see more work in the ActivityPub space! :)
<cmaloney>geppy: I'm new to Scheme / Guile / Racket as well so you're in good company.
<catonano>ArneBab_: how hard would it be to add support for Guile projects to your Conf ?
<paroneayea>sneek: later tell daviid https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00134.html
<sneek>Will do.
<dsmith-work>.wu cmaloney
<OrangeShark>ArneBab_: that looks pretty cool
<OrangeShark>catonano: looks like it should be simple, you just make a guile template
<cmaloney>Is .wu "wake up" or "what up"? :)
<cmaloney>or "word up"?
<cmaloney>ACTION just gave away his age I think. :)
<ArneBab_>OrangeShark: thanks! It’s currently pretty incomplete, but with bash projects it already gives a great start.
<ArneBab_>catonano: it shouldn’t be too hard, but the required first step is always to have a really good autotools setup.
<OrangeShark>ArneBab_: I will definitely download it and give it a try when I have the chance to.
<ArneBab_>please feel free to hack on it!
<spk121_>good UTC-7 morning, all
<ArneBab_>OrangeShark: sounds great!
<ArneBab_>OrangeShark: one thing I really like is that this creates makefiles with nice help output
<ArneBab_>also it auto-creates an AUTHORS file and the ChangeLog
<OrangeShark>I have a half written blog post on setting up a guile project with autotools
<ArneBab_>nice!
<OrangeShark>ArneBab_: it uses the vcs to generate that? I think I saw something about vcs in your repo
<ArneBab_>yes. Currently it supports git and Mercurial (and the git line is quite long and was pretty hard to put together)
<ArneBab_>it also provides a template for the NEWS file
<ArneBab_>the reason to start with bash is that conf itself is written in bash (to execute a Makefile you need a shell, so requiring a shell to run conf does not add new dependencies)
<OrangeShark>makes sense, something like this you would want to try to minimize the dependencies
<catonano>OrangeShark: I can't wait to read your blog post about setting up a guile project with the autotools
<catonano>I set up one suc project recently and I feel this is an area that needs iimprovement
<dsmith-work>cmaloney: Sorry. Was a /wi typo. Was curious that you mentioned PyOhio
<dsmith-work>cmaloney: So, are you anywhere near NE Ohio?
<cmaloney>dsmith-work: I'm in the Detroit area
<cmaloney>so Columbus is ony a few hours drive for us
<dsmith-work>Ok.
<dsmith-work>cmaloney: I did some work in Auburn Hill a while ago. (wow. has it really been 15 year ago?)
<dsmith-work>s/Hill/Hills/
<cmaloney>Ah, cool. For Chrysler or someone else?
<dsmith-work>Comerica Bank
<cmaloney>Joyous. :)
<dsmith-work>Heh
<dsmith-work>It was quite an adventure!
<cmaloney>Didn't happen to start the whole Agile revolution did it? :)
<dsmith-work>Heh. No. We re-implemented all their firewalls.
<cmaloney>fun stuff
<cmaloney>Reason I mention agile was (iirc) some of that methodology came about from working with Chrysler. And I had first-hand experieince with Chrysler and a severely-hampered Waterfall process (which is where came to appreciate more agile methodologies)
<catonano>now, for example, my tests won't run :-/
<paroneayea>hi catonano
<paroneayea>catonano: what test runner are you using?
<catonano>paroneayea: I don't know. The default one
<catonano>or maybe the one indicated in guile-gcrypt's autoconf files
<catonano>should I explicitly indicate one ?
<paroneayea>catonano: you'll need build-aux/test-driver.scm for that to work
<ijp>Does anyone remember how to add the files to the commit message in magit per usual convention
<civodul>ijp: press 'C' while on a hunk :-)
<ijp>ty
<catonano>paroneayea: there is one. I guess it's the one that was in guile-gcrypt. I'm woring on a cloned repo, ater all
<catonano>ok I get tis, now. I'll delve deeper
<catonano>paroneayea: there was a missing paren :-/
<paroneayea>catonano: a familiar curse :)
<paroneayea>catonano: I find rainbow-delimiters in emacs helps me track those down if you're an emacs user, btw
<paroneayea>well, and not colorblind I guess
<catonano>paroneayea: I am. I use to highlight the matcing paren. Probably rainbow-delimiters could help in a more proactive way
<catonano>I am an Emacs user, not color blind
<catonano>paroneayea: thanks !
<random-nick>also check out paredit
<paroneayea>ACTION uses smartparens instead of paredit... paredit is too strict for me
<catonano>random-nick: I got away rom paredit because if I got wrong a paren couple, it would get angry and not letting me remediate
<random-nick>it should let you type the necessary closing parens
<catonano>if I got a parens couple wrong...
<paroneayea>catonano: you might like smartparens then
<paroneayea>it's like paredit but it doesn't get mad if you do traditional text editing
<catonano>random-nick: sometimes you need to erase a paren that's too much ;-)
<catonano>paroneayea: right. I'll have to deepen my knowledge of its key chords
<random-nick>yes, it should highlight the extra closing paren in red and let you delete it
<catonano>random-nick: maybe I don't rememberr correctly. What I rememberr is that I used to get stuck and had to disable paredit or maybe close Emacs alltogether
<catonano>okk the good news is that a test of mine passed. It's my first time !
<ijp>great, closures are being converted now
<paroneayea>\\o/
<catonano>ijp: woohoo !
<dsmith-work>ijp: Yey!
<rekado_>you can input unbalanced parentheses with “C-q (” or “C-q )” when paredit is enabled.
<rekado_>the only time I end up with unbalanced parens is when I used hippie-expand and it expanded a line with invalid parens.
<rekado_>in that case I use C-q to close parens manually. Or I select and hit C-w on the paren group that is too much.