IRC channel logs
2018-01-24.log
back to list of logs
<amz3>manumanumanu: what do you plan to do with libsodium? <manumanumanu>I just wanted to learn guile's FFI, and at the same time produce something usable :) <manumanumanu>It is also good practice in how to make a proper api. I am thinking a bit of how I can leverage libsodium's streaming api together with guile's port system <manumanumanu>Not only that, it has already taught me quite a bit about how guile works. I still have som GC questions regarding bytevectors and foreign pointers, but I am learning. it will be fine <manumanumanu>amz3: and if the GC isn't smart enough, I will have to learn how to use guardians :D <manumanumanu>amz3: and if I ever finish my editor (which is kind of stalled), it would be nice to have built-in file encryption with the nice primitives that libsodium has without having to necessarily implement it in C. <manumanumanu>After trying to implement Galois counter mode, i don't trust it anymore (which is only half joke) I only tried as an exercise, and found it very hard to get right. <androclus>hey, all.. does anyone know of anywhere i can go (web site, book, pdf, etc.) for clear explanations of a) continuations and b) closures? <androclus>I have tried wikipedia and some other Google-provided links, but even though i've been a programmer for many eyars getting along without them, I find the explanations make too many 'jumps' for me, skipping steps. I need something really step-by-step.. (?) <androclus>Any suggestions ("Continuations for DUmmies" etc. :P )? <androclus>I understand a *little* that continuations basically are a way to jump around program state <androclus>but why that is so important, i can't tell (although in web programming, it apparently helps with providing state to an otherwise stateless architecture) <androclus>but i don't understand the deeper meaning of it, and/or when i would use continuations <androclus>and anyway (with continuations) i was taught (old-school) that GOTO's (i.e. from BASIC) were a "Bad Thing"(tm) <amz3>androclus: I think a closure is the environment where a given function enclosed <amz3>androclus: do you understand lexical scoping? <amz3>androclus: continuation is the dynamic equivalent of goto I think. <amz3>androclus: for instance, you can implement GOTO, coroutines, lazy streams (also called generators), exceptions, amb and prolly other stuff like zippers <amz3>androclus: also GOTO, is a bad thing, if you can not do otherwise. I saw lot of code using goto for handling errors in C code <amz3>androclus: I think the best way to understand call/cc is to use it... obv... <amz3>androclus: also, something I did not understand when I started, call/cc is not a way to backtrack to previous state, but to go back to some place with the current data <catonano>cmaloney: interesting ! May I ask where were you speaking ? <amz3>androclus: you don't have other questions? <dsmith-work>androclus: call/cc is kind of like that, except call/cc is "both ways" <OrangeShark>ArneBab_: I sent you a pull request on bitbucket for with-guise-and-guile to a fix a typo I made <dsmith-work>androclus: And in fact, guile used to (does it still?) implement call/cc by using C setjmp/longjmp <dsmith-work>androclus: Closusres are more or less a pair of a function and some data. <amz3>cmaloney: nice talk, i think it's important to say, that only #f is false in scheme <amz3>cmaloney: compared to javascript and python.. <amz3>maybe the thing about false is a detail <amz3>but it's misleading comming from javascript and python <androclus>dsmith-work: sorry, not familiar with C setjmp/longjmp <amz3>androclus: async/await can be implemented in terms of call/cc <androclus>thanks, amz3, but i don't know what async/await is/are <dsmith-work>androclus: Are you familar with stacks and call frames? <cmaloney>androclus: It was at my local Linux / UNIX users group <dsmith-work>androclus: In a language without continuations, when you make a function call, the current instruction pointer and other stuff is pushed onto a stack. <dsmith-work>It allows you to make recursive function calls. Often, variables local to the function are also located on the stack. <dsmith-work>androclus: The way setjmp works, is it records the depth of the stack. Later on, a deeply nested function can call longjmp to return the stack to the way it was when setjmp was called. <dsmith-work>setjmp can return more than once! Once set recording the stack state and again when "reloading" the stack. <dsmith-work>androclus: So it only goes "one way". From deeply nested out to the saved place. <dsmith-work>androclus: Call/cc is kind of like that, but "both ways". You can save the current state (the "continuation") within some deeply nested call. <dsmith-work>Later on, you can jump back into that again. And as many times as you want. <dsmith-work>With that, you can implement exception handlers, co-routines, all kinds of stuff. <dsmith-work>androclus: Well, that's my attempt at explaining call/cc. Hope it helps some. <androclus>dsmith-work: yes, i am familiar with stacks. (not so sure about call-frames) but your explanation is good enough using the stack that i could see it. never thought about the ability to move up and down a stack, wow. <androclus>i also liked cmaloney's quick/simple example (at 30:19) of closures. <androclus>each of these provides a piece of the puzzle (for each: continuations and closures). i think i will get it more completely, as i go. but this is a good start. thank you everyone! i think i will work through the relevant chapters in the PLAI book <androclus>but at least for now, i get a basic idea of each of the two.. grazie, grazie