lisp

HTDP Exercise 6.6.1 - What does it mean by template functions?

Hi all I'm looking at Scheme at the moment for a bit of fun, using the "how do design programs" book. All pretty easy so far but ran into this odd wording in exercise 6.6.1 where I'm not clear what is intended: Develop the template fun-for-circle, which outlines a function that consumes circles. Its result is undetermined. One pos...

Concise Lisp code to apply a list of functions all to the same argument(s) and get a list of the return values?

Suppose I have a single element, and I have a list of predicates (functions). I want to apply each of these predicates to the single element and get a corresponding list of return values. I know that map and friends can apply a single function to each a list of arguments, but is there any concise syntax to apply many functions to a singl...

Error starting sbcl under slime on Vista

I'm having trouble getting SBCL to start under slime. I've messed things up and I don't know how to recover. This was working fine until I... Had a problem loading a package via asdf. At which point I started debugging the asdf.lisp provided with SBCL to see what was going wrong. The sole change I made was to put a (break) in which ...

If Lisp is the perfect language, why are there so many?

Possible Duplicate: Why is the Lisp community so fragmented? Despite the snarky tone, I'm actually looking for a serious answer. I know the textbook response: Lisp is a model for computation, not a "language" per se. Still, why exactly are there so many different dialects of Lisp? Presumably it isn't because of surface synt...

continuously execute an emacs lisp function

Is there a way to trigger the execution of an emacs lisp function other than M-x myfun? I would like to have the function re-called every time the buffer is changed. Background: I have a table of numbers with some mistakes. The table has column totals and other features which can be used to identify the mistakes. My elisp function highl...

Possible "boat loads" question

You know the river-crossing problems. Here is a sort description: Once upon a time, three cannibals were guiding three missionaries through a jungle. They were on their way to the nearest mission station. After some time, they arrived at a wide river, filled with deadly snakes and fish. There was no way to cross the river without a b...

How to run Clozure CL (Lisp) from a shell script on OS X?

I tried the following: $ cat args.sh \#! /Applications/ccl/dx86cl64 (format t "~&~S~&" *args*) $ ./args.sh Couldn't load lisp heap image from ./args.sh I can run lisp fine directly: $ /Applications/ccl/dx86cl64 Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8664)! ? Is it possible to write a shell script to run lis...

How to find the mean/average of a sound in Nyquist

I'm trying to write a simple measurement plug-in for Audacity and it's about as much fun as pounding rocks against my skull. All I want to do is take a chunk of audio and find the average of all the samples (the chunk's DC offset) so that I can present it as a number to the user, and so that I can subtract the DC offset from the samples...

How to map clojure code to and from JSON?

I have a crazy idea, which involves putting some clojure code into CouchDB and writing views that query it. I don't want to store the clojure code as plain text, because then I would have to worry about parsing it in the views. Formatting and comments don't need to be preserved, but the code should be able to go in and out of the databas...

Is it possible to implement coroutines using only LISP primitives?

First, I'm a LISP newbie. What I want to get is a cooperative micro-threading feature. And this can be gained with coroutine. As I know, Scheme supports coroutines via continuations. However, not all Scheme implementation may have continuations. If so, can I add a continuation feature with only LISP primitives? ...

Lisp as an internal Ruby DSL?

I've been able to find: a) Lisp interpreters written Ruby (i.e., an external DSL) http://onestepback.org/index.cgi/Tech/Ruby/LispInRuby.red b) Prolog as a Ruby DSL http://www.kdedevelopers.org/node/2369 c) Discussion of Ruby "as" a Lisp http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp But oddly, I can'...

Idiomatic way to pass a method name for evaluation in Clojure?

I'm passing the name of a function for use in another method. (defn mapper [m function] (cond (= '() m) '() true (cons (function (first m)) (mapper (rest m) function)))) (println (map_ '((blue red)(green red)(white red)) #'first)) Is there a more idiomatic way to do this in clojure? ...

How to implement a Lisp macro system?

I've implemented my own Lisp on top of node.js, I can run s-expressions like this: (assert (= 3 (+ 1 2))) (def even? (fn [n] (= 0 (bit-and n 1)))) (assert (even? 4)) (assert (= false (even? 5))) Now I would like to add macros - the defmacro function - but this is where I'm stuck. I'm wondering how macro systems are implemented in o...

Scheme and Clojure don't have the atom type predicate - is this by design?

Common LISP and Emacs LISP have the atom type predicate. Scheme and Clojure don't have it. http://hyperpolyglot.wikidot.com/lisp Is there a design reason for this - or is it just not an essential function to include in the API? ...

Can you implement any pure LISP function using the ten primitives? (ie no type predicates)

This site makes the following claim: http://hyperpolyglot.wikidot.com/lisp#ten-primitives McCarthy introduced the ten primitives of lisp in 1960. All other pure lisp functions (i.e. all functions which don't do I/O or interact with the environment) can be implemented with these primitives. Thus, when implementing or porting lisp, the...

Implementing Micro Manual LISP

I am implementing an interpreter for the LISP defined in, http://www.scribd.com/vacuum?url=http://www.ee.ryerson.ca/~elf/pub/misc/micromanualLISP.pdf My problem is the paper states that a LIST is, 4. (LIST e1 ... en) is defined for each n to be (CONS e1 (CONS ... (CONS en NIL))). So when a read in a list from the user such as, ...

Proxies / delegates in Scala

I've seen several Scala questions recently (e.g. here, here, and here) that called for the use of proxies, and it's come up more than once in my own work. The Scala library has a number of proxy traits (14, if I counted correctly). Proxy classes/traits usually contain lots of boilerplate: class FooProxy(val self: Foo) extends Foo { ...

with-open-file explanation in layman terms.

I'm learning CL, and I have minimal experience in other languages. Could someone explain to me in layman terms what this means, especially what "out" here represents, and how it all fits together: (defun save-db (filename) (with-open-file (out filename :direction :output :if-exists :supersede) ...

Popping an element from an association list in lisp (elisp)

I'm searching for a way to "pop" an element from an association list, in other words a "destructive" assoc: (setq alist '((a . 1) (b . 2)) (assoc-pop 'a alist) ;; -> (a . 1) ;; alist -> ((b . 2)) Are there any function in the elisp harness? What's the most elegant way to obtain a symilar functionality? (not sure about that this sort o...

Online tutorial on lisp

Any online tutorial on lisp which can teach the basics (loop, condition and etc) of this language in a short time? ...