IRC channel logs

2016-09-10.log

back to list of logs

<sapientech>fyi, blog is down right now :( doing some server repairs
<OrangeShark>sapientech: Your Makefile.am lists a source file twice
***karswell` is now known as karswell
<spauldo>so, in Java class today, our instructor told us all that arrays were the least efficient data structure
<spauldo>fml
<brendyn>spauldo: Did you create a crappier datastructure just to prove him wrong?
<amz3>héllllooooo #guile!
<janneke>hi amz3!
<daviid>wingo: it seems that it is you that recommended ijp to implement psqs :) and the paper which he cites and probably used says: "... Our implementation supports logarithmic access to a binding with a given key and constant access to a binding with the minimum value..."
<tokage>hey. is there any reason to use https://www.gnu.org/software/artanis/ over the built-in guile web module?
<tokage>I want to learn scheme / web development and I'm not sure what to use.
<amz3>maybe artanis is simpler in some regards compare to guile web module but I find the cookie handling machinery clumsy
<amz3>basically there is some good stuff and bad stuff
<amz3>tokage: anyway, that's not how you learn scheme, to learn scheme to need to write an interpreter or a compiler for scheme ;)
<tokage>it's just a side project :)
<amz3>I am kidding
<amz3>tokage: to give a definitive answer, try guile web module and if you are not happy come back here to say it
<amz3>my web experiments are based on this project https://git.dthompson.us/guix-web.git/tree
<tokage>amz3: okay thank you.
<amz3>yw!
<amz3>héllo guile-guest4
<guile-guest4>amz3: ?
<amz3>nvm
<guile-guest4>I'm trying to get guile manual from the snapshot build but everytime I click it
<guile-guest4>it just say File /nix/store/fd9h7pfm876fa59q6m1dl0dqfnnyx4rp-guile-tarball-0pre/guile.pdf does not exist.
<guile-guest4>did I miss sth ?
<spauldo>bah, accidentally created a function with an unprintable character in the name
<spauldo>that was fun to debug
<paroneayea>hi
<spauldo>hrm, I'd like to have a function take its arguments in either radians or degrees. Ideally, I'd just put the degree symbol after a number to have it treated as degrees.
<spauldo>where would I look into to find out how to convince the reader to do that?
<spauldo>basically, if it sees a number that ends with the unicode degree symbol, I'd like the reader to run it through a function to convert it to radians. Is that possible in guile, or would that require hacking the C code?
<paroneayea>spauldo: what's the use case?
<paroneayea>spauldo: are you reading data from a file, or?
<spauldo>typing scheme code in the repl, mostly
<spauldo>although reading from a file would be a nice option
<paroneayea>spauldo: you could use read-hash-extend to do #°89 or etc probably
<paroneayea>though
<paroneayea>you might as well just write a function like
<paroneayea>(define (deg degree-val) ...)
<paroneayea>(deg 89)
<paroneayea>that doesn't require much extra work
<spauldo>the (deg2rad 89) method is what I've been using, but I figured if there was a way to make the reader do that bit for me, it'd be nicer to work with.
<paroneayea>(define (dg x) (deg2rad x))
<paroneayea>bam, now you can
<paroneayea>(dg 89)
<paroneayea>way shorter :)
<spauldo>heh
<paroneayea>or:
<spauldo>read-hash-extend looks interesting, I'm going to have to remember that
<paroneayea>(define (° x) (deg2rad x))
<paroneayea>now you can just
<paroneayea>(° 89)
<paroneayea>anywhere
<spauldo>I looked at it earlier, but it was obviously not what I was looking for so I didn't look further at it
<spauldo>that would work, too
<paroneayea>that option still looks lisp'y
<spauldo>that's probably the way I'll end up going. I was just hoping there was a way to modify the reader.
<spauldo>It sounded like an interesting thing to mess with.
<paroneayea>spauldo: guile's reader isn't quite as hackable as say, common lisp's reader macros support
<paroneayea>but... that also makes it slightly more predictable
<paroneayea>there was recent conversation in here about how safe read is
<spauldo>somewhere there is code that determines if an atom is an integer, real number, etc. If I could add a condition in there - i.e. "oh, hey, if you see a number with a degree symbol, do this to it and treat it like a number" it'd be great.
<paroneayea>eg if you're read/write'ing things over the network
<paroneayea>the more "flexible" you make these things the harder they are to predict...
<spauldo>that's certainly true.
<paroneayea>spauldo: there's also a cool "guile-reader" library, if you reeeeaaaallly wanted, you could extend guile's language tower
<paroneayea>and write your own reader
<paroneayea>and then be like ,L spauldo-deg
<paroneayea>and the REPL would say, "Have fun hacking in spauldo-deg!" and your reader could act any way you wanted :)
<paroneayea>there's a whole language tower section in guile's manual
<paroneayea>but really, (° 89) is probably good-enough :)
<spauldo>oh yeah, it's not like there's anything horrible about the way I'm doing it now, it was just one of those "hey, lisp lets you do all kinds of things to the language, how hard would it be to do this?" things.
<paroneayea>spauldo: always good to explore :)
<spauldo>I'll check out the language tower section though. That's kind of the obvious place to look, now that you mention it.
<spauldo>actually, now that I think of it...
<spauldo>what would really be nice is if it was an additional numberic type
<spauldo>er, numeric
<paroneayea>spauldo: you can write one
<spauldo>that way, I could just do something like (angle-deg? theta) and then base my output on whatever the input was
<paroneayea>spauldo: and even extend + / etc if you want, if you load goops and add generic methods
<spauldo>yeah, been messing with goops. I like it so far.
<spauldo>but I'd still need some kind of reader hack if I wanted to avoid the whole (deg theta) part
<spauldo>probably a dependancy problem there, though - the reader would load before goops, so a goops type wouldn't do what I want
<paroneayea>spauldo: well have fun snorkeling... dont' forget to come up for air now and then though :)
<spauldo>meh, just throwing around ideas, really. I've got a no-kids weekend so I got time to play.
<spauldo>thanks for the pointers, though. I've got a much better idea of where to look.
<paroneayea>:)
<paroneayea>cool, have fun spauldo !
<paroneayea>happy hacking :)
<amz3>so there is chapter about the compilation tower in the manual
<amz3>I'll read that : https://www.gnu.org/software/guile/manual/html_node/Compiling-to-the-Virtual-Machine.html#Compiling-to-the-Virtual-Machine
<spauldo>amz3: I'm reading that now
<ijp>wingo: yeah, heaps aren't really balanced
<ijp>psqs are weird because there isn't really a value but two kinds of keys
<ijp>from the map point of view, the priority is the value, but when popping the minimum priority value, the key is the value
<amz3>hey ijp, is your javascript backend tree-il to javascript translator?
<ijp>no, it was using the previous version of the cps backend
<ijp>so one step lower
<ijp>or higher, or whatever
<ijp>wingo: so for psqs, when I do use them, I generally think of the key as the value, and it lets you reverse lookup priority
<joolean>Funny to hear you all talking about JavaScript. I actually just dropped by to ask whether anybody'd tried running the "official" ECMAscript test suite against Guile's ecmascript implementation to see where the most work needed to be done
<amz3>dunno
<amz3>I think ECMAscript is a frontend, I am interested in the javascript backend
<amz3>I'd like to run guile in browser
<joolean>I don't think I understand the difference. Doesn't `(language ecmascript)' compile stuff down to tree-il?
<joolean>and thus to Guile VM bytecode?
<spauldo>doesn't look like much has been done on the ecmascript frontend since 2011. There's been three commits that I can see since then.
<ijp>most of the non-scheme frontends don't get a lot of love
<ijp>e.g. the lua one is unusable from the repl because its parser tries to read everythign at once
<joolean>Not surprising. But I might take a shot at getting https://github.com/tc39/test262 running just to see how much is missing
<joolean>Doing `function() { }' in the REPL actually worked, so that was kinda neat!
<spauldo>cool.
<spauldo>I'm with amz3, though - I'd like to be able to use scheme in a browser
<amz3>I don't see any significant update in cps language since 2016, maybe i mis-reading git log
<amz3>also tree-il compiles to cps so cps is lower level
<joolean>spauldo: Yeah, that'd be neat.
<spauldo>amz3: since 2016?
<amz3>I mean to say 2015 but actually now I see that current cps language was not the current cps language in 2015
<spauldo>heh, was wondering if you had a time machine stuffed away somewhere and forgot what year you woke up in
<amz3>ahah
<amz3>something like that
<ijp>it was redesigned last summer
<spauldo>elisp hasn't seen any love since 2013, it looks like
<spauldo>unless there's another branch for that or something
<drichards>pwd
<drichards>cd ..
<paroneayea>spauldo: see the wip-elisp branch
<spauldo>drichards:/home/drichards/$
<paroneayea>spauldo: it contains Robin's current elisp branch, rebased by me with updated changelogs for semi-current guile
<spauldo>ah, yes, stuff going back to march
<spauldo>I'm too used to github, I guess. Savannah's interface takes some getting used to.
<paroneayea>savannah is very 2002
<paroneayea>but it gets the job done
<amz3>every interface requires time to get used to it :)
<paroneayea>well
<paroneayea>I think savannah hasn't had much time spent on its interface. There could be improvements
<paroneayea>but
<paroneayea>that's a huge can of worms :)
<paroneayea>especially because the preferred development workflow, for good reason, in the guile/guix world is "patches and mailing lists and things that are emacs-friendly"
<spauldo>I could see motivation for it, though. A lot the GNU guys won't use github.
<spauldo>for ideological reasons
<paroneayea>how to integrate that with a more modern web'y type system is an open question
<paroneayea>spauldo: yes, and there are good reasons fo rthat too
<paroneayea>:)
<ijp>I mean, savannah could get changed to be a gitlab instance or something, but it's still a bunch of work, and I'm not sure anyone is really interested in doing it
<amz3>marketing departement wants that :p
<brendyn> https://libreboot.org/gitlab/
<ijp>I never liked the name of libreboot
<brendyn>The name?
<ijp>my first instinct is to ask why rebooting needs a whole library
<brendyn>-.- derp
<ijp>anyway gitlab was an example, I've not kept up with the politics
<brendyn>We should add a ,use(reboot) in guile to compete
<amz3>:))
<amz3>ijp: why does the javascript backend go through a js-il? instead of straight to javascript?
<spauldo>hrm. In their list of recommended git providers, the first option is "You!", as in "Host it yourself!"
<amz3>ijp: maybe js-il is the scheme representation of javascript code
<ijp>well, if the only reason was "good style", I'd still do it
<amz3>ijp: you answer to me?
<paroneayea>I think gitlab is worrisome after gitorious, though I'm pretty okay with people using it, especially over github
<paroneayea>and if you host it yourself, you may be helping ensure future community support in the case that they decide to proprietize it
<paroneayea>or shut it down a-la gitorious
<ijp>amz3: but there are a few reasons, one of which was to anticipate the move to a different (but not finalised) cps language
<spauldo>true, but I'm a BSD guy. So if I host it myself, it certainly won't be meeting their requirements :)
<ijp>there are some higher level structures in there, like a notion of a "jump table" or whatever I called it, which encodes how I handled procedure calling
<ijp>er, procedure argument handling
<ijp>having a notion of a "call" that is different from a plain js call means I can change that to do trampolining
<amz3>okay, I may agree that a layer between javascript and cps is required
<amz3>does it translate variables bindings to javascript variables or there is an indirection
<amz3>I ask this question, because I am wondering how prompts and call/cc are implemented
<amz3>I guess it targets ECMAScript 4... there is also babeljs that does ES6 to ES4 translation... I'm wondering whether ES6 can be helpful
<amz3>I think I need to read that continuations, continued article mentioned in the cps code
<ijp>prompts and call/cc are implemented basically the same way they are in guile
<ijp>well, except dynamic-wind wasn't working properly when I last touched it
<spauldo>bah, I've got programmer's ADD today
<amz3>here is the article https://www.microsoft.com/en-us/research/wp-content/uploads/2007/10/compilingwithcontinuationscontinued.pdf
<amz3>I add to google it
<amz3>s/add/had/
<spauldo>every time I read papers like that I wish I had gone to a school that teaches more CS theory.
<spauldo>'cause I spend half my time looking up definitions for things like beta reduction
<amz3>spauldo: I don't know what beta reduction, and i've done a cs school
<spauldo>it's a lambda calculus thing
<ijp>beta reduction is function application
<amz3>seems like cps requires tail call optimization to work, es4 doesn't have it
<ijp>tail calls are not a problem
<amz3>why?
<ijp>either you do es4 and translate to es6 with existing translator, you trampoline, or you can cheney on the mta
<ijp>the latter was my preferred option
<amz3>this would avoid a dependency on babeljs
<amz3>s/would/will
<ijp>er swap es4 & es6 in my prior statement
<ijp>but to expand on the previous remark about prompts
<ijp>essentially have a second stack that contains the dynamic environment for the program, and your continuation captures has a reference to that
<amz3>so you don't use javascript variables directly, and allocate scheme variables on a custom stack?
<ijp>variables are not allocated on that stack, just prompts , fluid changes , etc
<ijp>scheme variables are js variables
<ijp>continuations don't change the values assigned to variables
<amz3>ah right I always forget about this, thx
<amz3>there is an extra section in master about cps
<amz3>there is an extra *documentation* section in master about cps
<amz3>in compiler.texi