lisp

(Emacs) Text is read only?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 09:13:06
问题 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? 回答1: "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

What does backtick mean in LISP?

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this macro, which rewrites define. If I remove the " ` " backtick it won't work. What is the explanation? (defmacro define ((name &rest r) body) `(defun ,name ,r ,body)) 回答1: A single quote followed by the written representation of a value will produce that value: Example: '(1 x "foo") will produce a value that prints as (1 x "foo") . Suppose now that I don't want a literal symbol x in the list. I have a variable x in my program, and I want to insert the value to which x . To mark that I want the value of x rather than the symbol x ,

Get index of list within list in Lisp

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I have a list like this ((0 1 2) (3 4 5) (6 7 8) (0 3 6) (1 3 7) (2 4 8) (0 4 8) (2 4 6)) And I want to find the index of (0 3 6) , is there a built-in function to do this? POSITION doesn't seem to work when the search item is itself a list. 回答1: See hyperspec . POSITION can take a :test argument: (position '(0 3 6) '((0 1 2) (3 4 5) (6 7 8) (0 3 6) (1 3 7) (2 4 8) (0 4 8) (2 4 6)) :test #'equal)) 3 The default test for POSITION (and other sequence operations) is EQL, by the way. 文章来源: Get index of list within list in Lisp

What are the advantages of scheme macros?

孤者浪人 提交于 2019-12-03 08:27:44
问题 Why would anyone prefer Scheme macros over Common Lisp macros (and I genuinely want to know too, I'm not trying to be a troll)? My experience as a Lisp newb is that Common Lisp style macros are much easier to learn than Scheme's macros. I have yet to see any advantages to Scheme's macros, but of course that doesn't mean they don't exist. I do know that Scheme macros are "hygenic", but I'm still not convinced this is worth the additional complexity. On the other hand though, there obviously

scheme for object-oriented programmers

佐手、 提交于 2019-12-03 08:26:21
问题 I'm thoroughly intrigued by Scheme, and have started with some toy programming examples, and am reading through Paul Graham's On Lisp. One thing I haven't been able to find is a book or website intended to teach Scheme to "OO people", i.e. people like myself who've done 99 % of their coding in c++/Java/Python. I see that closures are sort of object-y, in the sense that they have local state, and offer one or more functions that have access to that state. But I don't want to learn Scheme only

What does the f in setf stand for?

久未见 提交于 2019-12-03 08:26:17
问题 LISP has the setf function to assign a value to a variable. Now I have been wondering about the function's name: The set part is obvious, but what does the f suffix stand for? 回答1: The actual meaning of F is often forgotten. According to some sources, f suffix could stand for: Field (see for example this answer) Form (as seen in various teaching materials and manuals) However, according to Gabriel and Steele's The Evolution of Lisp, SETF comes from Peter Deutsch's A Lisp Machine with Very

Emacs mode that highlight Lisp forms

只谈情不闲聊 提交于 2019-12-03 08:23:44
What is the Emacs mode or package that highlights Lisp forms changing the color of the backgrounds so that the form you are in has one color, the outer form another, the outer outer form another and so on? fincomus You may want to try mwe-color-box (screenshot below) or read Five approaches to s-expression highlighting by Lemondor . (source: foldr.org ) Take a look at screenshots here http://lemonodor.com/archives/001207.html , may be that is what you want. I don't use it, but this might be what you're looking for: http://www.emacswiki.org/emacs/RainbowDelimiters 来源: https://stackoverflow.com

How can I run SBCL code under a Unix-like operating system in a convenient way?

天涯浪子 提交于 2019-12-03 07:45:58
问题 (David James both wrote the question and an answer. I'll edit it to conform to Stackoverflow standards.) Using SBCL you can compile Lisp code to machine code. Like Java, .net, C++ and even C you will need the runtime. So there are two ways to compile Common Lisp code. First is to make huge binaries which is explained in SBCL documentation. No SBCL needed on target machine. The other way is a more flexible one, which is to create machine code in a fasl (FASt Load) format. The SBCL runtime is

LISP local/global variable assignment

这一生的挚爱 提交于 2019-12-03 07:26:48
If we define a function something like (defun foo(x) (setf x somevalue)) Is x defined as a local variable or global? using setf/q is setting the value to be global. if it is global can anyone tell me how to define a local variable in lisp other than let ? Thanks! Consider the following example (let ((x 0)) (defun foo (y) (when (equal x 0) (setq x y)) (when (< x y) (setq x y)) x)) when I am giving some input to foo like (foo 2) , it is returning 2 and if we execute the function again with (foo 1) it still returns 2 and (foo 3) returns 3.This is what i actually want it do.But the question is how

How do I get a list of Emacs lisp non-interactive functions?

好久不见. 提交于 2019-12-03 07:22:53
问题 How do I get a complete list of non-interactive functions that I can use in Emacs Lisp? The interactive ones are easy enough to find in the help system, but I want a complete list of all the other functions I can use. For example concat , car , cdr , etc. (And preferably with documentation). Thanks Ed Edit: Answered thanks to Jouni. I played around with his answer a bit, and got it to sort the results (using the results of his code to help me find the correct sorting function!) (flet ((first