lisp

Emacs lisp: why does this sexp cause an invalid-function error?

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The sexp in question is (((lambda (b) (lambda (a) (+ b a))) 3) 5) which, to me, looks like it should evaluate to 8 , and in other lisps (e.g. Racket) it does, but in elisp it instead throws this error: Debugger entered--Lisp error: (invalid-function ((lambda (b) (lambda (a) (+ b a))) 3)) It appears to be telling me that ((lambda (b) (lambda (a) (+ b a))) 3) Is not a valid function. This seems wrong, because when I evaluate that expression I get (lambda (a) (+ b a)) which looks like a valid function to me. Does anyone have any idea why this

emacs lisp will not start

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to setup the slime mode in emacs for using common lisp. When I attemp to start slime with M-x slime I get an error message saying: process inferior-lisp not running . So, I checked the value of the variable inferior-lisp-program which turned out to be "/opt/sbcl/bin/sbcl" . sbcl is an acronym for an implementation of common lisp known as steel bank common lisp. Note that this variable is defined in file slime.el . As I do not have sbcl (the previous directory does not even exist on my machine) installed on my machine (which runs

What are the actual differences between Scheme and Common Lisp? (Or any other two dialects of Lisp)

。_饼干妹妹 提交于 2019-12-03 00:41:48
问题 Note: I am not asking which to learn, which is better, or anything like that. I picked up the free version of SICP because I felt it would be nice to read (I've heard good stuff about it, and I'm interested in that sort of side of programming). I know Scheme is a dialect of Lisp and I wondered: what is the actual difference is between Scheme and, say, Common Lisp? There seems to be a lot about 'CL has a larger stdlib...Scheme is not good for real-world programming..' but no actual thing

Can I use Common Lisp for SICP or is Scheme the only option?

时间秒杀一切 提交于 2019-12-03 00:29:37
问题 Also, even if I can use Common Lisp, should I? Is Scheme better? 回答1: You have several answers here, but none is really comprehensive (and I'm not talking about having enough details or being long enough). First of all, the bottom line: you should not use Common Lisp if you want to have a good experience with SICP. If you don't know much Common Lisp, then just take it as that. (Obviously you can disregard this advice as anything else, some people only learn the hard way.) If you already know

Emacs lisp “shell-command-on-region”

感情迁移 提交于 2019-12-03 00:10:19
In GNU Emacs, I want to run a program, figlet, on the currently selected text. I then want to comment the region which is produced. I have figured out how to do it using the standard Emacs commands: set mark with C-<space> at the start of the word move cursor to the end of the word C-u M-x shell-command-on-region RET figlet RET M-x comment-region RET However, I have failed to work out how to write an Emacs lisp program to do all this. Here is my attempt: (defun figlet-region () (interactive) (push-mark) (shell-command-on-region "figlet") (comment-region (mark) (point)) (pop-mark) ) (global-set

What's a good beginning text on functional programming? [closed]

此生再无相见时 提交于 2019-12-03 00:10:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I like to study languages outside my comfort zone, but I've had a hard time finding a place to start for functional languages. I heard a lot of good things about Structure and Interpretations of Computer Programs, but when I tried to read through it a couple of years ago it just

Eval-when uses?

删除回忆录丶 提交于 2019-12-02 23:30:30
After reading a lot of documentation regarding Lisp eval-when operator I still can't understand its uses, I know with this operator I can control the evaluation time of my expressions but I can't figure out any example where this may be applicable ? Best Regards, utxeee. Compilation of a Lisp file Take for example the compilation of a Lisp file. The Lisp compiler processes the top-level forms. These can be arbitrary Lisp forms, DEFUNs, DEFMACROS, DEFCLASS, function calls,... The whole story how the file compiler works is too complex to explain here, but a few things: the file compiler

(Emacs) Text is read only?

隐身守侯 提交于 2019-12-02 23:25:05
So I was working in emacs and the suddenly, the slime-repl sbcl says text is read only. Well that's great because now I can't type anything into it. How do I fix? devon "Buffer is read-only" can be cured by C-x C-q but as Drew & phils said, "Text is read-only" is very different -- it means some part of the buffer has a read-only property. Try moving away from the read-only part, e.g., to the end of the buffer. Emacs Lisp Manual > elisp.info > Text > Text Properties > Special Properties Since changing properties counts as modifying the buffer, it is not possible to remove a `read-only' property

Substitutions in Common Lisp

放肆的年华 提交于 2019-12-02 22:40:54
问题 I’m trying to write a function with two arguments of this type: substitutions (list_one, list_two) list_one has always this form (letters can change according to the input): (1 ((1 2 ((1 2 r) (3 2 t) (4 3 c))) (3 4 ((5 6 y) (5 7 i))))) list_two has always this form (numbers can change according to the input): (2 3 4 5 6) I want to substitute in this way: r-> 2 t -> 3 c -> 4 y -> 5 i -> 6 Can you help me please? 回答1: A not so efficient solution is to first find a list of all the letters in the

Replace an item in a list in Common Lisp?

ⅰ亾dé卋堺 提交于 2019-12-02 22:12:51
I have a list of things (I'll call it L), an index(N) and a new thing(NEW). If I want to replace the thing in L at N with NEW, what is the best way to do this? Should I get the sublist up to N and from N to the end of the list and then glue together a new list from the first part, NEW, and the last part using list? Or is there a better way to do this? l0st3d (setf (nth N L) NEW) should do the trick. hazzen How often are you going to do this; if you really want an array, you should use an array . Otherwise, yes, a function that makes a new list consisting of a copy of the first N elements, the