Common Lisp, or ANSI Common Lisp, is a standardized version of the Lisp programming language intended for production-strength power and libraries.
0
votes
0answers
9 views
Simple unit test framework in Common Lisp - General advice [on hold]
while learning Lisp I tried developing a simple unit testing framework with it.
It is uploaded at my GitHub repository github.com/foss-santanu/simut
I actually tried to develop a unit test framework ...
6
votes
4answers
810 views
Finding the sum of all the multiples of 3 or 5 below 1000
As a Lisp (and functional programming) newbie, I wrote the following code that finds the sum of all the multiples of 3 or 5 below 1000, and I suspect that it is lousy:
...
3
votes
1answer
49 views
What's your opinion on this approach to creating a repetitive string in Common Lisp?
I needed to have a Lisp function that could produce a string of a certain length, created by repeated concatenations of a another string given as argument (so for example by giving 10 and "abc" i ...
0
votes
2answers
53 views
Generic sequence splitter in Common Lisp
I wrote a function split-seq-by-n which accepts a sequence and a number and splits the sequence into subsequences of length n (the last subsequence getting the ...
5
votes
1answer
76 views
Did I convert this C++ class to Common Lisp correctly?
Here is the original C++ class I converted to Lisp at the very bottom of this post.
...
1
vote
1answer
34 views
Finding optimal row sequence for a melody on 5-row Bayan Accordion, v2.0
Another try at this problem in LISP. This time rather than generating every possible row combination for the melody I tried to calculate the best combination directly. Unfortunately there's a problem ...
3
votes
2answers
47 views
Calculating series of rows to use to play a melody on 5-row Bayan Accordion
This was my first attempt at writing a program in LISP. Can anyone give any guides as to how it could be improved? The multiple loops in best-pattern seem awkward (I'd normally do that in just one ...
1
vote
1answer
58 views
Rewrite apply function to use recursion instead
Probably the hardest part of learning lisp has been to think in the "lisp way" which is elegant and impressive, but not always easy. I know that recursion is used to solve a lot of problems, and I am ...
0
votes
1answer
140 views
initializing chess board in common lisp [closed]
I'm a CS student, i have a course called theory of programming language, the instructor opted to teach us lisp. I should present a project written in common lisp. I want to write a chess engine. I ...
10
votes
1answer
122 views
Generating hard to guess session tokens
Does this code create sufficiently hard-to-guess session tokens, assuming the server and client are communicating over HTTPS?
Take 2 (thanks to this crypto.SE answer):
...
1
vote
2answers
51 views
Is using defvar for a non-global variable ok?
I am calling defvar in the middle of a function definition. And so far I've always seen its use, with defparameter for global ...
1
vote
1answer
104 views
common lisp: nested loop beautification (checkboard texture generator)
I've written a small code snippet that generates checkboard texture using cl-opengl.
...
4
votes
1answer
176 views
Prime test - style and correct idiom review please
Below is some code I've created to generate and use a list of prime numbers. This is some of the first common lisp code I've written, and I'd be grateful for any comments regarding style and its use ...
2
votes
1answer
133 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
238 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 ...
1
vote
1answer
170 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 ...
1
vote
1answer
100 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.
...
1
vote
1answer
65 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
170 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.
...
4
votes
1answer
133 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
204 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".
...
7
votes
1answer
165 views
Sundaram's sieve in Common Lisp
I have this Sundaram's sieve to generate prime numbers up to limit in Common Lisp.
...
2
votes
1answer
138 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
73 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
163 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.
...
4
votes
1answer
100 views
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 ...
3
votes
1answer
165 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
128 views
7
votes
2answers
171 views
4
votes
4answers
1k views
Finite State Machine code
I have been making this FSM today. However, as this is probably the biggest practical program I have ever written in CL, I don't know if there are some things that could be improved, or if using a ...
2
votes
1answer
218 views
4
votes
1answer
1k views
Simple web-scraper in Common Lisp (SBCL)
I have written a simple web-scraper in Common Lisp, & would greatly appreciate any feedback:
...
1
vote
1answer
386 views
Simple octal reader macro in Common Lisp
As an exercise, I've implemented a simple reader macro in Common Lisp (using SBCL). It converts Octal (unsigned integers only) into numbers.
Usage:
...
1
vote
2answers
382 views
1
vote
1answer
86 views
(Common Lisp) Tabulate k = 2^n Minimizing Multiplication
Given the following problem:
;3.3 Tabulate the function k = 2^n for n = 1..50.
;Do this for the fewest possible multiplications.[3]
I wrote this answer:
...
3
votes
2answers
886 views
(Common Lisp) Palindrome-p
3.23 Palindromes. A palindrome is a number that reads the same forwards
and backwards, like 12321. Write a
program that tests input integers for
the palindrome property. Hint.This
should ...
1
vote
1answer
154 views
(Common Lisp) Find epsi
4.2 Machine Epsilon. Find the floating point number epsi that has
the the following properties:
1.0+epsi is greater than 1.0 and
Let m b e any number less than epsi. Then 1.0+m is ...
2
votes
1answer
224 views
1
vote
1answer
305 views
Common Lisp - Abstract the (duplicate?) behavior between “sort” and “replace”
I have written these two functions that have a similar process. The first is meant to "split" a string on a given character and the second is meant to "replace-all" instances of a character in a ...
4
votes
1answer
529 views
Common Lisp - Solve a Cryptoarithmetic Problem
This code is intended to find all possible solutions to a cryptoarithmetic problem. The description of the problem I was trying to solve is here:
...
3
votes
3answers
1k views
(Common Lisp) Print an Integer and its Digits Reversed
This common lisp program is an exercise to print an integer and its digits reversed to the screen.
...
5
votes
2answers
496 views
Common Lisp - Calculate the weekday from a date (M-D-Y)
This Common Lisp exercise is to write a program that can calculate the weekday given a string of the format "M-D-Y." It was more challenging than I expected. If you have suggestions about how to ...
4
votes
5answers
685 views
Determine type of triangle in LISP
This is a simple LISP program to read in three sides of a triangle and report what kind of triangle it is (or isn't). Any feedback would be much appreciated.
...
4
votes
3answers
760 views
Sorting numbers in LISP
I am doing a CS practice exercise in which you are supposed to sort exactly three numbers using only if statements. I wrote the following code in LISP and would appreciate any suggestions how to ...
3
votes
3answers
1k views
Code Review of my Lisp Quicksort code
I would really appreciate it if someone could review my LISP code. I was attempting to write a quicksort implementation. Additionally, I generated my list dynamically and wrote a couple of tests. ...