IRC channel logs

2015-11-09.log

back to list of logs

<daviid>do we have an average builtin procedure?
<davexunit>no
<daviid>ok, tx
<polyphagia>how do i access a struct made with make-c-struct in scheme from the C api?
<polyphagia>got it :P
<rlb>daviid: I suspect you're as likely to know as I am at the moment. While I think I'm reasonably good with Scheme and Clojure, I'm just coming back to more serious Guile use right now, while figuring this out.
<rlb>Appreciate the help.
<nalaginrut>morning guilers~
<Petit_Dejeuner>morning
<nalaginrut>wow, 126 points on HN
<nalaginrut>heya
<Petit_Dejeuner>The new website?
<nalaginrut>the release of Artanis
***holomorph is now known as Guest3385
***holomorp1 is now known as holomorph
<koz_>Does Guile have bindings for SQLite?
<artyom-poptsov>koz_: Hi. You should take a look on this example project: https://github.com/carld/guile-microservice-example
<artyom-poptsov>It uses SQLite Guile bindings.
<koz_>artyom-poptsov: Thanks!
<daviid>koz_: we do but the source code was on gitorious which is down. I have a local copy of the source that i can send you as a tar.gz if you wish to, it's small enough we can end it by email until uploaded somewhere else ...
<koz_>daviid: I found them as a package on the AUR, so that's a non-issue.
<koz_>Also, how can I mute this: http://paste.rel4tion.org/81
<koz_>It happens every time I re-run my script after changes, and it's annoying.
<artyom-poptsov>koz_: Guile tries to compile programs and modules on the fly to speed up the execution. To silent this warning, pass '--no-auto-compile' to guile and remove related compiled .go file ('../arff2sqlite/arff2sqlite.scm.go' in your case.)
<koz_>Is it sad that I already wanna write a macro called 'with-open-db'... :P
<koz_>artyom-poptsov: I've added --no-auto-compile. Where does the .scm.go file end up?
<koz_>Ah, the cache. Thanks.
<artyom-poptsov>You're welcome.
<artyom-poptsov>Of course, in a production environment you may want to compile modules and programs during the build phase and install .go files along with .scm files, so users won't need to compile everything by themselves.
<koz_>artyom-poptsov: This is a one-off script only for me.
<koz_>So I'm not too worried.
<koz_>Is there a case-insensitive string-prefix? predicate?
<koz_>Never mind, apparently I'm just blind.
<koz_>What's the Guiley (or rather, Schemey) thing to do when you want an enumerated type? Would I just use symbols?
<nalaginrut>koz_: for an alternative, you may take a look at guile-dbd-sqlite3
<nalaginrut>koz_: for enums, I think symbols are fine https://www.gnu.org/software/guile/manual/html_node/rnrs-enums.html
<koz_>Alrighty, symbols it is.
<koz_>I've worked with Common Lisp before, and I've read R5RS and R7RS, but Guile is... big.
<koz_>And I'm a tad rusty.
<nalaginrut>personally, as a practical one, I believe it has to be big, although there're many modules could be separated if guildhall become popular
<nalaginrut>but I could be wrong
<fps>~
<fps>oops
<wleslie>bash: /home/fps: Is a directory
<fps>that's right :)
<koz_>Lol.
<koz_>Also, could someone help me make sense of scm-lalr?
<koz_>Its documentation isn't exactly what I'd call 'thorough'.
<wleslie>you're looking at this? https://www.gnu.org/software/guile/manual/html_node/LALR_00281_0029-Parsing.html
<koz_>No, at this: https://code.google.com/p/lalr-scm/wiki/ParserSyntax
<wleslie>ah, yes
<koz_>I mean, if there's a better-documented parser generator for Guile, I'll take it.
<koz_>I just really have no clue what's going on. I've never used Flex and Bison and co.
<wleslie>what are you trying to parse?
<koz_>ARFF format: http://weka.wikispaces.com/ARFF+%28stable+version%29
<wleslie>in the top description, it says, an expression (e) is defined as the sequence (expression, + symbol, term) or (expression, - symbol, term) or (term)
<koz_>I need to write a script to convert ARFF files to SQLite databases.
<koz_>I'm pretty sure a hand-rolled parser is the wrong approach.
<koz_>e (e + t) : (+ $1 $3) <-- I assume this means 'if you match this, sum whatever 'e' was and whatever 't' was, right?
<wleslie>yes
<wleslie>I would probably not use a lalr parser for this, but that's me
<koz_>wleslie: What would you use?
<wleslie>I'd iterate over the lines and split on commas
<koz_>I've genuinely no clue.
<koz_>wleslie: That's just the data part.
<koz_>The header also needs parsing.
<wleslie>split on spaces for the header (:
<koz_>So you reckon a hand-rolled parser would be easier?
<koz_>(it also has to handle comment lines and also end-of-line comments as well)
<wleslie>in situations like this where there's no recursion involved, I usually write a parser by hand
<koz_>Alrighty. I can hand-roll a parser, I guess
<koz_>So should I just read in the whole string and hack at it until it's in a format I want?
<koz_>s/string/file
<wleslie>yeah
<koz_>Alrighty - I guess if memory becomes a problem I can do something different.
<koz_>Thanks.
<koz_>ACTION goes to read more Guile manual.
<nalaginrut>koz_: maybe you need this article http://nalaginrut.com/archives/2014/04/15/simple%2C-but-not-so-simple
<wleslie>nice post, alan!
<koz_>nalaginrut: Thanks for that.
<nalaginrut>np ;-)
<nalaginrut>ACTION is considering to revive guile-lua-rebirth
<nalaginrut>now that Artanis was released...
<koz_>How would I write a string in Guile that consists of only the newline character? "\\n"?
<wleslie>yes
<wleslie>eg, (display "\\n")
<solrize> http://wingolog.org/archives/2013/11/26/a-register-vm-for-guile#22eb29cc4718732690773b434fadcdc9499c3f20 the microbenchmark from here seems to be looping forever in guile 2.1.1 armhf
<fps>hmm, i'm pretty new to guile (and scheme in general) and i wonder how to solve this problem: let's say i have a program like this:
<fps> https://pastee.org/mt6q2
<fps>for every package i add to the packages list i need to import some module (sometimes, more than one package is defined in the same module)
<fps>i'd like to avoid having to write the use-modules calls manually
<fps>there's a function find-packages-by-name
<fps>which returns a package "thing" (a structure?)
<fps>so i wondered if i need to learn about macros to solve this..
<fps>sooo, to tackle this i have to solve two problems i suppose:
<fps>1] scheme@(guile-user)> (find-packages-by-name "emacs")
<fps>$4 = (#<package emacs-24.5 gnu/packages/emacs.scm:63 3522780>)
<fps>i need to find out what th result of this is precisely
<fps>and how to get the module out of it short of parsing the path :)
<nalaginrut>fps: please read the reflection carefully https://www.gnu.org/software/guile/manual/html_node/Module-System-Reflection.html#Module-System-Reflection
<nalaginrut>fps: maybe you need resolve-module, but I suggest you read this part first
<fps>nalaginrut: ok, will start with that
<fps>resolve-module might be useful once i have '(gnu packages emacs) assembled, yes :)
<fps>there's also this: https://www.gnu.org/software/guix/manual/html_node/package-Reference.html#package-Reference but it doesn't tell me much about how to programatically work with a package "thing" :)
<fps>hmm, there are procedures exported for package structs, like package-full-name, but they don't like the value that find-packages-by-name returns.. maybe i need a car :)
<fps>scheme@(guile-user) [4]> (package-full-name (car (find-packages-by-name "emacs")))
<fps>$6 = "emacs-24.5"
<fps>ah, ok, will fiddle a bit
<nalaginrut>fps: IIRC, it'll compile & load it
<nalaginrut>so you just make sure the module exist
<fps>nalaginrut: actually yeah, while under the shower it occured to me that it's much simpler probably.. :)
<fps>just slapping it onto there with: (packages (append (find-packages-by-name "wget") (cons* xmonad dmenu %base-packages))) works just fine :)
<fps>so i need to do nothing actually
<fps>awesome..
<fps>thanks for the help, you kind people :)
<solrize>wingo http://wingolog.org/archives/2013/11/26/a-register-vm-for-guile#54fad5ea93fdbc4f197c8795ed8281b8baeee450
<wingo>that's terrible :)
<wingo>i wonder why that is, perhaps #e1e9 is a bignum on 32-bit machines
<wingo>solrize: what's the value of most-positive-fixnum on your machine
<solrize>scheme@(guile-user)> most-positive-fixnum
<solrize>$1 = 536870911
<wingo>indeed
<solrize>hmm
<solrize>yeah
<wingo>so if you loop to #e5e8 you should get better numbers
<solrize>ok will try that
<wingo>that said, that particular case is one in which we could unbox integers, perhaps we should start doing that...
<solrize>you have 3 tag bits?
<solrize>32.75 seconds, in line with your x86 timing i guess
<wingo>2 tag bits for fixnums, then they are signed
<solrize>ah right
<wingo>i'll comment on the thing
<solrize>thanks
<solrize>trying with python3
<solrize>python3 at 3m20s and still going strong :)
<wingo>:-)
<solrize>should try with pypy
<solrize>luajit is really impressive
<wingo>yeah
<wingo>i use luajit at work and it is a delight
<solrize>can any of its methods be adapted to guile?
<wingo>not really, unless we decided to switch course and do a tracing jit based on bytecode, and write a bunch of gnarly c
<wingo>but c kills my soul, so i want to stay self-hosted, meaning getting to luajit's perf is a longer road
<wingo> http://wingolog.org/archives/2015/11/03/two-paths-one-peak-a-view-from-below-on-high-performance-language-implementations <- more on this topic
<solrize>well, i meant reimplementing some of luajit's algorithms in scheme
<solrize>yeah i was looking at that, i posted the comment mentioning luajit, not realizing you had posted about it earlier
<wingo>luajit gets good perf not so much from an algorithm perspective but from tracing
<wingo>i mean, we already implement most of what luajit does besides the last bits for native compilation
<solrize>hmm ic. i remember it had a linear scan register allocator which is supposedly almost as good as a traditional one but much faster
<wingo>so the next checkpoint is to see where we are once we start doing aot native compilation
<solrize>yeah that will be cool... ocamlopt might also be worth looking at
<wingo>linear scan is fine, though a bit fiddly to know when to split live ranges
<solrize>i dunno if tinycc even tries
<solrize>python bench finished, 8m9.270s
<wingo>iirc tinycc doesn't do register allocation
<wleslie>there's a great lgpl compiler backend called libfirm that is very cool
<solrize>wleslie, oh neat i never heard of that
<solrize>wtf, a domain squatter seems to have gotten cminusminus.org
<solrize> http://web.archive.org/web/20080822062234/http://www.cminusminus.org/ mirror
<solrize> http://pp.info.uni-karlsruhe.de/firm/ libfirm
<solrize>wleslie, that page says firm is even slower than llvm :(
<wleslie>solrize: it's a very new project
<solrize>wleslie, yeah but i think it's intended to be a heavyweight compiler backend like llvm
<solrize>this might be interesting when it's further along: http://www.complang.tuwien.ac.at/anton/euroforth/ef13/papers/ertl-paf.pdf
<solrize>andy there's another maybe-issue: guile 2.1.1 won't build on debian 7 (wheezy) because wheezy has a too-old version of libgc (8.1)... does guile actually care about whatever might have changed in 8.2?
<wleslie>should just modify the guile 2.0.11 guix expression and build with that
<wleslie> http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/guile.scm#n118
<wingo>solrize: you can build bdw-gc from a tarball. yes guile 2.2 needs libgc 7.2
<solrize>ok. yeah i figured i could download bdw, just thought there might be a packaging problem regarding wheezy and guile. i guess i'll do the download at some point, but it's getting to be bedtime here at the moment
<solrize>thanks
<solrize>if you want one of these arm servers i can have them send you an invite code.... they're currently not taking public signups but they're not completely out of hardware
<wleslie>I'm still putting off the upgrade to jessie too P:
<wleslie>soon, soon
<wingo>ACTION using a linode atm
<amz3>héllo :)
<koz_>OK, something weird is happening here. I have this code: http://paste.rel4tion.org/82 , but when I execute the following, I get weird results: http://paste.rel4tion.org/83 .
<koz_>What am I missing here?
<lloda>you can't use set! like that
<koz_>lloda: Is it globals-only?
<lloda>no, that's not the issue
<lloda>it's how variables work in Scheme, they're names, not places
<lloda>say ((lambda (y) (set! y 9)) x)
<lloda>that changes the value assigned to y, but does nothing to x
<koz_>Ah, OK.
<amz3>TIL
<koz_>So how should I do the thing I want to do?
<amz3>use set! outside the lambda
<koz_>amz3: That... really doesn't help solve my problem. :P
<amz3>in admit! do: (make-trie entries) instead of (begin (set! trie ...))
<lloda>I think the common Schemish advice would be to build a new structure instead of modifying what you have
<lloda>you can also try set-car! and set-cdr!
<koz_>I guess I could do it that way.
<koz_>Alrighty, back to thinking.
<amz3>fwiw here is a set of datastructure written in pure scheme https://github.com/ijp/pfds
<nalaginrut>ACTION wrote a simple prover of Combinatory Logic https://gist.github.com/NalaGinrut/344be1b3f41cab1775a2
<ArneBab>wingo: the global story sounds reasonable. Did you think of that ahead of time when switching to the ELF format?
<wingo>ArneBab: somewhat yeah
<dsmith-work>Monday Greetings, Guilers
<darthlukan>Hello everyone
<darthlukan>I've recently been turned onto Guile via a search for Scheme implementations after taking a class that used Racket as the teaching language. I've installed Guile and have used it to write a small program that converts temperatures between Celcius and Fahrenheit and was wondering if someone would be willing to provide some tips on how to improve it
<darthlukan>Basically, if I made any faux pax or did something in a more complex way than Guile provides
<darthlukan>here's the code: https://github.com/darthlukan/tempconv
<amz3>darthlukan: why use have an empty string in L19 and L20 as in (string-append "" (number->string ...))
<amz3>in guile you can declare a procedure as (define (my-proc a b c) ...)
<darthlukan>amz3: I was getting errors using string-append stating a type error because of the number
<darthlukan>amz3: So I added the string in front and then it worked
<amz3>strange.
<mark_weaver>darthlukan: I think it was the use of 'number->string' that fixed that problem.
<mark_weaver>the "" should make no difference
<darthlukan>mark_weaver: that's what I had initially, but I kept getting the error until I used the empty string
<mark_weaver>I don't believe it
<darthlukan>is there maybe a better way to generate a formatted string without needing string-append?
<mark_weaver>yes, there is
<darthlukan>awesome! Do you know which doc I should read for that off-hand?
<mark_weaver>(format #f "~aC" (celsius t))
<darthlukan>oh, well, shoot. Now I feel silly
<mark_weaver>'format' is in the index of the guile manual.
<darthlukan>thanks! I'll review that one
<amz3> https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html
<mark_weaver>in emacs, looking at the guile manual from the 'info' reader, you can just type 'i' and then type "format" and return.
<mark_weaver>also, see the procedures 'string-take-right' and 'string-drop-right', which are a nicer way to split the temp from the unit.
<darthlukan>will do! Thank you very much!
<mark_weaver>(string-drop-right arg 1)
<mark_weaver>(string-take-right arg 1)
<mark_weaver>instead of (/ (* t 9) 5) you can do the equivalent (* 9/5 t)
<mark_weaver>9/5 is a syntax for a numeric literal, there's no division happening when the program runs it.
<darthlukan>interesting...
<mark_weaver>guile has support for arithmetic of exact rational numbers, and that's the syntax used for them.
<darthlukan>okay, I must have misunderstood that when reading the docs
<mark_weaver>did you want to round the results to integers, or was the problem that the results were being displayed as exact rationals and you wanted to avoid that?
<darthlukan>The results were being displayed like: "327/123C"
<mark_weaver>right :)
<darthlukan>and I wanted to actually display either whole numbers or floating point numbers
<darthlukan>the quickest way to get to an acceptable output was round from what I saw (I noticed there wasn't a "float" type)
<darthlukan>or maybe there is and I missed it (or it's called decimal)?
<mark_weaver>the easiest way is to use ~g instead of ~a in the 'format' call.
<darthlukan>and then just drop round
<mark_weaver>right
<mark_weaver>scheme treats numbers differently than most other languages. there is no concept of floating point numbers vs integers.
<mark_weaver>there is a concept of "exact" numbers vs "inexact" numbers
<mark_weaver>in scheme, (/ 1 2) is 1/2, whereas most languages would give 0, which seems rather dumb to me :)
<darthlukan>and then there are levels of exactness
<darthlukan>right, because you are expecting some representation of 1/2, either as 1/2 or 0.5
<darthlukan>so I guess I just need to specify with the appropriate format character which representation I wish to display
<mark_weaver>in scheme, literals with a decimal point or exponent, e.g. 0.5 or 1e2 are inexact numeric literals.
<mark_weaver>integers or rationals are exact.
<mark_weaver>so 1/2 and 0.5 are numerically equal, but one is exact and the other is inexact.
<mark_weaver>as scheme does numeric computation, it keeps track of whether the number is exact automatically, based on whether the inputs were exact and whether the operation could be done exactly.
<mark_weaver>if you want to force inexact computation and printing, another common way is to use 'exact->inexact', or to deliberately introduce an inexact number into the computation, e.g. by changing the 32 to 32.0
<mark_weaver>but in this case, the cleanest solution is probably to use the ~g format specifier. or ~f if you prefer.
<darthlukan>yeah, ~f looks like what I want (based on the output I'm seeing)
<darthlukan>oh, cool! Digits after a decimal point are similar to other languages: "1.2f" in Python versus "~1,2f" in Scheme/Guile
<darthlukan>that will make things more familiar :)
<mark_weaver>:)
<darthlukan>the use of lambda in procedures: convention or some subtle purpose that the books I've been following haven't expanded upon?
<darthlukan>in one book it mentioned it as a convention, but didn't explain why
<Petit_Dejeuner>darthlukan: You mean (define add (lambda (a b) (+ a b))) instead of (define (add a b) (+ a b))?
<darthlukan>Petit_Dejeuner: yes
<mark_weaver>'lambda' is the fundamental way to create procedures. other ways of creating procedures are only syntactic sugar for the same thing.
<darthlukan>In guile is it considered a better practice to use one over the other?
<darthlukan>or is it pretty much whether or not you prefer more compact notation or not?
<mark_weaver>some people prefer to always use 'lambda', and I can sympathize with that. among other things, it means that when you use 'lambda' in a call to 'map' or some other higher-order procedure, or use 'lambda' with a 'let', it looks less strange because you're used to it.
<mark_weaver>in practice, most people tend to avoid using 'lambda' and use the (define (proc args ...) ...) sugar instead, but sometimes I think that was a bad idea.
<ArneBab>darthlukan: I’ve seen the lambda form a lot in Racket, but on the other hand when you use (define (foo bar) …) (foo 1), the definition looks like the call
<mark_weaver>I'd say it's a matter of personal taste.
<ArneBab>mark_weaver: what do you use?
<mark_weaver>well, most of the code I write is for other projects where there is already an established set of conventions, and usually those conventions use the 'define' sugar. but sometimes on my own projects I use 'lambda' consistently, or even 'λ', which is recognized by guile by default.
<ArneBab>I tend to use the sugar, but I’m still pretty new to scheme myself.
<Petit_Dejeuner>Just use this. https://www.refheap.com/07abf1f89913a9f0455c033f5 ;)
<darthlukan>ha ha ha!
<darthlukan>I'm new to scheme as well ArneBab, got turned onto it during a class that used Racket/Scheme as the language
<darthlukan>and went "Hey! That looks like LISP!"
<ArneBab>
<darthlukan>So here I am, trying to learn enough to at least be useful
<darthlukan>and maybe to be able to contribute to Guile if I get good enough at it
<darthlukan>:)
<mark_weaver>that would be great :)
<ArneBab>sounds like a good plan :)
<darthlukan>I'm on the user and dev mailing lists, so I can have examples through patches to read and try out. Same thing I did when I learned Go
<mark_weaver>I have to go afk for a while. happy hacking!
<dsmith-work>Wow. 117 nicks in here.
<darthlukan>thanks for all of the help mark_weaver !
<darthlukan>dsmith-work: Are there usually less?
<OrangeShark>darthlukan: it used to be less than 100 users a couple of days ago
<darthlukan>new website looks fancier than a few days ago :)
<darthlukan>well, that's good that there are more people, more GNU users :)
<Petit_Dejeuner>GNUsers
<darthlukan>^
<paroneayea>hey darthlukan
<paroneayea>welcome!
<darthlukan>hello paroneayea
<darthlukan>and thanks :)
<paroneayea>:)
<davexunit>#guile is hoppin' today
<dsmith-work>darthlukan: Used to be around 60 or so a few months ago.
<darthlukan>davexunit: just takes a decent questions/topic of conversation and one or two good responses to get things rolling :)
<ArneBab>darthlukan: I hacked a bit on your script for fun :) https://github.com/darthlukan/tempconv/compare/master...ArneBab:master
<darthlukan>ArneBab: That's what it's there for :) Oh! You did some fancy stuff in there with print-converted-temp
<darthlukan>ACTION reads
<ArneBab>I just factored it out of the main
<darthlukan>Yeah, but you used a "let" and some formatting trickery too, that's what I'm reading to make sure I understand it correctly
<ArneBab>darthlukan: here are my notes from when I started leaning Scheme and Guile: http://draketo.de/proj/guile-basics/
<darthlukan>thanks!
<ArneBab>darthlukan: mind the (use-modules (ice-9 format))
<ArneBab>^ the ice-9 stuff is really useful
<darthlukan>when I tried to use the ~g that mark_weaver mentioned, I got an error, then I saw in the error that ice-9 format was recommended/where that could be used, so I figured I'd import it
<ArneBab>ice-9 are the guile basic structures, inspired by this: https://en.wikipedia.org/wiki/Ice-nine
<darthlukan>Guile Basic Strucutres == Standard Library (as in, "The Python Standard Library")?
<darthlukan>like, that's a synonymous reference?
<ArneBab>not completely
<ArneBab>Guile has ice-9, but it also has many SRFIs — both together form a kind of standard libray
<ArneBab>ice-9 ~ Guile Standard Library, SRFI ~ Scheme Standard Library
<darthlukan>ah, okay
<ArneBab>example for SRFI: (use-modules (srfi srfi-1))
<darthlukan>so if I'm trying to write something that any Scheme implementation can consume, I would avoid ice-9 and try to use the srfi instead?
<darthlukan>or does it really matter?
<darthlukan>Sorry if this is covered in a doc somewhere
<darthlukan>I typically work in integration, so portability challenges are always in the back of my mind
<darthlukan>hence the question
<ArneBab>bbiab
***thorwil_ is now known as thorwil
<ArneBab>re
<ArneBab>darthlukan: yes
<darthlukan>makes sense, thanks!
<darthlukan>I'm reading through your link now
<darthlukan>good stuff!
<ArneBab>I did not write for multiple scheme versions yet, but others here do.
<ArneBab>there’s also slib for that: http://people.csail.mit.edu/jaffer/SLIB
<darthlukan>well, one thing that's great about where I work, I'm allowed to use the best tool for the job (within limits), so it would be nice to be able to write something up in Guile/Scheme and then be able to use it at work where I have to use that other OS
<ArneBab>nice!
<ArneBab>AFAIK you can use Guile on the other OS, but I did not try that yet
<darthlukan>neither have I, hopefully, I won't have to soon :)
<darthlukan>Because of my productivity and the docs I've written for coworkers, my employer is looking at migrating everything to a Linux based stack
<ArneBab>cool!
<darthlukan>So hopefully soon I'll have something in Guile/Scheme for production use :)
<davexunit>awesome!
<darthlukan>just have to get over the initial learning curve
<ArneBab>darthlukan: I wrote a second text, but tailored for Python users and using non-standard syntax: http://draketo.de/proj/py2guile/
<darthlukan>Excellent, I come from a Python-heavy background as well
<darthlukan>Now I know who's brain to pick when I come across something grossly unintuitive to a pythonista :)
<ArneBab>:)
<ArneBab>feel free to ask — though I might at times take some time to answer
<darthlukan>same here, Norwegian timezone
<ArneBab>German here
<darthlukan>ah okay
<darthlukan>I noticed the Wisp thing you linked had German links
<ArneBab>:)
<ArneBab>need to get going… cu
<solrize>ArneBab, that book looks nice
<solrize>have you tried erlang or haskell?
<solrize>or ml
<dsmith-work>Habve you python heads seen http://www.phyast.pitt.edu/~micheles/scheme/ ?
<darthlukan>nope, not yet
<solrize>yeah i just saw that linked from ArneBab's page
<solrize>was going to look at it later
***healer``` is now known as healer
<davexunit>potentially interesting: http://www.alexkyte.me/2015/10/vertical-finger-trees.html
<davexunit>finger trees with a better cache story for today's processor
<davexunit>s
<davexunit>(allegedly)
***healer` is now known as healer
<paroneayea>davexunit: I wish I understood more of those datastructures
<paroneayea>there's so much to learn!
<davexunit>yes, me too!
<ArneBab>solrize: I did not try Erlang, Haskell or ML, no. I decided to go for Scheme, because compared to Python it is a diametrally different philosophy while working on the same level of abstraction (though I found that Scheme is at the same time more low level and more high level than Python)
<ArneBab>paroneayea: I plan to get me an algorithm book after finishing my PhD — as a reward for pushing through the last months of work.
<solrize>ArneBab, you might try some of them just to see what they are like
<solrize>what is your phd about?
<ArneBab>solrize: I decided to learn one language, because want to learn a language right before moving on.
<paroneayea>ArneBab: I have an algorithms book, but it's not the best one
<ArneBab>solrize: estimating surface fluxes of CO₂ from athmospheric measurements.
<paroneayea> http://shop.oreilly.com/product/9780596516246.do
<paroneayea>it's engaging, but they go everything really fast
<solrize>ArneBab, wow, neat.
<solrize>have you looked at SICP? it's pretty important for scheme users imho
<ArneBab>throwing lots of Statistics and Python and Fortran and meteorological data at measurements to find a better estimate of the uncertainty of continental fluxes :)
<solrize>but, i think of scheme as something like an assembly language, very flexible and powerful but too low level to want to use directly
<paroneayea>I'm making my way through SICP
<paroneayea>it's great, and does a lot about the nature of computation
<paroneayea>but not about efficiency
<ArneBab>I plan to get this: http://www.amazon.de/dp/1848000693/ref=wl_it_dp_o_pd_S_ttl?_encoding=UTF8&colid=2V3O7K7I0WHN6&coliid=I2D6ZKP2RXL16X
<solrize>www.amazon.de/Introduction-Algorithms-Thomas-H-Cormen/dp/0262533057 this is probably the main book here
<ArneBab>I also plan reading Numerical Recipes in C
<solrize>that's a really good book
<ArneBab>I got it from a collegue :)
<solrize>i think the serious numerics people hate it because it simplifies things more than they want, but it's more understandable that way :)
<ArneBab>
<solrize>i learned a lot from it
<ArneBab>I plan to ☺ but first I have to finish my PhD thesis…
<solrize>i don't know of a good book about statistics and machine learning... i've been interested in that
<ArneBab>maybe just start with the recent release of TensorFlow released by Google: http://tensorflow.org/
<solrize>i haven't looked at that yet, but that's a software package right? i want to understand the math better
<solrize>i've used R a little bit but don't remember anything about it any more
<ArneBab>They have some tutorials, but I don’t know how deep that goes into the math.
<solrize>ArneBab, if you're into this language stuff enough to write that scheme book, i really recommend trying haskell next. it's the most interesting thing i've ever done as a programmer
<solrize>learnyouahaskell.com is a good place to get started
<solrize>book is online
<solrize>i like this book a lot, about information theory (not much about machine learning), if that interests you. also free online. http://www.inference.phy.cam.ac.uk/mackay/itila/Potter.html
<solrize>oops that's a shopping page comparing the book to harry potter, but it's from the book site
<dsmith-work> http://learnyouahaskell.com/chapters
<solrize>yeah
<ArneBab>maybe after the others :)
<solrize>dsmith-work, this is also good http://book.realworldhaskell.org/read/
<solrize>ArneBab, :)
<solrize>both books are kind of old now
<ArneBab>there is a lot to learn about scheme to really understand it
<solrize>is it stuff that's worth the trouble of figuring out?
<solrize>most of the scheme i know is from sicp which doesn't go that deeply into the language details
<dsmith-work>solrize: Ya, I've been going through that one lately
<solrize>dsmith-work, sicp? yeah that's a book everyone should read
<dsmith-work>solrize: No, I mean't real work haskell
<solrize>oh, yeah, that's a good book though i think learnyouahaskell is more accessible for haskell beginners
<dsmith-work>I *do* have a paper copy of SICP
<solrize>i have the old edition of sicp on paper
<solrize>not sure how different the new one is
<dsmith-work>I have the second edition.
<ArneBab>solrize: yes, I think so
<ArneBab>I don’t think that I can really understand the language without giving it solid real world usage (though that might be in hobby projects)
<ArneBab>let it inspire my style of programming
<solrize> http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf i liked this article griping about scheme
<solrize>miranda (described in the article) is a predecessor of haskell
<solrize>scheme as i've seen it isn't that much different from python
<davexunit>I think you need to take a closer look at Scheme, then. :)
<dsmith-work>Heh
<dsmith-work>Scheme can be used in many ways. I'm sure you can program in Python (stylistically) with Scheme. ;^)
<solrize>yeah i saw something saying scheme has one-shot continuations now, like python generators
<davexunit>what does "one-shot continuations" mean?
<davexunit>scheme has had continuations for longer than python has existed.
<dsmith-work>Basically, a continuation that can only be used once.
<solrize>one-shot continuations means they don't stay around after you switch to them, so there's no time travel like in call/cc and you don't have to GC the call frames
<solrize>oleg kiselyov has an article about call/cc being broken
<davexunit>Guile has delimited continuations, if that's what you mean.
<davexunit>much more powerful than python generators.
<solrize> http://okmij.org/ftp/continuations/against-callcc.html
<davexunit>yes I've read that.
<solrize>yeah, oleg says delimited continuations are better than call/cc
<davexunit>delimited continuations allow one to implement generators and other such things
<davexunit>I have a coroutine implementation built on them.
<davexunit>very useful.
<solrize>do you use coroutines much? i've wanted them a few times
<davexunit>my game engine is driven by them, under the hood.
<solrize>there's a good paper about them by one of the lua implementers
<davexunit>to allow for asynchronous code that can be written linearly.
<paroneayea>coroutines \\o/
<solrize>i generally use threads for that
<paroneayea>solrize: threads have a lot of... challenges
<davexunit>solrize: threads are a different beast.
<solrize>true
<davexunit>cooperative multitasking has significant advantages for certain use-cases.
<solrize>brb
<davexunit>with games, I don't want parallel execution, but I do want async behavior.
<davexunit>(I do want threads for very particular tasks such as loading files in the background, but not for game logic)
<davexunit>I like reading parts of sly's codebase that I haven't looked at in awhile https://git.dthompson.us/sly.git/blob/HEAD:/sly/signal.scm#l362
<davexunit>and I have that "holy crap this actually works!" moment again
<solrize>davexunit, what do you gain by using coroutines? i guess they're a bit lighter weight but if the idea of async is that the tasks are usually paused for i/o then it shouldn't matter much
<davexunit>I gain a lot: multi-tasking without the complication of thread synchronization.
<koz_>Can I use eq for comparing something to #f or should I use eqv?
<davexunit>koz_: (not thing) is the usual way
<davexunit>to test if something is falsey
<koz_>davexunit: Ah, thanks.
<solrize>i've generally had the threads communicate with message passing and that avoids the usual lock hazards and so on
<solrize>erlang inherently works that way
<solrize>anyone here use clojure much? i think it has some things that don't naturally map onto scheme
<ArneBab>solrize: the coroutine usage by davexunit was a mind-opener for me: suddenly things where possible which were unthinkable with python.
<ArneBab>because Scheme can actually create the code needed to do them
<solrize>hmm lemme look again
<koz_>solrize: What do you mean exactly?
<solrize>koz_, about what?
<koz_>I know some Clojure (used to be a fan until I found I can't GPL work under it).
<koz_>solrize: ^
<ArneBab>solrize: people here have been implementing some Clojure ideas for Guile
<ArneBab>bbad
<solrize>(can't gpl stuff???!!! wonder how they stop that). but i think clojure has some concurrency stuff that would be hard to do in pure scheme
<davexunit>clojure has different types of applicable things, which scheme doesn't have.
<davexunit>"god gave us lambda" ;)
<solrize>i've looked at clojure a little bit but not used it because the jvm icks me out :). i've wanted a standalone version
<davexunit>I don't see much reason to use it if not on the JVM
<koz_>solrize: Clojure is EPL-licensed, and any code written in it has to be linked against Clojure itself.
<davexunit>there are a better lisps that standalone.
<koz_>Static linking with EPL = GPL-incompatible.
<davexunit>yeah that EPL license really sucks.
<davexunit>terrible choice.
<davexunit>and clojure does copyright assignment! to rich hickey!
<koz_>Yup, and they seem to be interested in precisely zero discussion on this topic.
<davexunit>no non-profit entity
<koz_>Well, CLAs are another story.
<davexunit>terrible, terrible.
<solrize>yuch. don't know what epl is but yeah, that sounds like a turn-off
<koz_>solrize: It's the same license the Eclipse people use for their utter piece of shit software.
<solrize>oh. haha
<koz_>Designed to make *another* piece of shit software not so bad.
<daviid>I noe use kawa instead, which actually is about 100 better then clojure anyway
<davexunit>that's 2 big legal issues with clojure for me. won't use it unless paid by employer.
<daviid>s/noe/now
<koz_>davexunit: I just won't use it full stop, since my employer doesn't care what language I work in. :P
<solrize> https://git.dthompson.us/sly.git/blob/HEAD:/sly/signal.scm this does something that can't be done in python?
<daviid>koz_: oh that's cool and rare, need yelp? :)
<ArneBab>not elegantly — “All Turing-complete languages differ solely in syntactic sugar.” — Michele Simionato in The Adventures of a Pythonista in Schemeland34
<koz_>daviid: I'm a PhD student.
<koz_>People care more for my ideas than the language I implement them in.
<ArneBab>(or rather not as elegantly)
<solrize>looking at https://www.gnu.org/software/guile/manual/html_node/Prompt-Primitives.html
<ArneBab>being able to adjust the syntax makes a big difference for an API, since the basic API of any system never fits your problem perfectly
<ArneBab>(sorry, got to go)
<ArneBab>cu
<koz_>See ya!
<solrize>see ya ArneBab
<davexunit>the macro stuff certainly cannot be done in python
<koz_>OK, I'm getting *real* frustrated now.
<solrize>davexunit, yeah, python syntax is constraining sometimes
<solrize>koz_, wassup ?
<koz_>All I wanna do is implement a trie that can add new branches.
<koz_>(i.e. I don't know my alphabet ahead of time).
<koz_>I tried to do this using assoc-lists, but then I had the problem of nested modification.
<koz_>I thought about records, but they need a fixed number of fields, which I can't provide.
<koz_>This is meant to be a simple prototype, and I can't even seem to get it off the ground.
<davexunit>you could make a node type that has a list of branches?
<koz_>davexunit: It'd have to be an assoc-list, but I guess that works.
<solrize>well if the alphabet is big that slows it down
<solrize>why not a regular map?
<davexunit>alists are faster than hash tables up to a certain scale.
<davexunit>you should be able to swap the structure if needed.
<davexunit>best to focus on making the thing work at all.
<solrize>why are you trying to implement a primitive structure like this anyway?
<koz_>solrize: I'm working on a new supervised learning technique that can be distributed well.
<koz_>This is a test of one of my ideas.
<koz_>I'd like to use Guile more, so I figured I'd try it in Guile.
<davexunit>implementing data structures is fun. :)
<solrize>implementing a trie? there's no library for it?
<solrize>davexunit, well ok
<koz_>davexunit: I agree - I'm not used to doing it in Guile.
<koz_>The language I used for my Master's data structure was Lua.
<koz_>Also, wtf is going on here. I wrote this: http://paste.rel4tion.org/91 , but then I get this strange outcome : http://paste.rel4tion.org/92 .
<koz_>(the print thing is for inspection purposes, mainly)
<davexunit>koz_: you've quoted something that you want to be evaluated
<koz_>What did I quote?
<davexunit>'(("foo" . (make-node 2 '())))
<davexunit>that is the list:
<koz_>Oh, derp.
<davexunit>you want to quasiquote
<davexunit>`(("foo" . ,(make-node 2 '())))
<koz_>Or use acons?
<davexunit>or that
<davexunit>quasiquote is nicer since it's a hardcoded value
<davexunit>IMO
<davexunit>but acons on the empty list also works
<koz_>Thanks! That was a serious derp on my part.
<davexunit>np
<koz_>Also, does newline take a port argument like display?
<davexunit>yes
<davexunit>type ",d newline" in your REPL
<davexunit>to see the docstring
<koz_>Oh, neat!
<koz_>That's somethign I'll have to remember.