lisp

Replace an item in a list in Common Lisp?

I have a list of things (I'll call it L), an index(N) and a new thing(T). If I want to replace the thing in L at N with T, what is the best way to do this? Should I get the sublist up to N and from N to the end of the list and then glue together a new list from the first part, T, and the last part using list? Or is there a better way to ...

Lisp in the real world

I have experimented with Lisp (actually Scheme) and found it to be a very beautiful language that I am interested in learning more about. However, it appears that Lisp is never used serious projects, and I haven't seen it listed as a desired skill on any job posting. I am interested in hearing from anyone who has used Lisp or seen it u...

Executing code stored as a list

After understanding (quote), I'm curious as to how one might cause the statement to execute. My first thought was (defvar x '(+ 2 21)) `(,@x) but that just evaluates to (+ 2 21), or the contents of x. How would one run code that was placed in a list? ...

How do I get a terminal program to honour cursor keys?

I'm using ccl/openmcl on Mac OS X. (latest versions of both). When the lisp prompt is displayed, using the cursor keys to navigate the current line results in escape codes, rather than movement, eg: Welcome to Clozure Common Lisp Version 1.2-r9226-RC1 (DarwinX8664)! ? (^[[D Here I've pressed the ( key, and then the left cursor key. ...

Apache + mod_lisp + clisp

How to to configure apache + mod_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks. Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to it with SLIME, but then when ...

Is it possible to have an alias for the function name in lisp?

...just like packages do. I use Emacs (maybe, it can offer some kind of solution). For example (defun the-very-very-long-but-good-name () ...) is not to useful later in code. But the name like Fn-15 or the first letters abbreviation is not useful too. Is it possible either to have an alias like for packages or to access the documentati...

Are there documented, organized collections of libraries for Common Lisp?

I am a college student at a school that teaches mainly in Java. One of the strong points of Java, which I quite enjoy, is the large collection of libraries. What makes these libraries especially useful is the extensive documentation and organization presented via JavaDoc. Are there any library collections for Common Lisp which also have ...

How can I simulate macros in JavaScript?

I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using eval(), but as he said, would be quite costly. They don't really have to be very fancy. I just want to do simple stuff with them. And it shouldn't ...

Function pointers, Closures, and Lambda

I am just now learning about function pointers and as I was readying the K&R chapter on the subject the first thing that hit me was, "Hey, this is kinda like a closure." I knew this assumption is fundamentally wrong somehow and after a search online wasn't really to find any analysis of this comparison. So why are C style function point...

centering text in common lisp

I have a string that I would like to print . Is it possible to center it when printing ? ...

Creating a lambda from an s-expression

I have an s-expression bound to a variable in Common Lisp: (defvar x '(+ a 2)) Now I want to create a function that when called, evaluates the expression in the scope in which it was defined. I've tried this: (let ((a 4)) (lambda () (eval x))) and (let ((a 4)) (eval `(lambda () ,x))) But both of these create a problem: EVAL...

Can someone help explain this scheme procedure

question: ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) this was #1 on the midterm, i put "81 9" he thought i forgot to cross one out lawl, so i cross out 81, and he goes aww. Anyways, i dont understand why its 81. I understand why (lambda (x) (* x x)) (* 3 3) = 81, but the first lambda i dont understand what the x and y values a...

How to write this Lisp / Scheme code?

A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number. ...

Lisp introspection? when a function is called and when it exits

With common lisp and I am assuming the introspection properties. How can I add code to common lisp code that will tell me when a function is called and when has finished executing. I want to take any lisp code and this particular modification to the code. I figure with lisp's AST analysis, this should be possible. ...

Best Common Lisp IDE

I've used Slime within Emacs as my primary development environment for Common Lisp (or Aquamacs on OS X), but are there other compelling choices out there? I've heard about Lispworks, but is that [or something else] worth looking at? Or does anyone have tips to getting the most out of Emacs (e.g., hooking it up to the hyperspec for easy ...

What is the best way to do GUIs in Clojure?

What is the best way to do GUIs in Clojure? Is there an example of some functional Swing or SWT wrapper? Or some integration with JavaFX declarative GUI description which could be easily wrapped to s-expressions using some macrology? Any tutorials? ...

Which one is more likely to succeed: clojure or arc?

Which one of the following new lisp implementations is more likely to gain the momentum and more mainstream acceptance, arc by Paul Graham or clojure by Rich hickey? They both launched at the same time, but seems there is more community interest in clojure so far, from both lisp and java folks. ...

Cross-compiling with SBCL

I have SBCL running on a Ubuntu machine. I want to write a little program that I want to give to a friend who has only Windows running. What is the quickest way to cross-compile it on my machine into a "standalone" windows program (i.e. the usual runtime+core combination)? ...

Which language would you use for the self-study of SICP?

I've caught the bug to learn functional programming for real. So my next self-study project is to work through the Structure and Interpretation of Computer Programs. Unfortunately, I've never learned Lisp, as I was not a CS major in college. While SICP does not emphasize the tools for programming, doing the exercises entails picking a ...

What are some things that you've used Scheme macros for?

Many examples of macros seem to be about hiding lambdas, e.g. with-open-file in CL. I'm looking for some more exotic uses of macros, particularly in PLT Scheme. I'd like to get a feel for when to consider using a macro vs. using functions. ...