lisp

How do you comment out all or part of a Lisp s-exp using Paredit?

杀马特。学长 韩版系。学妹 提交于 2019-12-18 12:19:05
问题 When editing Lisp code, occasionally it's useful to entirely comment out a top-level definition, like this: ;(defun some-fn-which-is-broken (x) ; ...) ... or comment out only part of an s-expression, like this: (foo x ; y z) ... and then recompile the file and test something in the REPL, etc. With paredit-mode enabled, this doesn't work. Here's what happens, if the point is right before the first paren below: (defun some-fn (x) ...) and you type a semicolon, what is entered is a semicolon and

In Lisp (Clojure, Emacs Lisp), what is the difference between list and quote?

烈酒焚心 提交于 2019-12-18 12:07:32
问题 From reading introductory material on Lisp, I now consider the following to be identical: (list 1 2 3) '(1 2 3) However, judging from problems I face when using the quoted form in both Clojure and Emacs Lisp, they are not the same. Can you tell me what the difference is? 回答1: The primary difference is that quote prevents evaluation of the elements, whereas list does not: user=> '(1 2 (+ 1 2)) (1 2 (+ 1 2)) user=> (list 1 2 (+ 1 2)) (1 2 3) For this reason (among others), it is idiomatic

Running SICP Pattern Matching Rule Based Substitution Code

蓝咒 提交于 2019-12-18 11:53:24
问题 I have found the code from this lesson online (http://groups.csail.mit.edu/mac/ftpdir/6.001-fall91/ps4/matcher-from-lecture.scm), and I am having a heck of a time trying to debug it. The code looks pretty comparable to what Sussman has written: ;;; Scheme code from the Pattern Matcher lecture ;; Pattern Matching and Simplification (define (match pattern expression dictionary) (cond ((eq? dictionary 'failed) 'failed) ((atom? pattern) (if (atom? expression) (if (eq? pattern expression)

Reload .emacs for all active buffers

和自甴很熟 提交于 2019-12-18 11:52:50
问题 A question already has been asked how to reload a .emacs file after changing it. The proposed solutions were to use M-x load-file or M-x eval-region RET on the changed region. Neither of these solutions affect other open buffers for me. Is there a way to reload the .emacs file for all open buffers? I should also note that the M-x load-file does not have the desired effect for reasons outlined in the comments to that answer. 回答1: Your .emacs file is a global configuration that gets evaluated

Why Clojure over other JVM Lisps: Kawa, Armed Bear or SISC?

守給你的承諾、 提交于 2019-12-18 10:09:08
问题 The JVM already had three Lisps before Clojure arrived on the scene: Kawa, Armed Bear and SISC. What gap does Clojure fill that was left by those Lisps? 回答1: Kawa, ABCL, and SISC are reimplementations of existing languages that are quite long in the tooth. They are excellent if for some reason you want to use standard Scheme or standard Common Lisp on the JVM. Clojure is a new language. It doesn't fill a gap . It adds entirely new possibilities. It favors a purely functional approach- Scheme

Lazy Evaluation vs Macros

依然范特西╮ 提交于 2019-12-18 10:05:22
问题 I'm used to lazy evaluation from Haskell, and find myself getting irritated with eager-by-default languages now that I've used lazy evaluation properly. This is actually quite damaging, as the other languages I use mainly make lazily evaluating stuff very awkward, normally involving the rolling out of custom iterators and so forth. So just by acquiring some knowledge, I've actually made myself less productive in my original languages. Sigh. But I hear that AST macros offer another clean way

How does Lisp let you redefine the language itself?

半世苍凉 提交于 2019-12-18 10:04:30
问题 I've heard that Lisp lets you redefine the language itself, and I have tried to research it, but there is no clear explanation anywhere. Does anyone have a simple example? 回答1: Lisp users refer to Lisp as the programmable programming language . It is used for symbolic computing - computing with symbols. Macros are only one way to exploit the symbolic computing paradigm. The broader vision is that Lisp provides easy ways to describe symbolic expressions: mathematical terms, logic expressions,

How to live with Emacs Lisp dynamic scoping?

我怕爱的太早我们不能终老 提交于 2019-12-18 10:03:57
问题 I've learned Clojure previously and really like the language. I also love Emacs and have hacked some simple stuff with Emacs Lisp. There is one thing which prevents me mentally from doing anything more substantial with Elisp though. It's the concept of dynamic scoping. I'm just scared of it since it's so alien to me and smells like semi-global variables. So with variable declarations I don't know which things are safe to do and which are dangerous. From what I've understood, variables set

Which Lisp should I learn? [closed]

南楼画角 提交于 2019-12-18 09:56:49
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Which Lisp (dialect) should I learn, and why? The fragmentation between CL and Scheme slows uptake (at least for me!). So, give me the

Examples of excellent Common Lisp code?

梦想与她 提交于 2019-12-18 09:54:18
问题 I've learned enough Common Lisp to be able to muddle my way through writing an application. I've read Seibel's Practical Common Lisp What libraries or programs should I be reading to understand the idioms, the Tao, of Common Lisp? 回答1: CL-PPCRE is often cited as a good example, for good reason. Actually, probably any of Edi Weitz's libraries will make good reading, but CL-PPCRE is particularly clever and it's a useful and impressive library. Beyond that a lot of CL implementations are written