FAQ Database Discussion Community


EVAL/APPLY: too many arguments given to F

lisp,common-lisp,clisp
Hello why do i get *** - EVAL/APPLY: too many arguments given to F on function call with nested lists parameter. I cannot figure it out, since I passed a simple nested list. (defun f (L) (cond ((NULL l) nil) ((listp (car L)) (append (F(car L))) (F(cdr L) (car (F...

pathnames in Common Lisp, filenames with wildcards in them

common-lisp,filenames,wildcard,clisp,pathname
The characters * and ? are used as wildcards in pathnames. How does one refer to a filename that has ? as one of its actual characters? For example: [18]> (wild-pathname-p #p"foo") NIL [19]> (wild-pathname-p #p"foo?") T So referring to the filename "foo?" cannot be done this way. I tried...

Running compiled lisp program with clisp-2.49 on OS X

common-lisp,clisp
I have just started out programming in Common Lisp using GNU clisp-2.49 (compiled from source) as my implementation on OS X 10.10 Yosemite. I've written a simple "Hello World" program as follows: (EXT:SAVEINITMEM "test" :INIT-FUNCTION 'main :EXECUTABLE t) (defun main () (format t "Hello World!") (EXT:EXIT)) When I run: $...

How to use FFI:def-call-in in clisp

lisp,common-lisp,ffi,clisp
I have figured out how to make use of shared objects created from C code into Clisp using FFI:def-call-out but I am not able to figure out how to use FFI:Def-call-in. I don't know the process and actually I am confused if clisp will also create some .so file that...

CAR and CDR in LISP

lisp,clisp,cdr
Suppose there's a LISP list L described by ((A B) (C)) How to print the result of (CAR L) and (CDR L)? (in clisp interpreter) I am able to print these simple statements like (CAR `(A B C)) which gives A. But how do I define the list and CAR...

Lisp Function that Returns a Sum

list,sum,lisp,iteration,clisp
I am trying to write a weird function, so bear with me here. This function should take a list L as a parameter and have a sum variable. If L is not a list, it should return nil. Otherwise, it should iterate through each element of the list and do...

LISP: Why doesn't mapcan accept my list give as parameters?

list,parameters,lisp,common-lisp,clisp
To simplify my question: why this works (mapcan #'(lambda (l) (list '1 '2) ) '(a b)) and this doesn't (mapcan #'(lambda (l) '(1 2) ) '(a b)) ? I have to write a function that substitutes an element through all elements of list D at all levels of a given...

Printing ith row jth column value in lisp

arrays,multidimensional-array,lisp,clisp
I am taking input N as number of rows of a 2D matrix in lisp, where each row can have maximum of 5 elements in it. So i make it like this. Now for eachrow as it can have any number of elements between 0 to 5. So I made...

Need help getting CLisp to read standard input into a list

python,lisp,common-lisp,clisp
I'm working on converting some existing Python code to CLisp just as an exercise ... The program reads a list of numbers and creates mean, min, max and standard deviation from the list. I have the file-based function working: (defun get-file (filename) (with-open-file (stream filename) (loop for line = (read-line...

Dynamic 2d array in lisp

common-lisp,clisp
I want to have a 2D array in Lisp . But each row can have different number of elements(At max 5). So I thought of maintaining another single list to store the current sizes of each row, and update them whenever required. So, my code goes like this : (setq...