IRC channel logs


back to list of logs

<daviid>do we have an average builtin procedure?
<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~
<nalaginrut>wow, 126 points on HN
<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:
<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:
<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
<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
<wleslie>bash: /home/fps: Is a directory
<fps>that's right :)
<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?
<koz_>No, at this:
<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:
<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>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_>Alrighty - I guess if memory becomes a problem I can do something different.
<koz_>ACTION goes to read more Guile manual.
<nalaginrut>koz_: maybe you need this article
<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>eg, (display "\\n")
<solrize> 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>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
<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: 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>thanks for the help, you kind people :)
<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>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>trying with python3
<solrize>python3 at 3m20s and still going strong :)
<solrize>should try with pypy
<solrize>luajit is really impressive
<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> <- 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
<solrize> mirror
<solrize> 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:
<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
<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>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: , but when I execute the following, I get weird results: .
<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.
<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
<nalaginrut>ACTION wrote a simple prover of Combinatory Logic
<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:
<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
<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
<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.
<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>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 :)
<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. ;)
<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!"
<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
<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 :)
<paroneayea>hey darthlukan
<darthlukan>hello paroneayea
<darthlukan>and thanks :)
<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 :)
<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:
<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:
<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
***thorwil_ is now known as thorwil
<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:
<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>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
<darthlukan>So hopefully soon I'll have something in Guile/Scheme for production use :)
<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:
<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>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>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 ?
<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:
<davexunit>finger trees with a better cache story for today's processor
***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>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:
<solrize> 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 :)
<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:
<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> 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.
<solrize>oops that's a shopping page comparing the book to harry potter, but it's from the book site
<ArneBab>maybe after the others :)
<solrize>dsmith-work, this is also good
<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> 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>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.
<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.
<davexunit>cooperative multitasking has significant advantages for certain use-cases.
<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
<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
<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.
<koz_>davexunit: I just won't use it full stop, since my employer doesn't care what language I work in. :P
<solrize> 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
<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)
<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: , but then I get this strange outcome : .
<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>but acons on the empty list also works
<koz_>Thanks! That was a serious derp on my part.
<koz_>Also, does newline take a port argument like display?
<davexunit>type ",d newline" in your REPL
<davexunit>to see the docstring
<koz_>Oh, neat!
<koz_>That's somethign I'll have to remember.