common-lisp Questions
3
Solved
I want to programing a function about open the file directly. Like python code:
os.system("ls")
For example, when I use this function (fun_open "/path/to/file"), the system will open the file us...
Nates asked 21/9, 2015 at 19:38
2
Solved
I would like to read in a string from an input file (which may or may not have been modified by the user). I would like to treat this string as a format directive to be called with a fixed number o...
Weinman asked 10/9, 2015 at 2:36
2
Solved
Is it possible to use (declare (type ...)) declarations in functions but also perform type-checking on the function arguments, in order to produce faster but still safe code?
For instance,
(defun...
Ina asked 31/8, 2015 at 22:48
5
Solved
I'm new to Common Lisp. In Haskell, you can do a little something like this:
Prelude> takeWhile (<= 10) [k | k <- [1..]]
[1,2,3,4,5,6,7,8,9,10]
Is this possible in Lisp? Not necessarily...
Agglutinogen asked 29/5, 2011 at 13:51
1
Solved
I've been looking through formatting recipes , and I can't quite find what I'm looking for...
(format nil CONTROL-STRING day name num-apples)
Suppose I don't want to change the arguments in the a...
Lacking asked 19/8, 2015 at 17:0
1
Solved
I'm writing a program in Common Lisp for editing binary files generated
by Minecraft that use the NBT format, documented here:
http://minecraft.gamepedia.com/NBT_format?cookieSetup=true
(I'm aware ...
Extradition asked 8/8, 2015 at 19:7
3
Solved
In C, it is easy to manipulate memory and hardware registers, because concepts such as "address" and "volatile" are built into the language. Consequently, most OSs are written in the C family of la...
Comparison asked 28/7, 2015 at 19:2
2
I'd like to be able to use a defined type as a parameter specializer to a defmethod. The motivation is readability and flexibility to change at a later stage. Somehting like this:
(deftype foo () ...
Tiatiana asked 26/4, 2015 at 12:8
2
Solved
I am trying to call the BLAS ddot routine from SBCL.
Based on:
the ddot documentation (http://www.netlib.org/lapack/explore-html/d5/df6/ddot_8f.html),
its source code (http://www.netlib.org/lapa...
Minh asked 16/7, 2015 at 10:46
2
Solved
How could one interact with a locally long-running Common Lisp image, possibly daemonized, from the command line?
I know it is possible to run a Common Lisp function from a Terminal command prompt...
Incision asked 13/7, 2015 at 6:55
1
Solved
I'm getting a warning from the sbcl compiler, that a variable has been defined but is not used. And the compiler is right. I want to get rid of the warning, but don't know how to do it. Here is an ...
Blockish asked 4/7, 2015 at 22:56
2
Solved
Let's say I have two matrices (in the form of a Common Lisp array) foo and bar such that:
(defvar foo #2A((2 1 6) (7 3 4)))
(defvar bar #2A((3 1) (6 5) (2 3)))
I would like to perform a matrix m...
Podesta asked 23/4, 2015 at 11:46
2
Solved
I currently have a list of objects, each containing a certain attribute. I would like to get the element of the list with the min attribute value. Is there a concise way of doing this?
The python ...
Ethelyn asked 16/5, 2015 at 9:6
2
I'm wondering if there's a way to emulate Haskell's typeclasses in Common Lisp.
Generic functions allow overloading, and it's possible to define types using deftype(which could be defined by memb...
Fibrin asked 4/6, 2015 at 7:20
1
I've been learning/playing around with common lisp for some time(few months), and I still have some difficulty understanding how to import code from other files. I'm using emacs/slime and SBCL, and...
Bremerhaven asked 31/5, 2015 at 23:6
3
Solved
Both CL and Scheme define (and) to return t (or #t) with no arguments.
I'm trying to understand the rationale for this. My naive assumption is that an empty set is false, and passing in zero argum...
Trivium asked 26/5, 2015 at 19:55
2
Solved
How are tagbody and go implemented in Common Lisp? Is it some form of setjmp/longjmp or is there a more elegant way of handling this?
I'm writing a lispy language implemented in C and would like t...
Pothook asked 22/5, 2015 at 3:32
2
Solved
*Note: Despite having frequented StackOverflow for a long time, this is the first question that I have posted myself. Apologies if it's a bit verbose. Constructive criticism appreciated.
When I de...
Helminthiasis asked 23/5, 2015 at 17:14
3
Solved
Solving the Euler project problems I get that I need to make operations with the digits of a long number normally as a string. I work in linux, emacs, slime with sbcl.
For example, to get the sum ...
Focus asked 19/5, 2015 at 12:4
2
Solved
I am extremely new to lisp, had previous experience with functional programming (Haskell, SML). Why is this code returning 14, and not 10 (i.e. 1 + 2y + 3 + 1)?
(defvar x 1)
(defun g (z)
(+ x z)...
Pitsaw asked 14/5, 2015 at 20:24
3
I would like to know if there is a style guideline, published by ANSI or implementation authors or another influential authority, for Lisp functions which are implemented using recursive helper fun...
Digitize asked 11/5, 2015 at 22:45
2
Solved
I have this macro, which rewrites define. If I remove the " ` " backtick it won't work. What is the explanation?
(defmacro define ((name &rest r) body)
`(defun ,name ,r ,body))
Convector asked 10/5, 2015 at 10:15
2
Solved
I have an assignment for my CS functional languages class where we must write a function able to detect whether or not a given list is circular at its beginning. The function has to be recursive. L...
Ciprian asked 2/5, 2015 at 16:38
1
I would like to have a CL function with a single argument, but also with a default argument value.
(defun test1 ((x 0))
(+ x x))
would seem to be the syntax, but it doesn't work. The tutorials ...
Pelagias asked 1/5, 2015 at 16:28
4
It is a technique used frequently in On Lisp, which is on Common Lisp:
> (mapcar #'(lambda (x) (+ x 10))
'(1 2 3))
(11 12 13)
Why is sharp-quote needed or even possible? lambda expressions r...
Peruse asked 30/3, 2015 at 3:33
© 2022 - 2024 — McMap. All rights reserved.