lisp

How does Lisp let you redefine the language itself?

 ̄綄美尐妖づ 提交于 2019-11-29 19:40:02
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? 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, iteration statements, rules, constraint descriptions and more. Macros (transformations of Lisp source forms)

Stack overflow from recursive function call in Lisp

北战南征 提交于 2019-11-29 19:29:31
问题 I am learning Lisp from the book "The Land of Lisp" by Conrad Barski. Now I have hit my first stumbling block, where the author says: Calling yourself in this way is not only allowed in Lisp, but is often strongly encouraged after showing the following example function to count the items in a list: (defun my-length (list) (if list (1+ (my-length (cdr list))) 0)) When I call this function my-length with a list containing a million items, I get a stack overflow error. So either you never expect

How to change emacs config in Lisp In A Box

橙三吉。 提交于 2019-11-29 19:07:01
问题 I have been a programmer for a decade now, but I believe this is the first time I've ever asked a question on a forum. I just can't figure this out and can't find the answer already online. I am trying to turn on CUA mode so that emacs is more bearable for a windows user (normal copy paste functions). I am running Windows 7 and installed emacs through the Lisp In A Box package. I understand that I need to add a line to my .emacs file or init.el file. I'm not sure which, but I can't find

Is it feasible to do (serious) web development in Lisp? [closed]

霸气de小男生 提交于 2019-11-29 19:03:01
It obviously is possible to write almost any kind of application in almost any programming language, especially in such a powerful one as Lisp (be it Scheme or Common Lisp). But is it practical to use it for web development? If so, what should be a good starting point? Where can be found the proper resources (tools, libraries, documentation, best practices, examples, etc.) for a project of this nature? Yes, web development is one of Common Lisp's strengths today. As a web server, use Hunchentoot , formerly known as tbnl, by Dr. Edmund Weitz. You can run it as a back-end to Apache using mod

Editing programs “while they are running”? Why?

a 夏天 提交于 2019-11-29 18:56:30
I've been getting more into Lisp and Lispy languages lately, and I'm finding them quite powerful. One thing I've been reading all over the net is that a benefit of writing in Lisp, Clojure, etc, is that you can edit your program "while it's running". Perhaps I'm missing something, but what is the point? Sure, it might save a few seconds, but is that all? Whenever I make a change to my program I just stop it then start it again, and that has been working fine for decades. There must be a reason other than just saving time -- what is it? Can someone give me a good case study that will make me

Examples of excellent Common Lisp code?

↘锁芯ラ 提交于 2019-11-29 18:45:54
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? Tagore Smith 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 mostly in CL. It can be pretty productive to pick some part of CL that's usually implemented

How to implement continuations?

前提是你 提交于 2019-11-29 18:45:05
I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution is hardly ideal. What is the simplest way to implement continuations for Scheme in C? I remember reading an article that may be of help to you: Cheney on the M.T.A. :-) Some implementations of Scheme I know of, such as SISC , allocate their call frames on the heap. @ollie: You

Using Vim for Lisp development

别来无恙 提交于 2019-11-29 18:42:00
I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome. Please don't say "use emacs" as I've already ramped up on Vim and I'm really enjoying it as an editor. Limp aims to be a fully featured Common Lisp IDE for Vim. It defaults to SBCL, but can be changed to support most other implementations by replacing "sbcl" for your favourite lisp, in the file /usr/local/limp

elisp functions as parameters and as return value

柔情痞子 提交于 2019-11-29 18:27:08
问题 I have the following code (defun avg-damp(f) #'(lambda(x) (/ (+ (funcall f x) x) 2.0))) A call (funcall (avg-damp #'(lambda(v) (* v v))) 10) returns 55.0 (the correct value) in SBCL but crashes with the following stack in emacs lisp Debugger entered--Lisp error: (void-variable f) (funcall f x) (+ (funcall f x) x) (/ (+ (funcall f x) x) 2.0) (lambda (x) (/ (+ ... x) 2.0))(10) funcall((lambda (x) (/ (+ ... x) 2.0)) 10) eval((funcall (avg-damp (function ...)) 10)) eval-last-sexp-1(nil) eval-last

In Elisp, how to get path string with slash properly inserted?

孤者浪人 提交于 2019-11-29 18:23:15
问题 I am manually constructing path strings in Elisp by concatenating partial paths and directory names. Unfortunately sometimes the paths end with slash, sometimes not. Therefore, I need to insert slash before concatenating a directory name when necessary but not otherwise. What's a good way to do this? 回答1: (file-name-as-directory dir) will return directory path dir with a trailing slash, adding one if necessary, and not otherwise. If you had your sequence of partial paths in a list, you could