IRC channel logs

2014-05-04.log

back to list of logs

<nalaginrut>morning guilers~
***linas_ is now known as linas
***sneek_ is now known as sneek
<lamefun>Why doesn't (read [port]) read all lists in the file, only reads first list?
<cluck>lamefun: how do you propose to deal with infinite streams? lessening the chances of memory overflow? validating content? ...
<lamefun>if it's supposed to read only one datum, why does it wrap it with extra ()?
<lamefun>eg. (read "hello") --> ((hello))
<lamefun>*"(hello)"
<ijp>(read "hello") is an error
<lamefun>I know
<lamefun>I mean, read a file that only contains "(hello)"
<ijp>anyway, read reads the first sexp
*cluck ♥ read, eval, display and them fancy tailcalls
<ijp>if you have an example of it not returning all and only the first sexp, please show me
<lamefun>that was let*-values, not read
<lamefun>I did (let*-values ((datum (read ...))) (display datum))
<ijp>ah, I see
<ijp>just like with lambda, if you give it an identifier rather than a list of identifiers, it collects them into a list
<ijp>if you want one value, do (let*-values (((datum) (read ...))) (display datum))
<ijp>(let*-values (((a b c) (values 1 2 3)) ((d . e) (values 1 2 3)) (f (values 1 2 3))) (list a b c d e f)) -> (1 2 3 1 (2 3) (1 2 3))
<ijp>okay, apprently not
<ijp>it errors on (d . e), which surprises me
<ijp>oh, nvm, pebcak
<ijp>it works as I described
<ijp>generally, you would not be using let*-values if you were only needing to bind one identifier to one value
<lamefun>I do, but not for them all
<ijp>anyway, add the extra parentheses, just like you would for lambda
<lamefun>does Scheme have flat scopes, like in C?
<lamefun>like http://pastebin.com/NsYXBG8q
<ijp>no
<LRN>madsy, i've been told you've had some success with W32 version of Guile. Is that true?
<lamefun>Can I make them myself with macros?
<ijp>you could, I guess
<ijp>there is an ugly trick you can do with let* though
<ijp> http://pastebin.com/Rpr2ZEZz
<ijp>that should be *values* rather than list
<madsy>LRN: Hey. Yeah, it works without threads. Also there are some issues with ioctl calls and sockets
<lamefun>wait, wow
<lamefun>I can't use let in (syntax-case x (let) ..) ??!!
<lamefun>"unknown location: reference to pattern variable outside syntax form in form name"
<ijp>you certainly can
<ijp>what's the whole form?
<lamefun>sorry
<lamefun>I forgot #' in (identifier? name)
<davexunit>I want to implement a variation of memoize that limits the cached results and discards the least recently used ones when the cache is full.
<sneek>Welcome back davexunit, you have 2 messages.
<sneek>davexunit, wingo says: regarding scalar replacement in the real world -- such situations can occur
<sneek>davexunit, wingo says: like when you want to match on two values so you (match (cons a b) ...), or the box that is created for assignment conversion, or other such things
<davexunit>thanks sneek. have a botsnack.
<LRN>madsy, have you tried bisecting this? 2.0.9 worked for me, with threads
<lamefun>My first complex macro! http://pastebin.com/cRTueRmF
<lamefun>seems to work
<madsy>LRN: On Windows? Which exact git blob?
<davexunit>the typical memoize implementation uses a hash table for the cache, but there's no way to know the size of the table so I wouldn't know when to remove old cache items.
<LRN>i've used 2.0.9 tarball, so can't say anything about git blobs
<madsy>LRN: The last release I built was 2.0.9.241-950a-dirty
<davexunit>lamefun: what does this do, exactly?
<madsy>LRN: And I had to use the libgc makefile, instead of ./configure
<LRN>madsy, 2.0.9.241-950a-dirty was before or after 2.0.9 release?
<madsy>LRN: It's after the 2.0.9 release yeah. Consider it a snapshot of 2.0.10.
<lamefun>davexunit, flat scopes like in C
<madsy>Or what was on the 2.x branch which became 2.0.10 and 2.0.11 immediately after (a hot patch released one day after 2.0.10)
<LRN>madsy, ah, well. You may as well bisect from 2.0.9...
<davexunit>lamefun: `define` doesn't cut it? I'm curious
<madsy>LRN: git bisect between 2.0.9 and 2.0.11? That will take forever :-(
<madsy>And that's assuming I get old 2.0.9 working as you claim it should
<lamefun>davexunit, no, I get this: http://pastebin.com/YvSuRf9v
<lamefun>can't do anything in-between defines
<LRN>madsy, just configure with --disable-posix and make with GC_MARKERS=1
<LRN>you can use the same version of bdw-gc for both 2.0.9 and 2.0.11
<madsy>LRN: Why --disable-posix? According to Mark, POSIX is supposed to be supported on Windows via gnulib
<LRN>Well, i've tried to build 2.0.9 with POSIX initially, but it didn't work. I've asked mark_weaver about this, and we worked out that the problem was with posix, so i've disabled it
<madsy>But did threads stop working when compiling with POSIX support, and work with POSIX disabled?
<wingo>meep meep
*ijp files suit against wingo on behalf of W. E. Coyote, Esq.
<lamefun>why does let even exist? is it faster than let*?
<LRN>madsy, um... i don't recall ... maybe you can make some sense from it - http://pastebin.com/RqTB9Wrr
<ijp>lamefun: let is parallel binding, let* is sequential
<ijp>(define x 1) (define y 2)
<ijp>(let* ((x y) (y x)) (list x y)) ; (2 2)
<ijp>(let ((x y) (y x)) (list x y)) ; (2 1)
<ijp>overuse of let* is frankly a codesmell in scheme
<ijp>Coyote V. Acme -- http://www.torinfo.com/justforlaughs/coyote_v_acme.html
<lamefun>parallel as in enabling multi-threading optimizations?
<ijp>reply -- http://www.netfunny.com/rhf/jokes/95q2/coyotenacmedef.html
<ijp>lamefun: nothing of the sort
<ijp>I gave an example of what I meant by it
<ijp>let is "more primitive" than let*, and if you look at the expanded output you'll see that let* turns into nested lets
<ijp>the same cannot be said in the opposite direction without generate-temporaries
<lamefun>Scheme looks very unfriendly to C/C++/C#/Java/JavaScript/PHP/Python/Ruby/etc. practices...
<ijp>obviously
<ijp>and each of those languages are mutually unfriendly to each others practises
<lamefun>not by that much I think
<wingo>lo
<wingo>l
<wingo>lamefun: if you think scoping is remotely the same in those languages, lol.
<ijp>lamefun: take C and C++ for instance
<ijp>you need to track memory allocations, and you can write over any piece of memory
<ijp>you can't do that in C#/Java/Javascript/PHP/Python/Ruby
<ijp>in Java and C#, you, for the most part, have static guarantees that your data is always valid after typechecking. you do not in the others
<ijp>in JS, objects get prototypical inheritance; in C#/Java/Python/Ruby you do not
<ijp>I can do this for all them, but you get the point
<ijp>Scheme may be further away according to the family tree of programming languages, but large adaption is always necessary
<ijp>and if you want to write Java in Scheme, C in Scheme, Python in Scheme, we can try to accommodate you, but why would you use scheme if you just wanted java/c/python/etc.?
<ijp>"an expert programmer can write fortran in any language"
<ijp>wingo: people often seem to equate similar syntax with similar semantics
<wingo>let is not present in the languages mentioned except in js, where it has even weirder scoping semantics
<ijp>wingo: how did js mess with let?
<wingo>it's effectively a hoisted letrec* with mandatory uninitialized unbound checking
<wingo>hoisted == scope begins at most recent enclosing {
<wingo>it makes sense in the context of js but it's still weird
<ijp>did mark_weaver get around to adding define-values?
<ijp>ah, he did
<lamefun>How can I rewrite it in a more clear way? http://pastebin.com/nGZUshtG
<ijp>you should acquaint yourself with srfi 1
<ijp> http://pastebin.com/2QGmzqPs
<wingo>sneek: later tell nalaginrut thanks for the report about ,tr in master; just fixed it (i think)
<sneek>Got it.
<zacts>ijp: I'm thinking about reading learn you a haskell, before learning C. do you think that this would be a good idea? although, I'm to the ch on structs in k&r.
<zacts>my main language gaols are: (scheme)/SICP, haskell, C, python, I already know a lot of perl.
<ijp>I am not a fan of learn you a haskell
<ijp>gaols is a very amusing typo
<zacts>ijp: oh? why not? and what could I read instead of it?
<ijp>my advice to you is not to pull yourself in too many directions at once
<zacts>ok