4 ms·
Part of it is cultural I think. In Clojure you'll often find yourself building your app incrementally, sending individual functions to the repl from your editor
by hencq 5y ago
Part of it is cultural I think. In Clojure you'll often find yourself building your app incrementally, sending individual functions to the repl from your editor. I don't think there's any reason why you couldn't do that in Javascript.
Common Lisp takes this to another level though with stuff like restarts. Where the app will throw an exception during development (perhaps because a function isn't implemented yet) and instead of crashing you'll end up in the repl where you can make some fixes and keep running the app.
- susam 5y agoThere is a nice little story in the book Practical Common Lisp (Peter Seibel, 2005). Quoting it below: An even more impressive instance of remote debugging occurred on NASA's 1998 Deep Space 1 mission. A half year after the space craft launched, a bit of Lisp code was going to control the spacecraft for two days while conducting a sequence of experiments. Unfortunately, a subtle race condition in the code had escaped detection during ground testing and was already in space. When the bug manifested in the wild--100 million miles away from Earth--the team was able to diagnose and fix the running code, allowing the experiments to complete. One of the programmers described it as follows: Debugging a program running on a $100M piece of hardware that is 100 million miles away is an interesting experience. Having a read-eval-print loop running on the spacecraft proved invaluable in finding and fixing the problem.
- CodeGlitch 5y agoI've heard this before and it does sound like the most epic hack in the history of programming.
- e12e 5y ago> 100 million miles That looks like about 9 light minutes away, so about 18 minute latency? It might be super epic, but doesn't sound super nice :)
- Qem 5y agoRecently there was a bit of a fuss when people discovered the Mars Ingenuity helicopter runs python3. Now I wonder, if its software ever crashes, will people be able to just launch the python REPL and debug It?
- roguas 5y agoThat is the thing about FP in general. Data is the center. State is just data. Program is just data. Capture data, feed it locally - get results.
- Nihilartikel 5y agoAfter my Clojure conversion and baptism, I've taken to writing Python apps in a similar style using Jupyter notebooks, and find it to be a tolerable middle ground. Especially if the Python is functional style with good referential transparency. I.e. in each notebook cell, prototype and exercise your function in isolation. Then copy them over the real py module. Still, I miss the elegant data literals in Clojure whenever I'm slogging through some literal Dataclass objects for testing..
- dunham 5y agoI used to do this in Jupyter, but switched to vscode. If you have comments that look like: # %% It will treat the following chunk of code like like a Jupyter cell and provide inline ui to run it. It’s almost the same thing as a notebook, but no markdown and your file is just a plain python script.
- Nihilartikel 5y agoNice! I've seen a mention of that here and there, but haven't given it a proper shot yet.