ANSI Common Lisp, the programmable programming language.
2
votes
1answer
40 views
LISP - Modify string
I have to write a program that changes a string's vowels, consonants and other symbols into C, V respectively 0. I've done this but I wonder if there is a more efficient and elegant way to do it. ...
0
votes
2answers
55 views
Improving readability of non-recursive depth first search function in Lisp
As a free-time activity in order to learn some Lisp I had to implement depth first directed graph search. Due to large graph size (800K nodes, 5M arcs) recursion-based approach I could devise didn't ...
0
votes
1answer
52 views
Proper use of reduce, nested loops
Below is an implementation of Dijkstra's shortest path algorithm. It's input graph is represented as an association list of source nodes to assoc of target node and arc weight.
My question is about ...
1
vote
1answer
63 views
How to improve readability of a big lisp function
My main method (remove-random-edge) looks quite difficult to read. I'm new to list, so would appreciate any advice on how to improve the code.
(defun find-node (node graph)
(find-if #'(lambda (i) ...
1
vote
1answer
38 views
Written numbers to numerical representation
So I took a stab at this task to begin learning common lisp.
The idea is that you give it a written representation of a number such as "three thousand and forty nine" and it will output 3049.
I was ...
2
votes
1answer
88 views
Determinant calculation of a matrix of any degree
My program calculates the determinant of a matrix of any degree. If you really can't understand my comments or indentifiers please let me know.
//;;MakeShift make element number 'ind' the head of ...
4
votes
1answer
102 views
Seeking advice on lispiness of style and approach
I'm new to Lisp and I'm yet to wrap my head around the Lisp way of writing programs. Any comments regarding approach, style, missed opportunities appreciated:
In particular, please advice if I build ...
2
votes
1answer
66 views
Simplify complex hash-table manipulations in Common Lisp
I'm trying to write a simple triplestore in Common Lisp that will store triples in the form subject-predicate-object. The code is inspired by the book "Programming the Semantic Web".
(defvar ...
6
votes
1answer
92 views
Sundaram's sieve in Common Lisp
I have this Sundaram's sieve to generate prime numbers up to limit in Common Lisp.
(defun sundaram-sieve (limit)
(let ((numbers (range 3 (+ limit 1) 2))
(half (/ limit 2))
(start ...
2
votes
1answer
108 views
Looking for any improvements to my Common Lisp code
To start with Common Lisp I am doing Project Euler using this language. Usually I manage to solve problems but I am quite sure that my code is not as efficient as it could be in Common Lisp. That is ...
3
votes
1answer
64 views
Common Lisp. Please advise how the code could be improved
I have strong feeling that the code below is ugly at least as there are 2 same "cons".
I would appreciate if you advise me ways to improve it.
The code produces all allocation by n items from list ...
2
votes
1answer
86 views
Message queues in Common Lisp
General advice for a change. This is an implementation of message queues that I'm going to use for some work on an actors model library.
(defclass message-queue ()
((messages :accessor messages ...
3
votes
1answer
72 views
Need feedback on my first Common Lisp vector math code
I'm studying Common Lisp on my own. Coming from C++ Common Lisp feels kind of strange sometimes. I'd like to get some feedback on what I understood so far.
For learning purposes I wrote this simple ...
2
votes
0answers
116 views
iterative copy-tree in lisp
The common lisp function copy-tree is often implemented in a recursive way,
and thus is prone to stack overflow.
Here is my attempt at writing an iterative version, one-pass, no stack,
no ...
1
vote
2answers
100 views
with-alist-bind
Take 4 (alteration based on feedback from Rainer Joswig):
(defmacro with-gensyms ((&rest names) &body body)
`(let ,(loop for n in names collect `(,n (gensym)))
,@body))
(defmacro ...