lisp

Why is there no way to resize SRFI-4 vectors in Scheme?

I see that SRFI 4 does not mention resizing of vectors. I'm using f64vectors (for which I need fast access), and I'd like to be able to resize them quickly (similar to what realloc does in C), and not necessarily copy the whole vector. Since I didn't find any references to a "resize-f64vector" procedure, I'd like to know why it doesn't ...

Macro doesn't work in the function.

I have problems with following code: http://lisper.ru/apps/format/96 The problem is in "normalize" function, which does not work. It fails on the fifth line: (zero-p a indexes i) (defun normalize (a &optional indexes i) "Returns normalized A." (progn (format t "Data=~A ~A ~A" a indexes i) (if (zero-p a indexes i) a ;; c...

How are vector patterns used in syntax-rules?

Hi, I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit unnatural to me. I think I got the idea, except that I don't understand how one would use vector patterns in syntax-rules: (define-syntax mac (syntax-rules () ((mac #(a b c d)) (let () (display a) (newline) (display d) (...

How do I disable warnings in lisp (sbcl)

How do I disable all warnings in sbcl? The extra output is rather annoying. ...

How can I SETF an element in a tree by an accessor?

We've been using Lisp in my AI course. The assignments I've received have involved searching and generating tree-like structures. For each assignment, I've ended up writing something like: (defun initial-state () (list 0 ; score nil ; children 0 ; value 0)) ; something else and building my functions around t...

Adding an element to a list in Scheme

I'm using R5RS Scheme and I just want to implement a function that returns the intersection of two given lists, but I can't do that because I cannot add an element to a list. Here is my code. How can I fix it? I'm really a beginner in Scheme - this is my first work using Scheme. thx in advance.. (define list3 '()) (define (E7 list1 lis...

Lisp: Determine if a list contains a predicate

As part of a homework assignment in Lisp, I am to use apply or funcall on any predicates I find. My question (uncovered in the coursework) is: how do I know when I've found a predicate in my list of arguments? I've done some basic google searching and come up with nothing so far. We're allowed to use Lisp references for the assignment...

Turn off the highlight feature in the Limp

Hi all I am using the Limp in my VIM. But there is a problem, when the cursor move to a "(" or ")", it would highlight a block of code in this pair.I can not see the code clearly. Is there any way to turn off or delete this feature? Best Regards, ...

Greenspun's 10th rule in Perl?

Greenspun's Tenth Rule of Programming is a common aphorism in computer programming and especially programming language circles. It states: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. The questions are, Would you consider this...

Examples of what Lisp's macros can be used for

I've heard that Lisp's macro system is very powerful. However, I find it difficult to find some practical examples of what they can be used for; things that would be difficult to achieve without them. Can anyone give some examples? ...

Why exactly is eval evil?

I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I’ve seen the same recommendation for several programming languages, but I’ve not yet seen a list of clear arguments against the use of eval. Where can I find an account of the potential problems of using eval? For example, I know ...

Install CLSQL on Mac OS X

I have SBCL installed (via macports/darwinports) on my Intel Core 2 Duo Macbook running 10.5.8. I've installed several libraries like this: (require 'asdf) (require 'asdf-install) (asdf-install:install 'cl-who) But when I tried to install CLSQL this way ('clsql) after it downloaded, I got this: ... ; registering #<SYSTEM CLSQL-UFFI ...

Common lisp error: "should be lambda expression"

I just started learning Common Lisp a few days ago, and I'm trying to build a function that inserts a number into a tree. I'm getting an error, * - SYSTEM::%EXPAND-FORM: (CONS NIL LST) should be a lambda expression From googling around, it seems like this happens when you have too many sets of parenthesis, but after looking at this...

Which classic Lisp books are going to be ported to Clojure?

Which classic Lisp books will be ported to Clojure? Does this involve the complete text or only the code files? ...

Emacs without Lisp

Should I learn to use Emacs with no intention to learn Lisp, if my other option is to get familiar with vi? ...

Examples of excellent Common Lisp code?

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? ...

how to create a list in LISP and accepting elements of list from user?

how to create a list in LISP and accepting elements of list from user? ...

F# equivalent to Eval

Is there an F# equivalent to eval? My intent is to have my app load a small code sample from a file and essentially let file = "c:\mysample" let sample = loadFromFile file let results = eval(sample) I am new to F# and trying to figure out some of the limitations before I apply it to a project. Thank you ...

lisp: consolidate a list-of-lists into a single list?

Still working on lisp recipes and idioms. I have a list like this: ((a b c) (d e f) nil (g h)) I'd like to consolidate that to one list, (a b c d e f g h) Seems like there oughta be a one-liner for that. ...

Writing an Eval Procedure in Scheme?

My problem isn't with the built-in eval procedure but how to create a simplistic version of it. Just for starters I would like to be able to take this in '(+ 1 2) and have it evaluate the expression + where the quote usually takes off the evaluation. I have been thinking about this and found a couple things that might be useful: Unquote...