lisp

Emacs php-mode: Removing duplicate <?php in header-line of php files

Hi all, I use emacs php-mode.el and php-electric.el. I want to get rid of the duplicate <?php overlay that shows up at the top of any php file. The extra <?php is not actually in the file, but is a semi transparent visual overlay that emacs is adding. I've done some research, and I think changing this might involve the emacs lisp heade...

Scheme: what are the benefits of letrec?

While reading "The Seasoned Schemer" I've begun to learn about letrec. I understand what it does (can be duplicated with a Y-Combinator) but the book is using it in lieu of recurring on the already defined function operating on arguments that remain static. An example of an old function using the defined function recurring on itself (no...

Write C as s-expressions.

I want to write C in s-expressions and use compile-time macros. Does anybody know of anything that does this? It should translate the s-expressions into standard C. ...

let inside cond

Hello. I'm working with clojure and while I've dabbled with lisps before, I'm having trouble finding a clean way to nest let statements in cond statements. For example, consider the following function: (defn operate-on-list [xs] (let [[unpack vector] (first xs)] (cond [(empty? xs) 'empty unpack vector :else (op...

How to get (/ 7 2 ) => 3, do I need some sort of typecast?

When I do (/ 7 2), what should I do to get the result 3? If I do (/ 7 2.0), I get 3.5, which is as expected. ...

How can I get all possible permutations of a list with Common Lisp?

I'm trying to write a Common Lisp function that will give me all possible permutations of a list, using each element only once. For example, the list '(1 2 3) will give the output ((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1)). I already wrote something that kind of works, but it's clunky, it doesn't always work and I don't even real...

RAII in Scheme?

Is there anyway to implement Resource Acquisation is Initialization in Scheme? I know that RAII does not work well in GC-ed languages (since we have no idea whe the object is destroyed). However, Scheme has nice things like continuations, dynamic-wind, and closures -- is there a way to use some combination of this to implement RAII? If...

Anybody know how to get ahold of SAM76 source code for Linux?

resistors.org site and foxthompson.net download links are stale/broken. http://www.resistors.org/index.php/The_SAM76_programming_language Every other link I've been able to track down on the 'net (mostly in old newsgroup posts) are broken. E-mails to the respective webmasters all bounced. I have a morbid curiosity for arcane programm...

Is it possible to rewrite recursive function as macro in lisp?

I wrote this quicksort function: (defun quicksort (lst) (if (null lst) nil (let ((div (car lst)) (tail (cdr lst))) (append (quicksort (remove-if-not (lambda (x) (< x div)) tail)) (list div) (quicksort (remove-if (lambda (x) (< x div)) tail)))))) but I can't rewrite...

Why is the Lisp community so fragmented?

To begin, not only are there two main dialects of the language (Common Lisp and Scheme), but each of the dialects has many individual implementations. For example, Chicken Scheme, Bigloo, etc... each with slight differences. From a modern point of view this is strange, as languages these days tend to have definitive implementations/spe...

Learning a Lisp variant? Suggestions?

I ultimately want to learn Clojure, but I've found learning resources for Clojure to be scarce for people of little experience... I'm wondering if it would be beneficial to start with Scheme (read The Little Schemer and SICP) or some other Lisp variant. My only other programming experience is with Java and Python (which is pretty minim...

How can ecl include asdf dependencies in an executable? (take 2)

This question was asked and answered by ayrnieu at http://stackoverflow.com/questions/580083/how-can-ecl-include-asdf-dependencies-in-an-executable But the example code he linked to does not actually involve any dependencies. I've tried copying the model in the stumpwm code he refers to but I can't get it to work. He are my files. -...

Is there a typical name for a function like 'map' that operates on a list of argument lists instead of multiple lists of arguments?

(I finally posted and accepted an answer to the effect of "no, there isn't, and the question isn't actually that general".) Consider the Common Lisp function 'mapcar'. It takes a function and some lists as arguments, and calls the function with arguments pulled from the same position in each list. Do standard libraries typically have a...

Clojure Jython interop

Hi, I was wondering if anyone has tried somehow calling Jython functions from within Clojure, and how you went about doing this if so. I have not used Jython, but I would imagine the Jython interpreter can be invoked in the same way as any other java code, and Python programs can be run within it. However I wonder if it would be possi...

Check if a string is all-caps in Emacs lisp?

Hi, all. I was wondering if Emacs lisp had a built-in function for checking if a string is made entirely out of capitalized characters. Here is what I'm using right now: (setq capital-letters (string-to-list "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) (defun chars-are-capitalized (list-of-characters) "Returns true if every character in a list of ...

Minimum steps to display a table-view in Cocoa OSX

Hi I am trying to create a table-view programatically using a cocoa lisp bridge called clozure CL. Now I doubt many people are familiar with this package so I will not go into specifics of my code but I am getting some very strange errors when I try to call addSubview to add my tableView to my window. I have initialized it using InitWi...

Why isn't there a good scheme/lisp on llvm?

There is Gambit scheme, MIT scheme, PLT scheme, chicken scheme, bigloo, larceny, ...; then there are all the lisps. Yet, there's not (to my knowledge) a single popular scheme/lisp on LLVM, even though LLVM provides lots of nice things like: easier to generate code than x85 easy to make C ffi calls ... So why is it that there isn't a...

How do I stop tracing a function in clisp?

I've been tracing a function example with this call (trace example) and now I wish to stop tracing it, how can I do this? ...

Are there open source Common Lisp COM wrappers?

I have an application that is written in SBCL and is deployed as an executable on Windows. The need has arisen for it to interact with Excel via COM and another application via DDE (I know, I know). DDE is simple enough for me to have quickly wrapped what I needed in a very small, simple to maintain C library. COM, on the other hand, se...

cross-package defgeneric/defmethod in Common Lisp?

What is the right way to define a generic in package A and to provide a method for this generic in package B in CLOS? Thank you in advance! Example: (defpackage :common (:use :cl)) (in-package :common) (defgeneric compare (a b)) (defmethod compare ((a number) (b number)) (cond ((< a b) -1) ((= a b) 0) (T 1))) ...