lisp

Clojure for a lisp illiterate

I am a lifelong object-oriented programmer. My job is primarily java development, but I have experience in a number of languages. Ruby gave me my first real taste of functional programming. I loved the features Ruby borrowed from the functional paradigm such as closures and continuations. Eventually, I graduated to Scala. This has be...

Call function based off of a string in Lisp

I am passing in command line arguments to my Lisp program and they are formatted like this when they hit my main function: ("1 1 1" "dot" "2 2 2") I have a dot function (which takes two vectors as arguments) and would like to call it directly from the argument, but this isn't possible because something like (funcall (second args)...) r...

Is there such a thing as an "elisp bundle" for TextMate?

I started using Code Collector Pro to organise and save my Emacs codes, and this software requires TextMate bundles for syntax highlighting. They have a lisp bundle, but not an elisp bundle, at least not that I can see. I would think that the syntax highlighting would work under the lisp bundle, but for some reason it isn't happening. I...

Why are most S-Expression languages dynamically typed?

How come most Lisps and Schemes are dynamically typed? Does static typing not mix with some of their common features? ...

How do you construct a symbol in clojure?

I want to construct a macro that, given a symbol 'foo, creates a method called foo*. How can I concatenate 'foo and '*? ...

How do I create a macro to define two functions in clojure

The code below doesn't behave as I would expect. ; given a function name, its args and body, create 2 versions: ; i.e., (double-it foo []) should create 2 functions: foo and foo* (defmacro double-it [fname args & body] `(defn ~fname ~args ~@body) `(defn ~(symbol (str fname "*")) ~args ~@body)) The code abo...

What is the difference between 1 and '1 in Lisp?

I had never really thought about whether a symbol could be a number in Lisp, so I played around with it today: > '1 1 > (+ '1 '1) 2 > (+ '1 1) 2 > (define a '1) > (+ a 1) 2 The above code is scheme, but it seems to be roughly the same in Common Lisp and Clojure as well. Is there any difference between 1 and quoted 1? ...

emacs lisp spawning subprocesses with custom environmental variables

Basically I want to spawn a process changing its working directory. My idea was to spawn a process and set the PWD enviroment variable. There's a way to obtain something like that? (virtually I would like to change any of the environment variables for flexibility) ...

Test if a class is a subclass of another class in common lisp

How do I see if one CLOS class is a subclass of another CLOS class? ...

What can be done with CLISP

I started learning CLISP. Should I improve my self. What can be done with this programming language? What's it for. I'd appreciate your answers and comments. Thanks. ...

uses for dynamic scope?

Hi, I've been getting my hands wet with emacs lisp, and one thing that trips me up sometimes is the dynamic scope. Is there much of a future for it? Most languages I know use static scoping (or have moved to static scoping, like Python), and probably because I know it better I tend to prefer it. Are there specific applications/instances ...

How can I simply "run" lisp files

Python When I learned Python I installed it on windows with a nice gui installer and all .py files would automatically run in python, from the command line or explorer. I found this very intuitive and easy, because I could instantly make plain text files and run them. Lisp I'm starting to learn lisp and have decided (from reviews) th...

Is there any limit to recursion in lisp?

I enjoy using recursion whenever I can, it seems like a much more natural way to loop over something then actual loops. I was wondering if there is any limit to recursion in lisp? Like there is in python where it freaks out after like 1000 loops? Could you use it for say, a game loop? Testing it out now, simple counting recursive functi...

Lisp data security/validation

This is really just a conceptual question for me at this point. In Lisp, programs are data and data are programs. The REPL does exactly that - reads and then evaluates. So how does one go about getting input from the user in a secure way? Obviously it's possible - I mean viaweb - now Yahoo!Stores is pretty secure, so how is it done? ...

Any good lisp gui library?

Is there any easy to set up Common Lisp gui libraries? I've been trying to install many but I always come up with errors. The only one I got to fully work is Ltk but I hear there's problems with that, especially on windows. LispBuilder-sdl was the easiest library to install but non of the others will work? I'm really confused about this?...

running shell commands with gnu clisp

I'm trying to create a "system" command for clisp that works like this (setq result (system "pwd")) ;;now result is equal to /my/path/here I have something like this: (defun system (cmd) (ext:run-program :output :stream)) But, I am not sure how to transform a stream into a string. I've reviewed the hyperspec and google more than ...

Find all paths from root to leaves of tree in Scheme

Given a tree, I want to find the paths from the root to each leaf. So, for this tree: D / B / \ A E \ C-F-G has the following paths from root (A) to leaves (D, E, G): (A B D), (A B E), (A C F G) If I represent the tree above as (A (B D E) (C (F G))) then the function g does the trick: (define (paths tree) (cond ...

Why does using cons to create a pair of two lists produce a list and two elements?

I've started learning Scheme, for fun mostly, and because I've never used a functional language before. I chose Scheme because I wanted to read SICP for a long time. Anyway, I'm currently learning about lists, and before that I learned about cons, car and cdr. And there's an example that creates a list of lists with cons, like this : ...

Looking for good Lisp code to read

I'm currently trying to get proficient in Common Lisp and to learn some of the tricks for writing compact, clear and beautiful code in it. So, I want to know if you have any sources of good Common Lisp, preferably free and online but books are also OK. ...

check if current emacs buffer contains a string

I have a buffer open in emacs. I want a function that will return t if the current buffer contains the string, otherwise it returns nil. (defun buffer-contains-substring (string) ... ) ...