lisp

How do the various ANSI CL implementations differ?

元气小坏坏 提交于 2019-11-28 18:45:28
问题 When I started learning CL from Practical Common Lisp, as is preached in the book, I started off with Allegro CL compiler. I stopped using it, since its commerical, yet free bit didn't impress me. It needed a connection to its remote server for some licensing stuffs. I switched to 'clisp' and am using it. Now, I have been hearing about SBCL and planning to start using it as well. So, the question is: How do the various ANSI CL implementations differ? Any practical experience of using one over

How is Lisp dynamic and compiled?

最后都变了- 提交于 2019-11-28 18:37:40
I don't understand how Lisp can be compiled and dynamic. For a language to be able to manipulate and modify and generate code, isn't it a requirement to be interpreted? Is it possible for a language to be completely compiled and still be dynamic? Or am I missing something? What is Lisp doing that allows it to be both compiled and dynamic? Lisp is a wide family of language and implementations. Dynamic in the context of Lisp means that the code has a certain flexibility at runtime. It can be changed or replaced for example. This is not the same as dynamically typed . Compilation in Lisp Often

Are there any Common Lisp implementations for .Net?

谁都会走 提交于 2019-11-28 18:28:45
问题 Are there any Common Lisp implementations for .Net? 回答1: I haven't looked at it recently, but at least in the past there were some problems with fully implementing common lisp on the CLR, and I'd be a little surprised if this has changed. The issues come up with things like the handling of floats where .net/clr has a way to do it that is a) subtly incorrect b) disagrees with the ANSI standard for common lisp but c) doesn't allow any way around this. There are other similar problems. This

In Lisp, code is data. What benefit does that provide?

回眸只為那壹抹淺笑 提交于 2019-11-28 18:18:23
In Lisp, any program's code is actually a valid data structure. For example, this adds one and two together, but it's also a list of three items. (+ 1 2) What benefit does that provide? What does that enable you to do that's impossible and/or less elegant in other languages? To make things a little clearer with respect to code representation, consider that in every language code is data: all you need is strings. (And perhaps a few file operations.) Contemplating how that helps you to mimic the Lisp benefits of having a macro system is a good way for enlightenment. Even better if you try to

How to make a Clojure function take a variable number of parameters?

折月煮酒 提交于 2019-11-28 18:04:50
I'm learning Clojure and I'm trying to define a function that take a variable number of parameters (a variadic function) and sum them up (yep, just like the + procedure). However, I don´t know how to implement such function Everything I can do is: (defn sum [n1, n2] (+ n1 n2)) Of course this function takes two parameteres and two parameters only. Please teach me how to make it accept (and process) an undefined number of parameters. In general, non-commutative case you can use apply : (defn sum [& args] (apply + args)) Since addition is commutative, something like this should work too: (defn

Performance difference between functions and pattern matching in Mathematica

随声附和 提交于 2019-11-28 17:56:43
So Mathematica is different from other dialects of lisp because it blurs the lines between functions and macros. In Mathematica if a user wanted to write a mathematical function they would likely use pattern matching like f[x_]:= x*x instead of f=Function[{x},x*x] though both would return the same result when called with f[x] . My understanding is that the first approach is something equivalent to a lisp macro and in my experience is favored because of the more concise syntax. So I have two questions, is there a performance difference between executing functions versus the pattern matching

Understanding how to implement once-only lisp macro

人走茶凉 提交于 2019-11-28 17:43:10
问题 In Peter Seibel's book "Practical Common Lisp", we can find the definition of the very complicated macro once-only (see the bottom of page http://www.gigamonkeys.com/book/macros-defining-your-own.html). I'm reading this macro definition for the 10th times in last 3 weeks and cannot understand how it works. :( Worse, I cannot develop this macro on my own, even though I understand its purpose and how to use it. I'm especially interested in systematic "derivation" of this notoriously hard macro,

What does it mean that “Lisp can be written in itself?”

帅比萌擦擦* 提交于 2019-11-28 17:39:10
问题 Paul Graham wrote that "The unusual thing about Lisp-- in fact, the defining quality of Lisp-- is that it can be written in itself." But that doesn't seem the least bit unusual or definitive to me. ISTM that a programming language is defined by two things: Its compiler or interpreter, which defines the syntax and the semantics for the language by fiat, and its standard library, which defines to a large degree the idioms and techniques that skilled users will use when writing code in the

Are there any High Level, easy to install GUI libraries for Common Lisp? [closed]

前提是你 提交于 2019-11-28 17:12:57
Are there any good, cross platform (SBCL and CLISP at the very least) easy to install GUI libraries? Ltk is quite popular, very portable, and reasonably well documented through the Tk docs. Installation on SBCL is as easy as saying: (require :asdf-install) (asdf-install:install :ltk) There's also Cells-Gtk , which is reported to be quite usable but may have a slightly steeper learning curve because of its reliance on Cells. EDIT: Note that ASDF-INSTALL is integrated this well with SBCL only . Installing libraries from within other Lisp implementations may prove harder. (Personally, I always

Dr Racket problems with SICP

耗尽温柔 提交于 2019-11-28 16:51:48
I'm working through SICP. Currently, in the first chapter, I'm having problems getting Racket to let me redefine "primitives". For instance, I was under the impression that I should be able to arbitrarily do (define + 5) and that would be fine, or redefine the sqrt procedure. Instead, I get this: define-values: cannot change constant variable: + I have the language currently set to R5RS, which I was under the impression would take care of the compatibility issues with SICP. Eli Barzilay Even if possible, such redefinitions are not something that you should do without really understanding how