4 ms·
> CL-USER> foo 1 > > CL-USER> foo 1 2 > > CL-USER> foo 1 (+ 1 2) (+ 3 4) But then they do have the problem I mentions: they can't distinguish between calling
by amno 3y ago
> CL-USER> foo 1
>
> CL-USER> foo 1 2
>
> CL-USER> foo 1 (+ 1 2) (+ 3 4)
But then they do have the problem I mentions: they can't distinguish between calling (foo 1 (+ 1 2) (+ 3 4)) and calling (foo 1) (+ 1 2) (+ 3 4).
I don't think it is important ether, I certainly wouldn't type code like that in a repl either. I don't even know if sly/slime repl even support typing several expressions on the same line in repl. I am not at home to test it.
> Basically instead of hyphens it uses spaces.
>
> In LispWorks & Zmacs one enters the command M-x Replace String <return> and then the editor prompts for the arguments.
I understand, thanks.
I thought they were a bit more finicky about it. I think that could be relatively easily done in Emacs as well, but I don't see much gain to implement a M-x replacement like that. Especially with modern completion systems like Helm and fuzzy completing which basically don't care how we type.
Thank you for your time and answers.
- lispm 3y ago> they can't distinguish between calling (foo 1 (+ 1 2) (+ 3 4)) and calling (foo 1) (+ 1 2) (+ 3 4). It uses always (foo 1 (+ 1 2) (+ 3 4)). It uses the complete input. > I don't even know if sly/slime repl even support typing several expressions on the same line in repl. Most Lisp REPLs use multiline input. Here LispWorks requires that + 1 2 is on a single line. If one enters more than one expression to a single prompt, possibly on/spanning multiple lines, each will be executed. > but I don't see much gain It looks better. Much better. Minus: the command now has spaces in its name, which makes it more difficult to use in scripts.
- amno 3y ago>> but I don't see much gain > It looks better. Much better. I think it is just preference. I don't think it would be difficult to implement in Emacs, by just transforming the symbol name and presenting that to user instead. I think the read-extended-command-1 is the place where they actually do the work. They could also store a display string for each command in symbols plist as they do with interactive form, but it would be more surgery and as you say harder to use in the code. If display string is decoupled from the function name than the programmer has to remember as well the name for the command, but if they just do a transformation than the programmer can remember the rule. We are used to this in menus and gui stuff like that indeed, labels are often different strings than actual symbol names used for function callbacks, but I am not sure if we would prefer that on the command line. In my opinion there is still discrepancy between the spoken language and the function names. I guess that is why people have come up with llamas and what not they call those AI llms and chatgpt and so on. I personally am not so fun of using spoken languages as a programming language or a way to control the computer, but who knows, perhaps one day M-x will run some llm search instead of precise lisp function names.
- lispm 3y agoInterlisp for example used a spellchecker for its Lisp. See DWIM (Do What I Mean). Chapter 15: https://larrymasinter.net/86-interlisp-manual-opt.pdf https://larrymasinter.net/86-interlisp-manual-opt.pdf In Genera the command "Find Symbol" has com-find-symbol as a symbol name. For display it removes the com and the hyphens.
- amno 3y agoThat was an ambitious error recovery in Interlisp indeed. It took like 30 ~ 40 years to get similar thing in Emacs, and we still don't have the "trusted" mode, just cautious with flycheck & co. > For display it removes the com and the hyphens. In Emacs, packages are supposed to define a group node and a prefix for symbol names for Customize. Not all packages do, but most of quality ones do. We could actually use that prefix and implement similar strategy to display labels for menus and commands. Menus in Emacs are also implemented as keymaps, but they do require a programmer to specify a label for display in "easy menu" as they call their menu implementation. This strategy could thus remove the need for that extra label. DWIM from Interlisp could be implemented in forms too. All forms have to use known symbols unless in some well-defined places: literals (strings, quoted symbols), the symbol name which is the word after the certain operator (defun, defmacro, defalias, etc), in argument lists, or as a first symbol of locally defining symbols (let, let*, flet, labels and similar). But there are some questions I am not sure how to answer: I think I will have to tell the system somehow that certain part of an expression is a "defining" part so it understands which symbols are to be introduced into the system and not checked or mistaken for misspelled. It would be actually useful to have such feature, bound to space and return, so when we type it just replaces misspelled symbols. I am a master of misspellings, I often replace two characters place for some reason, like in Siebel as seen :).
- kazinator 3y ago> they can't distinguish between calling (foo 1 (+ 1 2) (+ 3 4)) and calling (foo 1) (+ 1 2) (+ 3 4). The former is encoded as > foo 1 (+ 1 2) (+ 3 4) and the latter is three separate top-level forms, encoded as > foo 1 > + 1 2 > + 3 4 Here it looks as if I'm assuming we have one-liners, but that doesn't have to be so; there could be a way to insert soft line breaks that don't dispatch the expression: > foo 1 (+ 1 2) (+ 3 4) > foo 1 > + 1 2 > + 3 4 You do have to restrict the input to one form. Whereas a REPL which uses regular notation can handle a single input line of (foo 1) (+ 1 2), and do two evaluations, we cannot have that here. This style of REPL basically inserts parentheses for you, and it inserts one set of them around your whole input, which makes it a single form.
- amno 3y agoYes, well that is basically what I meant. I guess in practice, those examples I made are contrived, so I suppose what they do is not a problem for the most people in practice, so I don't think it is a big argument against.