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 !!
Originally Posted by Lau_of_DK 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
Originally Posted by CptPicard 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...?
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
Originally Posted by CptPicard 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) ?
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.
Originally Posted by CptPicard 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.
Graffle2SVG - view graffle files on Linux Game Baker - Open Source Game Maker for Linux
View Tag Cloud
Ubuntu Forums Code of Conduct