Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Fooling around with continuations...

  1. #11
    Join Date
    Apr 2008
    Location
    Denmark
    Beans
    219
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Fooling around with continuations...

    Captain,

    I understand now! The 'versions of stack' and the simulated conversation between the 2 threads really brought it home for me. And yes, you have most definately earned your star!

    ps: That last comment about C cracked me up, but this time im laughing WITH you !!

  2. #12
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Fooling around with continuations...

    Quote Originally Posted by Lau_of_DK View Post
    the simulated conversation between the 2 threads really brought it home for me.
    And let's remember that this is all single-threaded... it's one of the strengths of continuations -- if you can model your code in terms of continuation passing which is a form of co-operative multitasking -- you don't need to worry about thread synchronization because there is always just one thread. Of course if the co-operation is buggy then it just all fails. These kinds of co-operative "threads" can be very efficient btw in certain applications.

    Personally I feel that synchronizing threads is much more of a problem than managing your continuations once you understand them... I like knowing that I am the only thread of execution while I'm at it, unless I specifically swap execution states. And as I tried to show in my example, continuation swapping can, with the use of external state "on the heap" (figuratively), be used to "multithread" code that you don't need to actually alter much. The "inorder" function knows nothing of what is going on!
    Last edited by CptPicard; April 26th, 2008 at 08:41 PM.
    LambdaGrok. | #ubuntu-programming on FreeNode

  3. #13
    Join Date
    Apr 2008
    Location
    Denmark
    Beans
    219
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Fooling around with continuations...

    Quote Originally Posted by CptPicard View Post
    And let's remember that this is all single-threaded... it's one of the strengths of continuations -- if you can model your code in terms of continuation passing which is a form of co-operative multitasking -- you don't need to worry about thread synchronization because there is always just one thread. Of course if the co-operation is buggy then it just all fails. These kinds of co-operative "threads" can be very efficient btw in certain applications.
    Apropos - Have you got some links to examples of Lisp being used in actual programs. I imagine it would be simple to write a mean webserver that was much more capable of handling high pressure than what we have today...?

  4. #14
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Fooling around with continuations...

    If you want a Lisp webserver, ask lsnostdal. Your current seeing of the light will have made him much more receptive to helping you I'm sure
    LambdaGrok. | #ubuntu-programming on FreeNode

  5. #15
    Join Date
    Apr 2008
    Location
    Denmark
    Beans
    219
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Fooling around with continuations...

    Quote Originally Posted by CptPicard View Post
    If you want a Lisp webserver, ask lsnostdal. Your current seeing of the light will have made him much more receptive to helping you I'm sure
    No Im not looking for a Lisp webserver - I just remember reading some theories on how to profile peaks using some form of AI, which helped webservers deal with heavy loads better than before. Then I thought, thats a job for Lisp.

    Anyway -
    import off_topic from CptPicard.

    My question is this: Do you have some simple examples, tutorials, links or docs of actual programs written in Lisp (to get me started) ?

  6. #16
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Fooling around with continuations...

    Google Is Your Friend... Lisp is under-appreciated for some reason, but there is stuff written in it. For example, the wonderful, all-encompassing Emacs editor was originally all in Lisp, running on a Lisp machine... nowadays it's an Emacs-Lisp interpreter written in C, with most of the parts of the editor written in Emacs-Lisp. That's why it is so extensible...

    I really wish there was a kind of best of both worlds version of Lisp. Common Lisp is very practical and can be used to do pretty much anything any other language can... Scheme on the other hand is nicely minimalistic and has a few key primitives built in that CL does not have (yield and call/cc). I suppose currently CL is closer though.
    LambdaGrok. | #ubuntu-programming on FreeNode

  7. #17
    Join Date
    Oct 2007
    Beans
    130
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Fooling around with continuations...

    Quote Originally Posted by CptPicard View Post
    Too bad I can only give you one star
    Thanks, it's amusing that my first "thanks" is for a post on a thread I was reading to learn something new from - my ratio is now somewhere around 1 percent. Thanks returned for posting the thread!

    Come to think of it, I think I remember one of my parents mentioning something like this to me when I was a kid (they were programmers back in the days when you coded in hex/binary on paper and got a secretary to type it up onto punch cards - A friend of mine currently has the job of upgrading one of the systems they helped write, which is still in use in a large international bank!)

    I'll have to look into Scheme - I had a go at common lisp a few years ago but never wrote much in it.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •