When a file is being loaded by load, there should be an anonymous block named nil. The file being loaded should be able to execute a (return <value>) which will stop the load and cause the (load ...) call to return that value.
I'm also thinking it would be useful to pass arguments to load, which turn into a list bound to the dynamic variable load-args, so that loaded files can have arguments.
This is the TXR #Lisp interactive listener of TXR 286.
Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet.
Apply today for a TXR credit card, and get 1MB off your next allocation.
1> (file-get-string "add.tl") ;; what is in add.tl?
"(return-from load [apply + load-args])\n"
2> (load "add")
0
3> (load "add" 3 5)
8
4> (load "add" 3 5 7)
15
5>
We can use a loaded file as a function. It will be useful in tool-related scripting.
Also CL folks: "I developed an entire #Haskell-like programming language in Common Lisp only to realize its lack of features found in its 50-page standard cousin #Scheme is holding the whole project back"
@akater
I did it y'all. I turned #scheme into a proper #lisp
(we already have defmacro, loop [ala (let loop () ...)], defmethod (as define-method), defun is simple function definitions iirc, so all is thats left is unwind-protect, which trivially defined using dynamic-wind)
@ramin_hal9001@publicvoit yup, same rationale. Shell wasn't too bad, but I was fed up with configuring #Neovim and #tmux. They just never felt... complete. Then it got to the point where my Neovim config kept falling apart because all the plugin updates kept deprecating things, and #Fennel just wasn't lispy enough. For reference - I used #Nix, so adding/removing plugins was a breeze.
It also felt like a lot of Neovim plugins and apps were trying to add to or hack into Neovim what Emacs already did well. #Neovide and #GNvim, #Conjure, Vim Table Mode, #Aniseed and Hotpot.nvim, I could go on. These are all excellent plugins, but Emacs just does them so much better.
#Vimscript was a very simple command language made to do things it never should have. Tmux's scripting language is an even uglier copy, mixed with shell syntax. And scripting in Fennel is somewhat okay until you have to start mixing in Vimscript via strings.
It just all felt... hacky. Puzzle pieces that were never supposed to go together.
#Emacs just feels so much more coherent, or at least #DoomEmacs. Doom gives you the finished puzzle, and detailed, simple instructions on how to rearrange it to make it your own, or even tack on more pieces. It's a wonderful experience. And I just love #Lisp.
Richard Gabriel's "Worse Is Better" (1991) is always worth a re-visit.
It's a fairly succinct and technical reflection on why worse design design decisions often win. It also encapsulates why we're all using Unix and Windows running C code rather than more advanced and elegant #Lisp machines.
@schmudde@evanwolf "Lisp, face it, is used for advanced research and development in AI and other esoteric areas. It has weird syntax, and almost all other computer languages share a non-Lispy syntax. Syntax, folks, is religion, and Lisp is the wrong one. Lisp is used by weirdos who do weirdo science."
that's extremely dogmatic (literally so), for someone who is attacking someone else for being dogmatic. otherwise i was finding it ok.
I'm a wierdo. I don't have a problem with that. And yes, I think that most of us who discover #Lisp and fall deeply in love with it are weirdos.
You only need to look at a fern, or a cloud, or a tree, or a human hand, or water curling in vortices off a rock, to know that God is a wierdo too: the universe is written in recursive functions.
I'm playing with #python just now (never done anything serious in it) and I had setup my #java environment recently as well (playing with different options for a linux/windows GUI that didn't need different code for each).
I saw a language speed comparison chart that listed a formula used to calculate Pi to a given accuracy. It showed a 10x difference in speed in favor of Java.
As a little end of work day jolly I thought I'd recreate that on my local machine and see.
I wasn't familiar with the formula so I used #chatgpt to get the formula. That took some clarification to get the correct formula out, but it got there in the end ( -1 to the power and not -1 times).
I wrote the Python version first, and then wrote the same thing in Java.
Running the test I came up with a 5x difference in Javas favor (24s for Python, 5s for Java).
#Lisp(s) are the only programming environments that enable a prototype-to-production development cycle for non-trivial projects in a way that is predictable.
G-exps, derivations, creating your own file-like objects and much more. Another great post from unmatched-paren. If you into #guix, I highly recommend this series for better understanding of internals.