Data dodania Pytanie
2017-02-20 15:02 Lisp recursive square use one variables »
This is Trying code (defun f (a n) (if (zerop n) 1 (* a (f a (- n 1))))) (f 3) should return 27, (f 4) should return 256 I tri...
(5) odpowiedzi
2017-02-20 00:02 Saving CLOS objects »
Saving any Common Lisp structure object to a file (readably) seems relatively straightforward with something like (defun save-structure-object (objec...
(1) odpowiedzi
2017-02-20 00:02 Advice on how to tackle this lisp function. »
I have written a function called my_rotate that takes a number from a user and creates a list up to five numbers. my_rotate then, pops off the first e...
(1) odpowiedzi
2017-02-19 01:02 Why is my lisp function giving me this output? »
I am writing a function that will take a list from a user and will flatten this list into one simplified list. The function seems to only return the f...
(1) odpowiedzi
2017-02-18 20:02 Evaluation of setf forms »
This question is about the Common Lisp setf macro, and how it evaluates its argument forms (and subforms)--namely, only once if they happen to appear ...
(1) odpowiedzi
2017-02-18 17:02 trying to use cl-lexer on a file containing "{" and "}" »
Using the file "test-lexer.lisp", I have very slightly modified lex to be (defparameter *lex* (test-lexer "{ 1.0 12 fred 10.23e12")) and increased...
(1) odpowiedzi
2017-02-18 09:02 Number of atoms in a tree »
I don't understand the following paragraph: (COUNT-ATOMS ’(A (B) C)) should return five. A, B, and C and two NILs in the tree. Write a...
(2) odpowiedzi
2017-02-17 17:02 What is the best way of combining &key and &rest in a lisp macro's lambda list? »
I implemented Heap's algorithm using a macro. It's working OK, but I would like to tweak it so it will generate anaphoric or non-anaphoric code on dem...
(1) odpowiedzi
2017-02-17 15:02 Group the elements of a set into disjoint subsets using iteration instead of recursion »
I came across Pascal Bourguignon's solutions of the 99 Lisp problems and was wondering if his recursive solution of problem 27 using a nested mapcan-m...
(0) odpowiedzi
2017-02-17 13:02 Searching an item in a k-d tree »
I am developing a k-d tree in Lisp. I am writing a function that allows me to search a node in the k-d tree. This function is defined as follows: (de...
(3) odpowiedzi
2017-02-16 23:02 What does DECODE-UNIVERSAL-TIME do in half-hour time zones? »
In Common Lisp, the decode-universal-time function returns several values, one of which is the time zone in hours. What does this time zone contain in...
(1) odpowiedzi
2017-02-16 03:02 Why is Common Lisp's print output preceeded by a newline and followed by a space? »
The Common Lisp Hyperspec page for print mentions this: print is just like prin1 except that the printed representation of object is preceded by a...
(2) odpowiedzi
2017-02-15 18:02 Using get-setf-expansion »
In a previous post at Simplifying complex setf expressions, @sds suggested using the get-setf-expansion macro for implementing place modification, as ...
(0) odpowiedzi
2017-02-15 14:02 A safe way to transpose a list of of lists in lisp? »
Transposing a list of lists is easy but comes with a caveat that you must not exceed the call-arguments-limit. http://www.lispworks.com/kb/4fbc798cb1...
(1) odpowiedzi
2017-02-14 10:02 Reload components list »
Here is my workflow: I have a running REPL in my emacs and I create a new system. When I try to test the system with (asdf:test-system :system) I get ...
(1) odpowiedzi
2017-02-14 07:02 how to deal with `&rest` args in common lisp »
I am new to common lisp, when I see &rest in function arguments declaration, I thought it is similar to *args in ruby. And I started to write a fu...
(1) odpowiedzi
2017-02-14 07:02 Why does apply throw a CONTROL-STACK-EXHAUSTED-ERROR on a large list? »
(apply #'+ (loop for i from 1 to x collect 1)) works if x has value 253391, but fails with a (SB-KERNEL::CONTROL-STACK-EXHAUSTED-ERROR) on 253392*. ...
(2) odpowiedzi
2017-02-13 23:02 Symbol equality »
In Paul Graham's book ANSI Common Lisp, while discussing symbol vs string manipulation, he says Symbols can be compared in one step with eql ..."...
(1) odpowiedzi
2017-02-13 21:02 Inconsistent behaviour of closures in Common Lisp »
When working on a personal project, I found what seems to be an inconsistent behaviour of closures. The idea in the codes below is to find the maximu...
(0) odpowiedzi
2017-02-12 19:02 Destructive place-modifying operators »
The CLtL2 reference clearly distinguishes between nondestructive and destructive common-lisp operations. But, within the destructive camp, it seems a ...
(2) odpowiedzi
2017-02-12 02:02 Error: Lambda list with dots are only allowed in macros, not here : LIST? »
I am writing a function called flatten that is supposed to take the list that have embedded list and returns a simplified version of it . When I try t...
(2) odpowiedzi
2017-02-11 23:02 Why is my lisp function returning 'NIL' »
I am writing a lisp function, that will determine if a word is a palindrome without using the 'reverse' function. I am fairly new to lisp and I am sti...
(1) odpowiedzi
2017-02-11 21:02 Comma is illegal outside of backquotes? »
I am writing a function that is supposed to take in two values. The first value is supposed to create a list up to five numbers, based on the value en...
(1) odpowiedzi
2017-02-11 02:02 Why am I getting variable 'list' has no value? »
I am trying to understand why I am getting this error, as I am fairly new to lisp. I want to create a function that takes a number n from the user and...
(2) odpowiedzi
2017-02-10 23:02 Alexandria Lisp Manual & Implementation »
The ALEXANDRIA package seems to be widely-used in the common-lisp community. However, the only documentation I've found is a draft version of a manual...
(1) odpowiedzi
2017-02-08 23:02 Representation of a binary variable »
How would you find out how SBCL (and perhaps other common-lisp compilers) represents a typed variable. For example, SBCL translates a variable typed ...
(1) odpowiedzi
2017-02-08 15:02 Recursion in SBCL »
I am having an issue with SBCL (on linux) which might be related to tail recursion (not that I'm entirely sure what that is). I am adding the code th...
(1) odpowiedzi
2017-02-08 02:02 How does read-line work in Lisp when reaching eof? »
Context: I have a text file called fr.txt with 3 columns of text in it: 65 A #\A 97 a #\a 192 À #\latin_capital_letter_a_with_grave 224 ...
(1) odpowiedzi
2017-02-07 22:02 Simplifying complex setf expressions »
For rapid prototyping purposes in common-lisp it would be convenient to be able to easily function-modify an object in an arbitrary data structure. Th...
(1) odpowiedzi
2017-02-07 08:02 Why the expression is illegal when call the function »
I have define a function. (defun my-func (v0) (lambda (v1) (+ v0 v1))) Then input the expression in the slime command line. ((my-func 1) 5) ...
(0) odpowiedzi
2017-02-06 17:02 Lisp: IF condition using AND operator »
I making this function. (f 3 4) (sum = 7) (f 'a 'b) (not num!) My problem is how can I make if condition using and operator. I try.... (IF (a...
(1) odpowiedzi
2017-02-06 05:02 Implement Lisp function to compute the distance between two cities x and y »
I am trying to learn lisp and code the above problem as in the map in the image. I have gone through the aima code below to understand how it works....
(2) odpowiedzi
2017-02-06 02:02 How can I run a lisp buffer in slime and see its output in emacs? »
I have the following code in a buffer (file ~/firsts.lsp): (defun firsts (l) (cond ((null l) ()) (T (cons (car (car l)) (firsts (cdr l)))))...
(1) odpowiedzi
2017-02-05 21:02 Is defun or setf preferred for creating function definitions in common lisp and why? »
What is the fundamental difference in the functions defined using defun and setf as below and is one method preferred over another outside of style co...
(1) odpowiedzi
2017-02-05 02:02 Find position of atom - return nil if not present »
I am trying to find the position of an atom in the list. Expected results: (position-in-list 'a '(a b c d e)) gives 0 (position-in-list 'b '(a b c ...
(3) odpowiedzi