IRC channel logs


back to list of logs

***holomorp1 is now known as holomorph
<zv>ok guile, i'm sorry to post a question like this here but it is *really* killing me
<zv>i am trying to implement `while' in terms of named-let in SICP. I found after a bunch of hassle that my named-let implementation doesn't actually work (in fairness, the test that is supplied by SICP *can't run* because of no definition of "=")
<zv>so after playing around with it a *bunch*, I could not get it to work, gave up and went online
<zv>I have tried probably 16 different implementations that do *NOT* use define (I don't want to get involved in alpha-conversion in such a simple project)
<zv>tl;dr -- I have looked at *many* major SICP exercise 4.8 implementations in scheme -- I have not found a single correct implementation that doesn't use define (which is *clearly* a poor implementation choice). is it possible to solve?
<zv>(here's my *own* implementation if any of you happen to be curious about my (nonworking) approach )
<wingo>has anyone had success or problems building master since the gnulib update?
<wingo>ACTION trying to understand what the problem with hydra is
<wingo>i am not sure why unistr.h from gnulib is getting built
<wingo>i think the difference is that the libunistring that hydra finds is 0.9.3
<wingo>and something in the gnulib macros want 0.9.4 or more, and if it's not present it builds its own unistring (?)
<amz3`>héllo :)
<amz3`>the wiredtiger bug I found, was fixed overnight, on the week end :D
<ijp>zv: you can do it without introducing extra identifiers, but it's not very obvious
<ijp>that said, I don't see what you have against define. inner define is fine.
<ijp> make sure you understand *why* there are no binding issues here
<ijp>wait, if while is a procedure than I don't see what your issue was to begin with
<ijp>incidentally the above trick goes back to *at least* Guy Steele's RABBIT thesis
<ijp>maybe I'll blog about it
<zv>ijp hmm
<zv>ijp, the issue is not so much while, but rather named-let
<zv>in regard to whats wrong with define -- it raises the possibility of a nameclash issue
<ijp>how so
<ijp>inner define is a letrec(*)
<ijp>so is named-let. named-let is a pretty straight transformation
<ijp>and your while is unhygienic, you can't nest them
<ijp>(let frob ((wibble wobble) ...) snap crackle pop) => (letrec ((frob (lambda (wibble ...) snap crackle pop))) (frob wobble ...))
<zv>ijp: when you say "inner define", you mean the internal definition of `define' is letrec?
<ijp>zv: (define (sqrt x) (define good-enough? ...) ...)
<ijp>the define for good-enough? is not like the define for sqrt
<zv>yes, i get what you are saying here
<zv>let me make my problem more concrete
<zv>Can Exercise 4.8 of SICP be correctly implemented WITHOUT the use of `define'
<jcubic>anybody know how to render " using sxml->xml?
<ijp>you will certainly not need to make any top level definitions
<zv>ijp: the obvious answer is yes -- the problem is that there are other smart people in the world ijp and of them not a SINGLE one (at least of the first 10 google results for the question) has done it correctly
<ijp>and I already showed you how to do it
<zv>ijp -- that is how mine is defined
<jcubic>I want to render this (script (@ (src "biwascheme-min.js")) "(display \\"hello\\")")
<zv>well, minus letrec -- which you couldn't use anyway
<zv>is can't correct english usage?
<zv>yes, letrec is not yet implemented in the interpreter
<zv>and implmeneting it for this purpose alone seems to be avoiding the *real* quesiton.
<zv>ijp: yeah, i hate asking SICP-specific questions here, but this has been *killing* me
<cluck>definitions are just syntactic sugar over lambdas/quotation
<ijp>not helping cluck
<cluck>ijp: what's going on?
<ijp>zv: and are internal definitions allowed?
<ijp>then you can just use that
<zv>you mean to say a define *within* the let?
<zv>that is a pretty good idea
<zv>not sure why i didn't think of that
<zv>wait, but then how will the 'define' refer to the function body?
<zv>err, i guess you could just define it there directly
<ijp>I don't understand the question
<zv>take this guy as an example (this one doesnt work) -
<zv>the "let?" question is a bit for the interpreter
<ijp>yeah, that code won't work
<ijp>or rather, if it works then his let is broken
<zv>so, here is my issue -- I've gone through about 10 of these without a SINGLE one being right
<ijp>and why does my strategy not work?
<zv>i think it does
<zv>i have to eat breakfast and i will try it
<zv>ijp, you've done it again you scurvy bilgerat
<zv>it works!
<sxml>jcubic: do you get an error when you pass the sxml you want to convert to sxml->xml?
<sxml>it works for me
<sxml>with your example
<ijp>zv: cool, also try to understand the difference between my 'while' and your 'while'