Questions tagged [common-lisp]
Common Lisp is a standardized version of the Lisp programming language intended for production-strength power.
common-lisp
6,330
questions
1
vote
1
answer
81
views
How to Programmatically and Portably Shadow a Symbol from a Macro?
This one is a little bit embarrassing, but I have been stuck with this one way longer than I want to admit.
I would like to generate a macro that automatically shadow a symbol if it is found in some ...
1
vote
1
answer
65
views
Given an alist of constant values, what is the most efficient lookup?
You have a list of key-value pairs known at compile time. We don't want to lookup at runtime, but would rather generate a lookup table. For example, we could do this (from a piece of code I wrote ...
1
vote
1
answer
81
views
How does Common Lisp represent control modifiers for character keys?
According to CLTL2, all of functions that deal with key modifiers seem to be removed from the standard. SBCL does not seem to have any of those.
What is the printing representation of characters with ...
1
vote
0
answers
31
views
neovim + lua + slimv: how to start swank server in the current folder/project?
I'm using Slimv with NVim, and it works perfectly except when attempting to (load ...) files from the same folder. I presume it's an issue with translating vim shell commands (with % expansions, etc.) ...
1
vote
1
answer
109
views
How to modify a lexical environment at runtime in Common Lisp?
In Common Lisp, is it possible to programmatically manipulate a lexical environment at runtime?
If I create a closure, typical let-over-lambda, as described in D. Hoytes LOL-book, how can I augment ...
0
votes
1
answer
52
views
Translating pretty-print code to format directives
I am writing pretty-printing code in the style of Common Lisp, the language. While I have the intuition that this code could be written more compactly using format directives, I still did not succeed ...
5
votes
1
answer
73
views
How can EVENP or ODDP used in a :KEY be compared to integers?
On the page of the SEARCH function in the Specifications, one can read the example:
(search '(0 1) '(2 4 6 1 3 5) :key #'oddp) => 2
Can you explain how the comparison could work?
Indeed, the ODDP ...
2
votes
1
answer
104
views
Common Lisp: How to imitate the \G anchor with CL-PPCRE?
In the Perl Tutorial for regular expressions there is this example with the /g modifier:
$dna = "ATCGTTGAATGCAAATGACATGAC";
while ($dna =~ /(\w\w\w)*?TGA/g) { # note the minimal *?
...
3
votes
1
answer
117
views
Is there a widely-accepted Common Lisp naming convention for functions modifying one or more of their arguments?
In CL, we have incf and setf imperative functions. Scheme uses an exclamation point (e.g. set!, vector-set! etc.) But what, if any, convention do CL programmers use?
2
votes
2
answers
128
views
Understanding How the Compile Function Works in SBCL Common Lisp
I was hoping someone can explain why the compile function is not working as I would expect.
First question:
* (compile 'square (lambda (x) (* x x)))
SQUARE
NIL
NIL
But then:
* (square 3)
; in: SQUARE ...
0
votes
1
answer
49
views
How to change MULTI-LINE-MODE and SINGLE-LINE-MODE?
It seems, that the both similar questions do not contain the information I seek.
I don't get how the mode change works in CL-PPCRE. I tried it with both, embedded modifiers as with the keyword ...
0
votes
2
answers
82
views
The reason for strings instead of symbols
I was wondering about passing a string to check the existence of a symbol, so I created the following function,
but all the answers were :INTERNAL, so it was useless.
I understand the reason, but does ...
1
vote
4
answers
77
views
Function 'position' in Common LISP works strange with 'gensym'
I'm novice in LISP, so I'm sorry in advance for probably non-clever question.
Now it is needed to check if the given symbol is a member of the given list of symbols. Function position works well for ...
1
vote
1
answer
73
views
Common Lisp Looping: How did I force the loop macro not to iterate over its input list?
I wrote the code below (INFIX-LINKING-LEAFS - the last function - is the first caller with the loop). I'm sorry if it is too much code (five functions) for the purpose of answering my question. I ...
1
vote
0
answers
100
views
How can I lazily traverse a directory in lisp?
I've been working on processing a large amount of files with lisp and encountering an issue listing directory contents when there are millions of files in a directory.
I found cl-fad and the (list-...