lisp

In Emacs, what does this error mean? “Warning: cl package required at runtime”

こ雲淡風輕ζ 提交于 2019-12-03 03:31:12
问题 I am byte-compiling a module. It gives me this warning: Warning: cl package required at runtime Why is this a warning? I am well aware that I am using the cl package. In fact there is a (require 'cl) statement in the module. Is there something wrong with using the cl stuff? If so, is there a list of published workarounds? The main things I use are mapcan and delete-duplicates . 回答1: The reason of this warning is a GNU policy which does not want a package cl to be used in Elisp. But it would

How to use packages installed by quicklisp?

江枫思渺然 提交于 2019-12-03 03:24:21
I've installed the CL-PNG package using quicklisp. (ql:quicklisp 'png) Now I want to define my own package which depends on the CL-PNG package. Like so: (defpackage :FOO (:use :CL :PNG) (:export :BAR)) When compiling it I get this error: The name "PNG" does not designate any package. [Condition of type SB-KERNEL:SIMPLE-PACKAGE-ERROR] It seems that I have to call (require :PNG) on the REPL before compiling my package. What do I have to do to make the CL-PNG package available for the compiler without manually call require on the REPL? UPDATE: I'm using SBCL. You confuse two separate notions: a

How do you compile macros in a Lisp compiler?

假如想象 提交于 2019-12-03 03:17:41
问题 In a Lisp interpreter, there can easily be a branch in eval that can expand a macro, and in the process of expanding it, call functions to build up the expanded expression. I've done this before using low-level macros, it's easily concieved. But, in a compiler there aren't any functions to call to build up the expanded code: The issue can be seen quite simply in the following example: (defmacro cube (n) (let ((x (gensym))) `(let ((,x ,n)) (* ,x ,x ,x)))) When the macro is expanded by an

Android without Java

蹲街弑〆低调 提交于 2019-12-03 03:13:30
问题 After doing the whole "enterprise" programming for a while, I'm seriously disillusioned by the language itself and always feel quite hampered if I have to go back to it. The project size of your average Android app isn't too intimidating and the libraries are actually quite nice regarding their coding style, but if I could avoid Java, I'd certainly do. So that's the question: Can I avoid it? While there are lots of JVM language that would be an option on desktops and servers, the Dalvik VM

How to understand clojure's lazy-seq

半世苍凉 提交于 2019-12-03 03:11:06
I'm trying to understand clojure's lazy-seq operator, and the concept of lazy evaluation in general. I know the basic idea behind the concept: Evaluation of an expression is delayed until the value is needed. In general, this is achievable in two ways: at compile time using macros or special forms; at runtime using lambda functions With lazy evaluation techniques, it is possible to construct infinite data structures that are evaluated as consumed. These infinite sequences utilizes lambdas, closures and recursion. In clojure, these infinite data structures are generated using lazy-seq and cons

What is wrong with my emacs/slime setup (compile-and-load/eval not working)?

匿名 (未验证) 提交于 2019-12-03 03:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can run emacs and start slime (with M-x slime ). At this point I get the REPL in the inferior-lisp buffer and can run lisp there. But when I open up lisp code in another buffer none of the slime-goodness works ( C-x C-e , C-c C-k etc.) and I keep seeing this in the Messages buffer (with an increasing count-number): slime-connection: Not connected. Polling "/var/folders/B9/B9B5J15dH+aNt5J5gkROEk+++TI/-Tmp-/slime.3202".. (Abort with `M-x slime-abort-connection'.) [69 times] Makes me think slime is not connecting to the correct lisp

Porting Common Lisp code to Clojure

允我心安 提交于 2019-12-03 03:03:29
问题 How practical is it to port a Common Lisp application to Clojure? To be more specific, what features exist in Common Lisp that do not exist in Clojure, and would have to be re-written? 回答1: There's a list on clojure.org of differences between Clojure and other Lisps. Some other things I've noticed using Clojure: Idiomatic Clojure leans heavily toward immutable data structures. Anywhere you see SETF in CL may have to be changed in Clojure to take full advantage. (You always have the option of

Why should I use 'apply' in Clojure?

走远了吗. 提交于 2019-12-03 03:03:17
问题 This is what Rich Hickey said in one of the blog posts but I don't understand the motivation in using apply. Please help. A big difference between Clojure and CL is that Clojure is a Lisp-1, so funcall is not needed, and apply is only used to apply a function to a runtime-defined collection of arguments. So, (apply f [i]) can be written (f i). Also, what does he mean by "Clojure is Lisp-1" and funcall is not needed? I have never programmed in CL. Thanks 回答1: You would use apply , if the

Common lisp error: “should be lambda expression”

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I just started learning Common Lisp a few days ago, and I'm trying to build a function that inserts a number into a tree. I'm getting an error, *** - SYSTEM::%EXPAND-FORM: (CONS NIL LST) should be a lambda expression From googling around, it seems like this happens when you have too many sets of parenthesis, but after looking at this for an hour or so and changing things around, I can't figure out where I could be doing this. This is the code where it's happening: (defun insert (lst probe) (cond ((null lst) (cons probe lst)) ((equal (length

Which environment, IDE or interpreter to put in practice Scheme?

拜拜、爱过 提交于 2019-12-03 02:49:47
I've been making my way through The Little Schemer and I was wondering what environment, IDE or interpreter would be best to use in order to test any of the Scheme code I jot down for myself. infinitetape Racket ( formerly Dr Scheme ) has a nice editor, several different Scheme dialects, an attempt at visual debugging, lots of libraries, and can run on most platforms. It even has some modes specifically geared around learning the language. I would highly recommend both Chicken and Gauche for scheme. PLT Scheme (DrScheme) is one of the best IDEs out there, especially for Scheme. The package you