Questions tagged [lisp]

Lisp is a family of general purpose programming languages, influenced by the lambda calculus, and with the ability to manipulate source code as a data structure.

Introduction

The name Lisp derives from "LISt Processor". It was originally created as a practical mathematical notation for computer programs. See Wikipedia for more information.

Hello World Program in Lisp

;;; Hello World in Common Lisp

(defun helloworld ()
  (print "Hello World!"))

Popular dialects

Free Lisp Programming Books

There is also a Stack Overflow chat room on Lisp.

6922 questions
5
votes
4 answers

clojure: idiomatic way of removing duplication in an "if"?

I'm very new to clojure, and I haven't done a ton of lisp previously. I have a function that contains the following: (defn chord ([scale degree num_voices] (if (keyword? degree) (take num_voices (take-nth 2 (cycle…
Paul Sanwald
  • 10,899
  • 6
  • 44
  • 59
4
votes
2 answers

Force CL-Lex to read whole word

I'm using CL-Lex to implement a lexer (as input for CL-YACC) and my language has several keywords such as "let" and "in". However, while the lexer recognizes such keywords, it does too much. When it finds words such as "init", it returns the first…
4
votes
3 answers

Confused by Lisp Quoting

I have a question concerning evaluation of lists in lisp. Why is (a) and (+ a 1) not evaluated, (defun test (a) (+ a 1)) just like (print 4) is not evaluated here (if (< 1 2) (print 3) (print 4)) but (print (+ 2 3)) is evaluated here (test (print…
Konstantin Weitz
  • 6,180
  • 8
  • 26
  • 43
4
votes
2 answers

Load another lisp file from a relative path in SBCL using CUSP (Eclipse Plugin)

How do I load another Lisp file without having to specify the full path? I tried (load /path/to/file), but it seems to work with absolute path only. I know, using Eclipse does not seems right to many Lispers. I used Emacs for my C++ programming and…
Amumu
  • 17,924
  • 31
  • 84
  • 131
4
votes
2 answers

Learn Macros in Scheme from On Lisp

I really want to learn Scheme macros. I glanced over the content of "On Lisp" and a lot of the chapters have been devoted to Lisp macros. However I do not know common lisp. Can I use it to learn Scheme Macros?
unj2
  • 52,135
  • 87
  • 247
  • 375
4
votes
3 answers

How to import maxima into sbcl

As we know, Maxima is based on common lisp. I'm writing a lisp program working in Maxima; using Maxima procedures. I press argument "maxima -p foo.lisp" to load the lisp file, and it works well. However, I'm poor at programming, so my programs have…
Yai0Phah
  • 433
  • 4
  • 14
4
votes
1 answer

How do I ask the Lisp compiler to ignore a (label-variety) function?

I've stared at Steele's Common Lisp the Language until I'm blue in the face, and still have this question. If I compile: (defun x () (labels ((y ())) 5)) (princ (x)) (terpri) this happens: home:~/clisp/experiments$ clisp -c -q x.lisp ;;…
Bill Evans at Mariposa
  • 3,590
  • 1
  • 18
  • 22
4
votes
1 answer

In vim, writing lisp/clojure code, how to properly indent bindings in let?

In vim, my bindings of the let statement are not properly indent. I get this: (let [language :clojure editor :vim] "indentation problems") I would like to have editor aligned with language, like this: (let [language :clojure …
viebel
  • 19,372
  • 10
  • 49
  • 83
4
votes
1 answer

Passing and receiving strings with SBCL FFI

I have a sophisticated library written in optimized c (library.c): #include #include "library.h" void make_fullname(char* fullname, char* name, int version) { sprintf(fullname, "%s-%d", name, version); printf("lib-name: %s\n", name); …
Andrei
  • 2,585
  • 1
  • 14
  • 17
4
votes
3 answers

In clojure, when is it useful to define several symbols with same name but different metadata?

In clojure, two symbols a and b might have the same name but different metadata. The symbols are then = but not identical?. For example: (def a (with-meta 'cool {:real-name 'unknown})) (def b (with-meta 'cool {:real-name 'undefined})) (identical? a…
viebel
  • 19,372
  • 10
  • 49
  • 83
4
votes
2 answers

What is implicit recursion?

What is implicit recursion? How is it different from explicit recursion?
StackUnderflow
  • 24,080
  • 14
  • 54
  • 77
4
votes
1 answer

Print defstruct in Lisp

I have a very simple data structure that I have defined in Lisp: ;;Data structure for a person (defstruct person (name nil) (age 0) (siblings nil :type list)) ;; Siblings is a list of person objects I then procede to instantiate a few…
Isthan
  • 99
  • 1
  • 7
4
votes
1 answer

Does the Common Lisp Object System (CLOS) support duck-typing?

I'm reading "Practical Common Lisp" and I wonder if Common Lisp supports Duck-Typing like e.g. Ruby? In Ruby it's possible to call a method on an object regardless of the class as long as it implements a method with the name and argument list that…
v_nomad
  • 65
  • 4
4
votes
0 answers

Clozure CL on Android

CCL is now working on my Android and I have some questions. I transferred Android-headers to the device and tried to run rebuild-ccl: Error: File #P"ccl:lib;systems.lisp.newest" not found. Sources needed? I ran the following…
RomanKovalev
  • 852
  • 3
  • 10
  • 29
4
votes
2 answers

Why do we need `nil`?

I do not see why we need nil [1] when to cons a sequence (so-called proper list) of items. It seems to me we can achieve the same goal by using the so-called improper list (cons-ed pairs without an ending nil) alone. Since Lisps [2] have already…
day
  • 2,292
  • 1
  • 20
  • 23
1 2 3
99
100