Questions tagged [lisp]
Lisp is a (family of) general purpose functional programming language(s), based on the lambda calculus, and with the ability to manipulate source code as a data structure.
112 questions
1
vote
2
answers
358
views
Scheme's define in Common Lisp
In Common Lisp, we have to use the let form to declare a new lexically-scoped variable. This means that the code either looks like that written in C89 (all variables declared on top of scope), or ...
4
votes
1
answer
554
views
Best Practice - Where to declare variables in Common Lisp?
Generally in procedural/imperative languages, it's best practice to place variable declarations as close to usage as possible.
This seems a little hazy in lisp, considering more code is used if there ...
4
votes
1
answer
339
views
Lisp: circular structure printing through user-defined print methods: what are the requirements?
In a Lisp dialect, I've implemented ANSI-CL-like support for printing objects such that their circular and shared structure is encoded. This is enabled by the special variable *print-circle*. ...
4
votes
3
answers
655
views
Can Lisp keywords be protected?
Why aren't lisp keywords protected?
For example,
(define a 3)
(define define +) #makes define useless
(define a 1) #outputs 4, instead of assigning 1 to a.
Is this flexibility so important?
Or even ...
8
votes
2
answers
3k
views
In which order should lisp functions be defined?
In which order should code in a single lisp file be organised? Is there any common style guideline that allows other lisp programmers to easily understand code?
Googling for lisp style guideline ...
1
vote
1
answer
518
views
Scheme : Lambda inside quoted list is unbound
I'm programming a small lisp/scheme interpreter and I came across the following situation :
When a quoted list contains lambdas, they are not parsed as lambdas.
Here is a sample code (live on repl....
12
votes
1
answer
2k
views
What practical problem results from lack of hygienic macros in Clojure?
I've heard that Clojure macros are easier to write but not as reliable as Racket's hygienic macros. My question has 2 parts:
How does gensym differ from hygienic macros?
What do Racket macros provide ...
1
vote
1
answer
986
views
How to avoid loop in a dept-search in a graph?
I must implement , in Lisp , a depth-search algorithm in an implict graph (namely a graph where I have the starting node, the goal node, and the successor function ,f, that give a node create his ...
6
votes
1
answer
3k
views
`values` vs `list` for returning multiple values from Lisp form
What's the difference between using (values …) versus (list …) (or literally '(one two three …)) to return multiple values from a lambda (or other implicit progn)? Does it create some special glue to ...
7
votes
1
answer
2k
views
How do you make decorators as powerful as macros?
Quick background: I am designing a Pythonic language that I want to be as powerful as Lisp while remaining easy to use. And by "powerful", I mean "flexible and expressive".
I've just been introduced ...
1
vote
1
answer
544
views
What is the most efficient method in converting AutoLISP legacy code to C#?
I am engaged in a project that works mainly in AutoCAD to design and manufacture prefabricated building components such as roofing trusses. One of our goals is to redesign a program that was written ...
5
votes
1
answer
2k
views
What features does MIT-Scheme have that make it ideal for SICP?
I've been thinking about trying to get through the SICP again, this time well-armed with a better idea of what the SICP is meant to accomplish, and being older and wiser than my first attempt back in ...
7
votes
1
answer
3k
views
What's the difference between lists constructed by quote and those constructed by cons in Scheme?
(define ls1 '((1 . 2) 1 . 2))
(set-car! (car ls1) 6)
ls1
(define ls2 (cons '(1 . 2) '(1 . 2)))
(set-car! (car ls2) 6)
ls2
After set-car!ing, ls1 will be ((6 . 2) 1 . 2) and ls2 ((6 . 2) 6 . 2). It ...
4
votes
1
answer
2k
views
How can Lisp produce an iterative process from a recursive procedure?
I am starting to learn Lisp, using the SICP book. The authors mention that a procedure (i.e. function) can be recursive or iterative. Additionally, the process those procedures will generate will also ...
3
votes
3
answers
2k
views
Lisp/Clojure: Removing unnecessary parentheses through conventions
I am fascinated to Lisp as it is simple yet powerful. I am just a beginner and I know there have been lots of discussions on removing parentheses from Lisp and its dialects. Yet I request Lisp ninja's ...
2
votes
3
answers
1k
views
How does a chess engine decide what move to make?
I'm writing a simple chess engine in LISP. I actually know how the engine decide the move, it evaluates and reads some opening books. But that's not what i mean. This is my design.
57 58 59 60 61 62 ...
6
votes
1
answer
705
views
The Lisp in Gnu
Since the GNU project is celebrating its anniversary, and the initial announcement for GNU is linked to (http://www.gnu.org/gnu/initial-announcement.en.html) all over the place, I reread it and I ...
17
votes
5
answers
23k
views
XSLT and possible alternatives [closed]
I had a look at XSLT for transforming one XML file into another one (HTML, etc.). Now while I see that there are benefits to XSLT (being a standardized and used tool) I am reluctant for a couple of ...
34
votes
6
answers
7k
views
Does Lisp still have any special feature which has NOT been adopted by other programming languages?
Does Lisp still have any special feature which has NOT been adopted by other programming languages?
By Lisp, I mean all the Lisp programming languages as a whole. I've been told how amazing Lisp is ...
12
votes
3
answers
2k
views
Is it possible to compile a higher level language to readable C++? [closed]
C++ is a great language in many ways, but some things in particular are cumbersome to write without an IDE. As a VIM user, it would be very interesting if I had access to a higher level language which ...
4
votes
2
answers
1k
views
Is it technically possible to write a JS interpreter using Lisp macro readers, in the browser?
Using macros readers, it's possible to interpret JavaScript, and have it compiled just like normal Common Lisp code. Hence getting the benefits of Lisp implementations, notably their performance. ...
8
votes
4
answers
3k
views
What makes Common Lisp "big"? [closed]
I've been learning both Common Lisp and Racket, and one thing that I consistently hear is that Racket is a much "smaller" language than Common Lisp. I was wondering what this really meant. As far as I ...
13
votes
2
answers
4k
views
Could we build a functional computer?
As mush as FP has done, in the end, all our programs are structured.
That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly,
so what actually runs ...
2
votes
2
answers
1k
views
Ring of numbers where adjacent entries sum up to a prime
Given a number n, find a permutation of the numbers 1...n such that all adjacent entries sum up to primes. If such a permutation does not exist, throw an error.
Is there a purely-functional way to do ...
4
votes
4
answers
3k
views
What are the practical benefits of LISP like syntax which Clojure uses over Java like syntax of Scala?
I spent couple of months learning Scala and got overwhelmed by number of different constructs it had,
After looking at partial functions, partially-applied functions, pattern matching, actor syntax,
I ...