common-lisp Questions

4

I want to insert a char into a list. However, I want to merge this char with the last symbol in the list. With appends and cons the result is always two different symbols. Well, I want one merged s...
Lustrous asked 29/3, 2013 at 19:25

4

Solved

I recently started learning Common Lisp using SBCL. How can I compile my Lisp programs into a Windows binary?
Enamel asked 5/1, 2013 at 12:35

5

Solved

I'm wondering how to permanently alter the value of a global variable from inside a function, without using the variable's name inside the function, i.e.: (defvar *test1* 5) (defun inctest (x) (in...
Vaishnava asked 24/10, 2013 at 7:52

4

I'm trying to write a Common Lisp function that will give me all possible permutations of a list, using each element only once. For example, the list '(1 2 3) will give the output ((1 2 3) (1 3 2) ...
Triplicity asked 18/1, 2010 at 16:55

7

Solved

How can I get the command line arguments in (specifically in GNU, if there are any differences) Common Lisp?
Inkling asked 20/6, 2009 at 14:50

5

Solved

This is just curiosity on my part, but what is more efficient, recursion or a loop? Given two functions (using common lisp): (defun factorial_recursion (x) (if (> x 0) (* x (factorial_recurs...
Bilharziasis asked 21/2, 2012 at 22:33

2

I'm trying to call C functions from SBCL with its FFI facility. The C functions require buffer of bytes (unsigned char) and process the bytes data. Unfortunately, in most cases the buffer is quite ...
Artiste asked 24/10, 2023 at 7:2

8

Solved

How can i convert the string "1 2 3 4 5 6 7" into the list (1 2 3 4 5 6 7) elegantly? I am using CLISP.
Quarters asked 18/9, 2011 at 4:36

2

When I run the following codes in SBCL (2.3.5), I am surprised by how much bytes consed. (defun number-of-digits (num) (do ((n 1 (1+ n)) (num (floor num 10) (floor num 10))) ((zerop num) n))) (...
Sheerlegs asked 24/7, 2023 at 4:57

6

How do I do a conditional dispatch on a string in Common Lisp? I'm looking for something like: (case str ("a" "found an a") ("abc" "found an abc") (otherwise "other")) so (case "a") returns "...
Disbelieve asked 16/9, 2015 at 5:58

3

Solved

On MacOS: When I try to load log4cl I get a compile error: CL-USER> (ql:quickload "log4cl") To load "log4cl": Load 1 ASDF system: log4cl ; Loading "log4cl" . ; ;...
Tinct asked 4/4, 2023 at 21:37

6

Solved

I was studying Lisp and I am not experienced in Lisp programming. In a part of my studies I encountered the below examples: > (cons ‘a ‘(a b)) ----> (A A B) > (cons ‘(a b) ‘a) ----> ((...
Internecine asked 17/4, 2015 at 15:32

4

Solved

I'm trying to figure out how to use the output stream of one program I start with RUN-PROGRAM so it can be used as the input of another program started with RUN-PROGRAM (i.e., the moral and perhaps...
Carpeting asked 1/3, 2010 at 1:6

5

Solved

Here's the brief problem: Input: a list of strings, each containing numbers (" 3.4 5.4 1.2 6.4" "7.8 5.6 4.3" "1.2 3.2 5.4") Output: a list of numbers (3.4 5.4 1.2 6.4 7.8 5.6 4.3 1.2 3.2 5.4) He...
Readymade asked 29/9, 2009 at 23:34

2

Solved

According to Common Lisp HyperSpec (CLHS), mapcan uses nconc to combine its results into a list. CLHS also says that (mapcon f x1 ... xn) == (apply #'nconc (maplist f x1 ... xn)) So I've been con...
Barbosa asked 14/4, 2023 at 15:36

3

Solved

I am trying to delete an element from an array using the delete function in Common Lisp (SBCL) but noticed that all the indices of this array are still present (the return value of (length arr) on ...
Nocturn asked 4/4, 2023 at 2:25

1

Solved

I am a bit new to the CL type system but I thought something like the following could work. (deftype list-of (type) `(labels ((check-all (l) (every (lambda (item) (typep item ,type)) l))) (and...
Barret asked 22/3, 2023 at 20:40

4

Solved

I want to define a macro which can comment a s-expression, for example: I hope that (list 1 2 (comment-macro (something))) -> (1 2) But if I define the macro like this (defmacro comment-mac...
Gramnegative asked 10/9, 2013 at 14:32

4

I want to read in the contents of a file into a list. Some of my attempts so far have been - (defun get-file (filename) (let ((x (open filename))) (when x (loop for line = (read-line x nil) wh...
Swearword asked 28/9, 2010 at 14:38

8

Solved

How would I get the first n elements of a list? CL-USER> (equal (some-function 2 '(1 20 300)) '(1 20)) T I am absolutely certain this is elementary, but help a brother newb out.
Wardle asked 12/11, 2009 at 2:39

4

Solved

I'm writing some methods to emit HTML for various elements. Each method has the same output, but doesn't necessarily need the same input. The method for echoing a game-board needs to take a player...
Outgeneral asked 20/2, 2012 at 2:37

1

Solved

I'm a complete newbie to Lisp-Stat, and I started working through the tutorial at https://lisp-stat.dev/docs/tutorials/basics, but when I type (standard-deviation purchases) (with purchases defined...
Blizzard asked 13/1, 2023 at 3:50

3

Solved

Python's Itertools has what is called starmap. Given a collection of collections and a function, it applies the function to each collection strictly inside the collection, using the elements of sai...
Lavin asked 12/1, 2023 at 9:5

11

I have a list of things (I'll call it L), an index(N) and a new thing(NEW). If I want to replace the thing in L at N with NEW, what is the best way to do this? Should I get the sublist up to N and ...
Relegate asked 4/10, 2008 at 20:8

11

Solved

How to create a list of consecutive numbers in Common Lisp? In other words, what is the equivalent of Python's range function in Common Lisp? In Python range(2, 10, 2) returns [2, 4, 6, 8], with ...
Yellowhammer asked 18/12, 2012 at 16:39

© 2022 - 2024 — McMap. All rights reserved.