Data dodania Pytanie
2017-12-11 19:12 Lisp - replace all the appereances of an element in a list »
I try to replace a certain element E in a list with another list K at all the main list levels. (defun replaceList(l e k) (cond ((null l) nil) ...
(1) odpowiedzi
2017-12-11 14:12 Changing local variables in (Common) lisp? »
I just stumbled across this phenomenon while trying to implement a simple function that is counting the number of letters in a list. This is the cod...
(0) odpowiedzi
2017-12-06 06:12 cmucl: run-program output process exited only »
I'm on debian stretch and install CMUCL from the stable reposetory. When trying the following (run-program "sh" '("ls") :output T) I get #<pr...
(1) odpowiedzi
2017-12-06 01:12 How to convert a list into a string in lisp »
How do you convert a list into a string? I am trying to use parse-int to take a list of numbers and convert them to decimal, but i end up getting an e...
(2) odpowiedzi
2017-12-05 08:12 How to compare integers to array values in LISP »
I'm trying to write a program that takes user input for a single integer, and then a list of integers, then outputs the indices where the values matc...
(0) odpowiedzi
2017-12-02 19:12 Common-LISP - Subtraction »
I have this function: (defun test (variable) (cond ((null variable) nil) ((< (- 12 (other-function variable) 3) 0) 1) (t (- 12 (othe...
(1) odpowiedzi
2017-12-01 23:12 Recursive Factorial Function in Common-Lisp »
Ok, I'm been learning COMMON LISP programming and I'm working on a very simple program to calculate a factorial of a given integer. Simple, right? He...
(4) odpowiedzi
2017-11-29 22:11 LISP - Replace values in a list »
I have a list of nils (NIL NIL NIL NIL) and i need to add two X in place of the two first NILs, so it becomes (X X NIL NIL). I have the following cod...
(2) odpowiedzi
2017-11-28 13:11 if statement within loop for statement in lisp »
I'm getting an error trying to do the if statement within the loop for statement. Is it possible to put an if statement here? (princ "Enter a number...
(0) odpowiedzi
2017-11-28 04:11 undefined variable in loop for statement in lisp »
I'm getting compilation error for number in the for loop. It says that number is undefined here. How can I make a for loop for 2 to number? (princ...
(0) odpowiedzi
2017-11-23 10:11 Does mapcan in common lisp change the value of argument? »
I don't know what happened. (setf x '((a b) (c) (1 2 3))) x ;;=> ((A B) (C) (1 2 3)) (mapcan #'cdr x) ;;=> (B 2 3) x ;;=> ((A B 2 3) (C) (...
(2) odpowiedzi
2017-11-21 19:11 Dr. Racket, help getting element from a list »
I am working on a finite state machine in Dr. Racket, and need some help extracting the next state in my transition function. Right now, I am not che...
(1) odpowiedzi
2017-11-19 15:11 Swapping list elements in Common Lisp »
I need to swap the elements of a list given two positions (i, j) to implement 2-opt heuristics for the TSP and found this question recommending the us...
(1) odpowiedzi
2017-11-14 11:11 SLIME on Emacs with paredit in repl - how to prevent execution of incomplete but balanced expressions? »
I use paredit on emacs with SLIME's repl. This means that at any point during my typing on the repl, my s-expressions are balanced. However, they ma...
(2) odpowiedzi
2017-11-13 06:11 SBCL LISP read / write order »
I am just getting started with LISP / functional programming. The following code is what I am trying to run on SBCL running on macos (defun maxOfTwo ...
(0) odpowiedzi
2017-11-12 23:11 DYNAMIC-EXTENT ignored in CLISP? »
I read here that "it is permissible for an implementation to ignore" the dynamic-extent declaration in Common Lisp, and I was wondering if it is in fa...
(3) odpowiedzi
2017-11-12 13:11 LISP MAKE-PATHNAME: Illegal :DIRECTORY argument »
I download Semantic Network Processor project: http://digital.cs.usu.edu/~vkulyukin/vkweb/software/snp/snp.html and following it's read me, By using ...
(1) odpowiedzi
2017-11-11 22:11 Collect AND do something under a condition inside a Common Lisp loop »
I need to execute an instruction in addition of "collect" under a condition in a loop and I can't figure out a working syntax... For instance I'd lik...
(3) odpowiedzi
2017-11-10 18:11 get the elements from a nested list in LISP »
I am trying to figure out how to access the elements in a nested list in LISP. For example: ((3 (1 7) (((5)))) 4) If I use dolist, i run into the br...
(0) odpowiedzi
2017-11-10 12:11 Using CLISP and recursion »
create a list or an array of random integers (e.g., between [0, 50]) and a target number (e.g., 60), then find all subsets of the integers of the list...
(1) odpowiedzi
2017-11-06 04:11 Creating a custom reverse of list »
I'm trying to create a custom reverse of list in Lisp. I'm pretty new to Lisp programming, and still struggling with syntax. This is my code so far (...
(2) odpowiedzi
2017-11-05 22:11 Why doesn't set work with lambda in Common Lisp? »
I am writing a lisp interpreter (in C), and am at the point of implementing lambda functions and the set language features. In my interpreter the foll...
(0) odpowiedzi
2017-11-05 19:11 Tetranacci sequence using LISP, without recursion »
Write a lisp program that computes the Tetranacci numbers using: a) an iterative approach b) a recursive approach The recursive part is pretty straig...
(0) odpowiedzi
2017-11-04 17:11 How to erase all the properties of a symbol in Common Lisp? »
How can I completely erase from memory a property list? Ex.: (setf (get 'book 'title) "Gone with the Wind") (setf (get 'book 'author) "Margaret Miche...
(2) odpowiedzi
2017-11-02 19:11 Calling flet or labels functions in clisp »
I new to common lisp (clisp-2.49) Can I call an flet or labels function from a different outside function? If so, how? (In a source file) This code ...
(1) odpowiedzi
2017-10-31 23:10 apply in Common Lisp: is the function called once, or once for every element of the list? »
I am trying to fully understand the way apply works, but cannot find a clear enough explanation... Given this: http://clhs.lisp.se/Body/26_glo_a.htm#...
(1) odpowiedzi
2017-10-30 00:10 LISP function which, given a number and a list, returns the first even number greater than n »
I'm having trouble finding my error. This keeps returning nil: (even-greater-n 5 '(1 2 3 4 5 6 7)) (defun even-greater-n (n L) (cond ((null L) ni...
(3) odpowiedzi
2017-10-29 06:10 More than one argument for predicate in delete-if »
Suppose I want to delete one step (element) from the states list. (defparameter *states* '((:top nil nil) (:subjects nil nil))) ;predicate (defun eq...
(1) odpowiedzi
2017-10-28 22:10 Parameterizable return-from in Common Lisp »
I'm learning blocks in Common lisp and did this example to see how blocks and the return-from command work: (block b1 (print 1) ...
(2) odpowiedzi
2017-10-28 13:10 Refactoring a "show-list" function in lisp »
I have written a function called "show-list" which passes all the tests below (defun show-list (l) (cond ((atom l) (format t "~s" l)) ...
(1) odpowiedzi
2017-10-28 06:10 Recursively find and return a pattern in a list using only basic lisp »
The function I need to write takes two arguments: a pattern (p) and a list (L). I want to find the part of the list that contains the pattern as well ...
(1) odpowiedzi
2017-10-28 04:10 Occurrence of symbol A found anywhere in L. LISP »
Here is my function (defun freq (symbol_A List_L) (cond ((atom (car List_L)) (cond ((eq (car List_L) symbol_A) t (+ 1 (freq symbol_A (c...
(2) odpowiedzi
2017-10-27 18:10 Discovering the "Core" Entities and Macros of Common Lisp »
While reading Peter Seibel's "Practical Common Lisp", I learned that aside from the core parts of the language like list processing and evaluating, th...
(2) odpowiedzi
2017-10-27 18:10 Quote Behavior With Vectors and Complex Numbers in Common Lisp »
After playing with vectors and complex numbers in Common Lisp, I became curious about something. Namely, how does the quote operator relate to these d...
(0) odpowiedzi
2017-10-26 15:10 Defining a macro to take an input stream »
I'm attempting to make a macro that will take an input stream and do something different depending on the contents of the first line read, and then re...
(2) odpowiedzi