recentpopularlog in

kme : scheme   70

Quick: An Introduction to Racket with Pictures
This tutorial provides a brief introduction to the Racket programming language by using one of its picture-drawing libraries. Even if you don’t intend to use Racket for your artistic endeavours, the picture library supports interesting and enlightening examples. After all, a picture is worth five hundred “hello world”s.
racket  scheme  intro  tutorial  cs  programming 
october 2019 by kme
The fundamental concept of continuations - Google Groups
You use them like a function call. You can also use them like
setjmp/longjmp in C. You can implement coroutines with them, or
events, or simulate non-determinism or write things like ((call/cc call/cc)
(call/cc call/cc)) and make your head explode, use it like goto's inbred
second cousin or in general whatever perverse things you might like to do
with the flow of control in your program.

Ahhh, Kenny, Kenny, you're missing the whole point of "real"
(Schemish) continuations. Here's how your story *should* go,
which may help explain (or not):

0. You're slaving away on Cello version 72531.22.91 when you
realize you've *got* to have some coffee, but you know you're
going to be working all night and you only have enough cash
left after buying that 42nd mongo flatpanel [needed to show
off the full feature set of Cello version 72531.22.90] to
buy one cup. Thankfully, you've been reading this thread,
so you...

1. Put a sticky note on your monitor to remind you what it is
you want to do next after your coffee break [note (and this
is very important): you SETF the note, not LET-bind it!!] and
then you make your coffee run (but *DON'T* drink it yet!!)
and bring it back to the CelloCAVE, and while it's nice and
hot, just before you take the first sip, you do a CALL/CC
and stick the resulting continuation you got into a special
box on a shelf near the door. Then you...

2. Enjoy your coffee, get your caffeine rush, and head back to
your coding CAVE and start doing whatever it says on the little
yellow sticky you put on your monitor in step #1.

Now here's where the real fun starts...

3. Several hours [minutes?!?] later, having used up your caffeine
rush [but Cello 72531.22.91 still being unfinished], it's time
for another coffee run, but as noted in #0 you now have no money
left. No problemo! Make a note to yourself on a little yellow
sticky saying what you want to do after your coffee and stick
it on your monitor [SETF, not LET-bind!], then go over next to
the door and FUNCALL the continuation in the box on the shelf
by the door, and you...

4. Wake up, just back from the coffee run you made in #1, with a
hot steaming cut of fresh coffee in your hand, which you enjoy,
get your rush, and head back to your coding CAVE and start doing
whatever it says on the little yellow sticky you put on your
monitor in step #1.

3a. Several hours [minutes?!?] later, having used up your caffeine
rush [but Cello 72531.22.91 still being unfinished], it's time
for another coffee run, but as noted in #0 you now have no money
left. No problemo! Make a note to yourself on a little yellow
sticky saying what you want to do after your coffee and stick
it on your monitor [SETF, not LET-bind!], then go over next to
the door and FUNCALL the continuation in the box on the shelf
by the door, and you...

4a. Wake up, just back from the coffee run you made in #1, with a
hot steaming cut of fresh coffee in your hand, which you enjoy,
get your rush, and head back to your coding CAVE and start doing
whatever it says on the little yellow sticky you put on your
monitor in step #1.

And you continue in this way, never having to pay for another cup of
coffee, until Cello 72531.22.91 *is* finally finished, then you...

5. Crash all weekend, and get up on Sunday night just long enough
to post the announcement of Cello 72531.22.91 [no documentation,
of course, but it all *WORKS*!!] to "comp.lang.lisp", and then
crash back in your bed again. [Only to wake up Monday morning
to discover that the ungrateful yobbos of "c.l.lisp" are all
bitching about the (lack of) documentation instead of singing
hosannas about all the new features... But that's another story.]

In a nutshell: The thing that's different about full/real/Schemish
continuations is that you can call them more than once. But note
that only the *control* path is repeated; any globals that you
SETF'd [such as the yello sticky] *aren't* reset when you call the
continuation a 2nd, 3rd, 4th, etc., time, so you can use them to
tell the difference between successive FUNCALLs of the continuation.


-Rob

p.s. Smart Schemers will realize I've cheated in the above story.
Well, unless somebody knows how to instantiate a cup of coffee
entirely in the control path and not in a stateful "coffee-mug object"
whose mutations (and eventual emptiness) *will* be noticed across
reinvocations of the continuation.
scheme  humor  continuations  callcc 
march 2015 by kme
Revised^5 Report on the Algorithmic Language Scheme [http://www.schemers.org/]
``Named let'' is a variant on the syntax of let which provides a more general looping construct than do and may also be used to express recursions. It has the same syntax and semantics as ordinary let except that <variable> is bound within <body> to a procedure whose formal arguments are the bound variables and whose body is <body>. Thus the execution of <body> may be repeated by invoking the procedure named by <variable>.
scheme  let  looping  reference 
march 2015 by kme
call-with-current-continuation [http://community.schemewiki.org/]

(define (cor1 cont)
(let loop ()
(begin (display "in cor1\n")
(set! cont (call/cc cont)))
(loop)))

(define (cor2 cont)
(let loop ()
(begin (display "in cor2\n")
(set! cont (call/cc cont)))
(loop)))

callcc  continuations  scheme  fp 
march 2015 by kme
drracket doesn't work on ubuntu 12.04 - Ask Ubuntu
ffi-lib: couldn't open "libjpeg.so.62" (libjpeg.so.62: cannot open shared object file: No such file or directory)
drracket  scheme  ubuntu  errormessage  solution 
february 2015 by kme
Re: changing directory
(chdir "DIR") --doesn't do environment variable or tilde expansion :(
scheme  guile  solution 
february 2015 by kme
Re: Halt while building guile
The *.go compiling is very slow even if you have a good machine
guile  scheme  compiler  solution 
february 2015 by kme
Why MIT switched from Scheme to Python | Wisdom and Wonder
But programming now isn’t so much like that, said Sussman. Nowadays you muck around with incomprehensible or nonexistent man pages for software you don’t know who wrote. You have to do basic science on your libraries to see how they work, trying out different inputs and seeing how the code reacts. This is a fundamentally different job, and it needed a different course.

So the good thing about the new 6.001 was that it was robot-centered — you had to program a little robot to move around. And robots are not like resistors, behaving according to ideal functions. Wheels slip, the environment changes, etc — you have to build in robustness to the system, in a different way than the one SICP discusses.

And why Python, then? Well, said Sussman, it probably just had a library already implemented for the robotics interface, that was all.
python  scheme  lisp  cs  education  thereasonwhy 
february 2015 by kme

Copy this bookmark:





to read