lisp

How do you debug Clojure in NetBeans IDE?

I have a main function but NetBeans needs a main class in order for stepping. How do you guys debug Clojure in NetBeans? ...

Using VB for Artificial Intelligence

Do you think VB is a good language for AI? I originally did AI using mainly Lisp and C/C++ when performance was needed, but recently have been doing some VB programming. VB has the following advantages: 1. Good debugger (essential!) 2. Good inspector (watch facility) 3. Easy syntax (Intellisense comparable to structure editors of late 8...

Can I use Common Lisp for SICP or is Scheme the only option?

Also, even if I can use Common Lisp, should I? Is Scheme better? ...

What is the difference between procedure and #'procedure in Lisp/Clojure?

What is the difference between the evaluation of double and #'double in Clojure/Lisp? 1:2 user=> double #<core$double__4077 clojure.core$double__4077@1acd47> 1:3 user=> #'double #'clojure.core/double ...

What is the rationale behind using def and defn instead of just define?

In Scheme, we just had define for all the definition, why does Clojure and Lisp use different keywords for different declarations? ...

Which Function is the best in terms of Stack Usage Efficiency and Time.

I wrote 3 functions that count the number of times an-element appears in a-list. I tried various inputs and profiled it but I still dont know which function is the best in terms of stack usage efficiency and time efficiency. Please Help me out. ;; Using an accumulator (defn count-instances1 [a-list an-element] (letfn [(cou...

Recommendations for a lisp setup on Mac OS X (any dialect)?

What is your Mac OS X (Intel) based lisp setup (of any dialect), how do you like it, and how painful was it to set up? I'm looking for a versatile lisp that is easy to set up, but if you feel strongly about investing more effort, or even money, I would like to hear why you think it's worth it. I am currently using newLisp, which was a b...

How do I go about splitting Lisp code into multiple source files?

Right now, everything I do manages to fit in a single source file, and a surprisingly small one at that. How do you decide how much and what to split off into separate files? With Java, it's easy to decide what goes in one file (the decision is made for you already), but in Lisp I find I write many small functions that build on one ano...

Lisp: CHAR is neither declared nor bound

I have decided to learn (Common) Lisp a few days ago and I realize that this is quite a newbie question and it is probably extremely trivial to someone with at least a bit of experience. So basically what happens is that I load up Emacs + Slime (via Lisp in a Box) and write my program (included below): (defun last-char (s) "Get last ch...

Good resources on using functional programming in game development?

I'm quite new to that functional programming paradigm, but so far I like it. Since I'm into game development, I want to try it out in writing some games in purely functional programming style. I don't mind the language - be it Erlang, Haskell, Lisp, or even Ruby (I found out it supports functional programming traits). Well, it is obviou...

How to embed a common lisp interpreter into a gui application

I want to know how to embed a lisp interpreter into a gui application, i.e. something like what pyshell does for Python. ...

Which is better?: (reduce + ...) or (apply + ...) ?

Should I use (apply + (filter prime? (range 1 20))) or (reduce + (filter prime? (range 1 20))) Edit: This is the source for prime in clojure from optimizing toolkit. (defn prime? [n] (cond (or (= n 2) (= n 3)) true (or (divisible? n 2) (< n 2)) false :else (let [sqrt-n (Math/...

Can you show me how to rewrite functions in lisp?

Consider this javascript: function addX(n) { return 3 + n; } alert(addX(6)); //alerts 9 eval('var newFunc = ' + addX.toString().replace("3", "5") + ';'); alert(newFunc(10)); //alert 15 Please ignore the fact that it's of dubious use and methodology, dangerous, difficult to follow in a large codebase, and so on. It lets you modify t...

can I use two different lisp+slime/swanks from the same emacs?

can I use common lisp and Clojure from within emacs at the same time? I would like to have each lisp-REPL in its own buffer, and If i did this how could I controll which buffer sent its data to which lisp? ...

What features of Lisp are present in Ruby?

I've read that Ruby has inherited many features from Lisp. What features does Ruby have that likely have a Lisp heritage? ...

Can a compiled language be homoiconic?

By definition the word homoiconic means: Same representation of code and data In LISP this means that you could have a quoted list and evaluate it, so (car list) would be the function and (cdr list) the arguments. This can either happen at compile- or at run-time, however it requires an interpreter. Is it possible that compiled l...

Can all language constructs be first-class in languages with offside-rules?

In LISP-like languages all language constructs are first-class citizens. Consider the following example in Dylan: let x = if (c) foo(); else bar(); end; and in LISP: (setf x (if c (foo) (bar))) In Python you would have to write: if c: x = foo(); else: x = bar(); Because Python desting...

Help in designing a small Unit Test Macro in Clojure

I have a small unit test macro (defmacro is [expr value] `(if (= ~expr ~value) 'yes (println "Expected " ~value "In" ~expr "But Evaluated to" ~expr))) How do I correctly write the error message? Right now it gives Clojure 1.0.0- 1:1 user=> (is (+ 2 2) 4) user/yes 1:2 user=> (is (+ 2 2) 5) Expected ...

Variable references in lisp

Another newbie (Common) LISP question: Basically in most programming languages there's a mean for functions to receive references to variables instead of just values, that is, passing by reference instead of passing by value. Let's say, for the sake of simplicity, I want to write a LISP function that receives a variable and increases th...

Emacs exercises to become more comfortable and familiar with the editor itself as well as Lisp?

There's a great project called the Ruby Koans, it's a series of tasks to exercise yourself in the Ruby language, stepping you through the standard library using the Ruby Unit Testing suite as a learning tool. It's a great project. I'd love to see something similar for Emacs. Can anyone recommend any Lisp exercises to be done inside ...