4 ms·
Doesn't everyone in data science do this too with Python/R/Julia? I don't think that it's a unique Common Lisp feature.
by jstx1 5y ago
Doesn't everyone in data science do this too with Python/R/Julia? I don't think that it's a unique Common Lisp feature.
- jhgb 5y agoNot quite. For example, languages like Python typically have generative class definitions -- meaning that a class definition always creates a new type, with no existing object instances being objects of that class. In comparison, Common Lisp has provisions for adapting old instances to match a new definition of an already existing class, including lazy updates. Taken to extreme, this allows for such things as large on-disk object databases (since presumably you don't want to convert a billion objects on the disk the moment you add a field to a class).
- knome 5y agoThe erlang language provides a similar facility for replacing code and updating object state without ever bringing the program to a halt.
- phoe-krk 5y agoThe main difference is that Erlang is very strict about the kind of programs it will run (purely functional green-thread-esque processes and OO systems that utilize message passing and code that is modified must be swapped in/out at strictly defined points in program lifecycle), whereas CL is a fully mutable environment where modification can happen at any time during program lifecycle. Much more powerful, which comes with benefits as much as it comes with the amount of guns to blow your feet off with.
- register 5y agoIn Python and Julia in most of the cases you have to restart ; don't know about R. In Common Lisp you can change a function that is running a loop while the loop is executing and you will see the result immediately in the next iteration after the change. As mentioned the closest thing with modern languages is JS in Chrome.
- jstx1 5y agoWhen is it useful to have a loop that executes partially with some code and the rest of the way with different code?
- kgwgk 5y agoIt's useful if you have some loop running and you want to stop it for some reason in an orderly fashion. Say you were processing several years of data but now want to stop when the first year is completed for some reason. Maybe it's taking too long and you'll rather keep working with partial results or whatever. You can easily recompile the processing function to raise an error when it reaches the stopping point. Or maybe you noticed that the loop will eventually hit an edge case which is not properly handled currently in the code. You can fix it while the loop gets there. And of course for GUI programming. You can redefine interface behaviours on the fly.
- phoe-krk 5y agoFirst example that comes to my mind: you have a game loop running and you would like to change the way the scene is rendered without restarting the game loop altogether and/or losing the current state of the game.
- mikelevins 5y agoYep, this is definitely useful. I've done this kind of work. It's much faster to build an interactive world if you can tweak everything about it while it runs and see the results instantly. The same goes for some simulations I've worked on (and am working on). It's much faster and easier to get good results if you can see the effects of your changes in real time, as the simulation runs.
- deleted 5y ago[deleted]
- vindarel 5y agoI try to explain diffirences with Python here: https://lisp-journey.gitlab.io/pythonvslisp/ https://lisp-journey.gitlab.io/pythonvslisp/ + there is more in this thread.