IRC channel logs

2013-12-26.log

back to list of logs

<davexunit>it seems to be working :)
<taylanub>I had written this tiny pseudo-FRP module back then and if I got it right it behaves the way you want but reading the code I can't figure out why it works, looks like it shouldn't :P http://sprunge.us/PfcQ
<taylanub> https://github.com/TaylanUB/scheme-frpish
<davexunit>oh cool
<davexunit>oh I think I see how you did this.
<davexunit>using macros
<taylanub>Oh, I derped for a moment, sure it should work, I'm just closing over the depended variables so set!ting them works, however it might break in some cases I think...
<davexunit>so when you redefine the value of a variable, it's reflected in the dependent signals.
<taylanub>Well the macro doesn't do any magic, it just hides the record type details.
<taylanub>In fact there should probably be a procedure version of that macro that directly takes a list of dependencies and the procedure that calculates the value, and the macro should just be a super-thin wrapper around that: (make-value-macro (foo ...) bar) -> (make-value (list foo ...) (lambda () bar))
<taylanub>(No wait, that won't really work .. ugh, getting confused over old code of mine, not good!)
<davexunit>I guess I'm not seeing how you can just use set! and have it "just work"
<taylanub>It ends up working in this case but at the same time it breaks some things, because e.g. in this case the new "value" object we store in `x' doesn't have the x*2 object in its dependencies hash-table.
<davexunit>oh I see.
<davexunit>I think I get how this all goes together.
<taylanub>In my code, the issue could be "solved" by prohibiting the direct use of set! on variables holding value objects, instead mandating the usage of some macro that gets the dependents hash-table of the old value object, set!s the variable to the new value object, then gives the dependents hash table to the new value object.
<taylanub>davexunit: Is your code up somewhere ?
<davexunit>taylanub: working on pushing the latest version.
<davexunit>after I fix a bug...
<davexunit>found some major problems with my approach.
<davexunit>back to the drawing board.
<nalaginrut>morning guilers~
<b4283>morning~
<nalaginrut>heya
<davexunit>does mark witmer ever come to this channel?
<davexunit>I am failing hard at extending guile-wm
<taylanub>Re. Linas Vepstas' bug report about `define' thread-safety, I didn't even know Guile works with libgc 7.1
<taylanub>linas: Oh hi!
<taylanub>linas: Savannah seems broken; my reply: Since 2.0, Guile compiles to byte-code, so I don't think `define' does anything at run-time at all, so I don't think it could possibly *not* be thread-safe.
<taylanub>I'd expect any Scheme code to be thread-safe so long as it doesn't share mutable data between threads or do other "obviously" unsafe things.
<taylanub>Savannah won't let me download the define-race.c test-case, but I'd guess that the segfault you get is either due to 1.8 vs. 2.0 API incompatibilities (define-race.c was written for 1.8 I presume), or due to libgc 7.1; I'd try getting 7.2d. (Or is Guile 2.0.5 as old as libgc 7.1?)
<dsmith>davexunit, Have you been able to use guile-wm with a different $DISPLAY, like :1 ?
<dsmith>sneek, later tell davexunit Have you been able to use guile-wm with a different $DISPLAY, like :1 ?
<sneek>Okay.
<dsmith>sneek, later tell civodul Have you been able to use guile-wm with a different $DISPLAY, like :1 ?
<sneek>Okay.
<linas>hi taylanub
<linas>I can place the define testcase somewhere else, if you cn't easily get it.
<linas>the testcase was written 5 years ago, but magically still seemed to cmpile fine with guile-2.0.
<linas>its really a very simpe test case, does nothing fancy.
<linas>I could/should try it with newer gc's; I was simply testing against stock ubuntu 12.04
<linas>and I nitice that http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/ lists *all* version of 7.1 as "alpha" which means maybe its buggy?
<linas>as the stack trace solidly fails in gc, every time...
<linas>I'll try to provide an updated report in the next few days ...
<taylanub>linas: There's a non-alpha 7.1 there, you must've missed it.
<taylanub>Savannah seems to work again, got the test-case, will try now.
<taylanub>linas: OK, I think I understand the problem now; the test-case does fly-evaluation of top-level define forms, which in essence is a mutating operation on the module-object of the current module. I would guess that this is an obscure use-case in practice, is this really how your actual code does it too ?
<taylanub>(I suppose it should still be fixed.)
<linas>I think I first hit the problem on server startup, when I was loading dozens of files in parallel
<linas>I don't think the system does any further defines after its started up ... I can't imagine why it would.
<linas>I thnk I understood, in a rough way, what you said, taylanub, but I don't know guile internals sufficiently well to convince myself that I wouldn't hit this bug during normal operation.
<linas>I guess I could just try it and find out: I'm doing soe number crunching now; guile controlls the top-level loops, and the processes will take months to complete. If they crash, its no loss; I can restart them.
<linas>BTW, quite unrelated, I do seem to see ocasional UTF-8 bugs.
<linas>I'm crunching on millions of sentences (wikipedia) in french, polish, lithuanian, and every few hours, get some ice-9 complaint about a bad string.
<taylanub>You seem to be using Guile for some interesting things!
<SamuelSF>Hi, I installed guile on my Mac by first installing Homebrew and then typing "brew install guile" in the command line. I created a text file test.scm that contains the one line "(+ 5 5)" and I opened the containing directory in the terminal and then typed "guile test.scm" It compiled it to a different directory and when I tried to run compiled file out of that directory I got an error. Is there any way to get guile to
<SamuelSF> just interpret the file as written and print the output to the command line?
<SamuelSF>I'm not knowledgeable about these things and I just want a simple platform for doing the exercises out of SICP.
<mark_weaver>SamuelSF: What was the error message?
<SamuelSF>mark_weaver: I'll go do it again, gimme a sec.
<mark_weaver>If you set the GUILE_AUTO_COMPILE environment variable to "0", it will disable auto compilation, but it would be better to find out what's really going wrong.
<SamuelSF>Hm...
<SamuelSF>Now I don't know what's happening.
<SamuelSF>I went into ~/Code/SICP which is where I keep the test.scm file.
<SamuelSF>Then I typed "guile test.scm" and I got silence.
<SamuelSF>Which in Unix means it did whatever it was meant to do.
<SamuelSF>But I don't know where it put the compiled file.
<mark_weaver>well, it's probably cached from last time.
<SamuelSF>Right.
<mark_weaver>you can touch the file to force a recompile to see where it goes.
<SamuelSF>How do I do that?
<mark_weaver>but you shouldn't have to worry about the auto-compilation stuff. it should just work automatically.
<mark_weaver>"touch test.scm; guile test.scm"
<mark_weaver>"touch" does sets the modification time on the file to now.
<mark_weaver>s/does/just/
<mark_weaver>note that "guile test.scm" with evaluate the code in that file, but it won't print anything unless the code in the file asks to print something.
<mark_weaver>s/with/will/
<SamuelSF>Okay, so it compile to /Users/samuel/.cache/guile/ccache/2.0-LE-8-2.0/Users/samuel/Code/SICP/test.scm.go
<mark_weaver>When you type an expression at the REPL, of course it will print the result of each expression automatically.
<SamuelSF>I haven't gotten that far.
<SamuelSF>I'm still in chapter 2. I was using Dr Racket on my Ubuntu desktop but I recently got MBP and decided to try to get used to a "serious" interpreter/compiler and most of the more knowledgeable people that I know pointed me towards guile.
<mark_weaver>What's "MBP"?
<SamuelSF>Macbook Pro
<mark_weaver>ah, okay.
<mark_weaver>well, in the Scheme/Lisp world, normally people start out playing at the REPL before putting code into files.
<taylanub>SamuelSF: >It compiled it to a different directory and when I tried to run compiled file out of that directory I got an error.
<taylanub>You're not supposed to run the compiled .go file, just run the script and it will use the compiled file in the cache.
<mark_weaver>that's right.
<taylanub>You can fully ignore the compilation cache, pretend it doesn't exist and that Guile interprets your files, so to say. :)
<SamuelSF>The REPL is when I just type "guile" into the command line and it starts up and I can just type expressions in and it evaluates them as I go?
<mark_weaver>SamuelSF: yes
<mark_weaver>also, if you use Emacs, there are some fancy modes for REPL interaction.
<SamuelSF>Okay, a lot of the stuff that I want to do involves writing lots of definitions, if I have to type them into the REPL each time, that gets repetitive. Is there a way to launch the REPL but have it load definitions from a file so that I can then test them interactively?
<mark_weaver>SamuelSF: yes, "guile -l <filename>"
<mark_weaver>or, from within the Guile REPL: (load "<filename>")
<dsmith>And geiser (a guile mode for emacs) lets you send code to a running guile
<mark_weaver>yeah, if you're an Emacs user, definitely check out Geiser.
<mark_weaver>basically you can update code in a file and then type a key combo to send the new definition to Guile automatically.
<mark_weaver>if you're allergic to Emacs, it's possible to enable readline support at the Guile REPL, which gives command-line history and editing like in a modern shell.
<zacts>mark_weaver: also, there is a tslime.vim plugin
<taylanub>Putting "(use-modules (ice-9 readline)) (activate-readline)" into ~/.guile should do, to save you from some RTFMing. :P Since the goal is to use Guile for going through SICP, I'm guessing that SamuelSF isn't motivated to get into Emacs ... (would strongly recommend for long-term benefits tohugh)
<zacts>which allows you to send scheme expressions from vim to a scheme REPL via tmux
*SamuelSF does the Homer Simpson running on the floor in a circle thing. "Woowoowoowoowoowoo!"
<zacts>and I know how to set up emacs-like scheme indent for vim, indenting with [tab] in insert mode..
<zacts>and see this: http://www.ccs.neu.edu/home/dorai/scmindent/
<mark_weaver>sneek: vim?
<sneek>I've heard vim is configured for lisp editing with :set lisp autoindent showmatch
<zacts>well, that doesn't give you an emacs-like feel though.
<taylanub>.oO( Why not just use Emacs ? )
<zacts>because of vim keybindings
<mark_weaver>well, if someone is not an emacs user, they might not *want* an emacs-like feel.
<zacts>what I mean like an emacs-like feel is: [tab] in insert mode indents the current line correctly.
<mark_weaver>I don't doubt that there's something better than :set lisp autoindent showmatch
<SamuelSF>I have a lot of things to learn.
<zacts>rather than [return] or o indenting the next line
<mark_weaver>I'll let the vim users here speak :)
<SamuelSF>Learning Vim/Emacs is on the stack.
<zacts>SamuelSF: emacs is better suited for (scheme)
<zacts>and if you want vim-like keybindings, you can use evil-mode in emacs
<mark_weaver>(I used Vim for many years as my primary editor, but that was before I was a Scheme hacker)
<SamuelSF>evil-mode?
<SamuelSF>Really.
<zacts>mark_weaver: me also..
<zacts>:-)
<SamuelSF>Well, I have both Emacs and Vim pre-packaged with OS X, so there's that.
<zacts>SamuelSF: don't use the pre-packaged emacs on OSX
<zacts>install the latest emacs
<SamuelSF>Right now, I'm trying to focus on getting a foundation in CS concepts, learning the particulars of this or that tool, though important, can be postponed.
<taylanub>SamuelSF: Both the Emacs and Vim on OS X are probably ancient versions.
<SamuelSF>That's why I chose SICP, I was told that for someone with a good math background like myself, it is a good intro to computing.
<zacts>SamuelSF: well, if you are doing SICP Dr-Racket may be a good choice. It has an IDE, and it implements the picture language for SICP.
<SamuelSF>If I install the latest Emacs, does it overwrite the one I have now, or does it install to a separate directory? How do I install it. My temptation is to just enter "brew install emacs" into the command line and let it do it's thing, but I still don't understand where brew puts stuff or how the symlinks work.
<zacts>SamuelSF: you may want to ask #apple
<mark_weaver>I'm pretty sure that everything that brew installs goes into a brew-specific area of the filesystem.
<mark_weaver>learning at least the basics of emacs is probably worthwhile if you intend to work through all (or most) of SICP.
<SamuelSF>I mean, that's nice because it is easy to keep track of where everything is.
<mark_weaver>I suspect the time you spend learning emacs basics will be less than the time you waste dealing with the parentheses in the editor that doesn't help you with that.
<SamuelSF>Okay.
<SamuelSF>I'm interested in three languages primarily. Scheme, Python and C.
<SamuelSF>And everything I say is tentative because I'm trying to come into this with an empty cup.
<mark_weaver>sounds good! I definitely agree that SICP is an outstanding introduction to software engineering for people with strong math skills.
<SamuelSF>But, C because it is low level, so it will teach me how things "really" work, scheme because it is high-level and abstracts the machine away lets me thing just in terms of computational procedures and python because it is a nice language that a lot of people use, has applications to web development and might even be useful for earning some $.
<mark_weaver>(I very much I had known about it earlier in my programming career)
<mark_weaver>very much wish...
<SamuelSF>Please forgive any grammar/spelling errors. English is not my first language.
<mark_weaver>it sounds like a good selection of languages to focus on. I'm mostly interested in Scheme and C myself.
<SamuelSF>Plus I touch type and hit enter before reading what I wrote
<mark_weaver>Python is an inferior language to Scheme, but certainly has the advantage of a larger community and thus more libraries, etc.
<SamuelSF>Well, when I get around to it, I'd like to read the original paper on lambda calculus written by John McCarthy.
<SamuelSF>LISP/Scheme was born of math and then became a language. It didn't start off with someone setting out to create a language.
<taylanub>Hrm, was it math, or logic ? :P
<mark_weaver>hmm, I'm not sure that's right.
<SamuelSF>I think it's math. Logic that isn't math is like Aristotelian categorical logic and the stuff the monks did in the middle ages.
<SamuelSF>After Frege and Russel logic is a subset of math.
<mark_weaver>the lambda calculus was born in the math/logic world, that's true, but it wasn't McCarthy who invented the lambda calculus.
<mark_weaver>it was Alonzo Church.
<SamuelSF>But McCarthy wrote a paper that got Lisp going based off of lambda calculus.
<mark_weaver>also, I think the Russell's idea was that math could be built entirely on logic, not the other way around. but I've heard some say that this idea has not been universally accepted.
<mark_weaver>(actually, I've heard some say that Russell's idea was flat wrong, although didn't understand their explanation of why)
<mark_weaver>(Russell's idea always seemed obviously correct to me, but what do I know? :)
<SamuelSF>I don't know much about that either. I eschewed foundational topics in favor of algebra and topology.
<mark_weaver>sounds reasonable. certainly there is now far too much math for any single person to know, so we all have to pick and choose what to study, and algebra and topology are more likely to be useful :)
<SamuelSF>I wasn't thinking about usefulness. I just fell under the influence of an algebraic topologist.
<SamuelSF>Now I'm thinking about usefulness and here I am, learning Scheme.
<mark_weaver>well, feel free to ask questions as they arise :)