Search found 15 matches

by BIOS
Fri Jan 14, 2011 12:13 pm
Forum: Common Lisp
Topic: Destructive function on constant data
Replies: 7
Views: 11246

Re: Destructive function on constant data

Sweet. Thanks for the clarification! :D
by BIOS
Fri Jan 14, 2011 11:41 am
Forum: Common Lisp
Topic: Destructive function on constant data
Replies: 7
Views: 11246

Re: Destructive function on constant data

Hey thanks for the reply. Yep your code works fine. As does this i found out:

Code: Select all

(let* ((x '(1 2 3 4 5))
		(y))
	   (setf y (reverse x)))
Which indicates the issue lies with the nreverse function?
by BIOS
Fri Jan 14, 2011 10:58 am
Forum: Common Lisp
Topic: Destructive function on constant data
Replies: 7
Views: 11246

Destructive function on constant data

Can anyone tell me what I'm doing wrong here: (let* ((x '(1 2 3 4 5)) (y)) (setf y (nreverse x))) I just want to set one variable as the reverse list of the other but i get the following error: ; in: LAMBDA NIL ; (NREVERSE X) ; ; caught WARNING: ; Destructive function NREVERSE called on constant dat...
by BIOS
Sat Apr 17, 2010 3:41 pm
Forum: Common Lisp
Topic: Function Variables
Replies: 7
Views: 7109

Re: Function Variables

Okay that's great to know. I had no idea. It was a surprise alright! That was a section of the main function. I couldn't understand the values i was getting out of the thing so i stripped it down to that and saw the problem. Thanks for the advice. Would have taken me aaages to figure that one out :P
by BIOS
Sat Apr 17, 2010 3:28 pm
Forum: Common Lisp
Topic: Function Variables
Replies: 7
Views: 7109

Re: Function Variables

It works! :D What was i doing wrong?
by BIOS
Sat Apr 17, 2010 3:06 pm
Forum: Common Lisp
Topic: Function Variables
Replies: 7
Views: 7109

Re: Function Variables

Hey thanks for the reply. Here's the code at the moment: (defun list-maker (list*) (let* ((current-val 0) (new-list)) (setf new-list '(0)) (loop for i in list* do (if (stringp i) (setf current-val (read-from-string i)) (setf current-val i)) (print (push (+ current-val (nth 0 new-list)) new-list))) (...
by BIOS
Sat Apr 17, 2010 2:40 pm
Forum: Common Lisp
Topic: Function Variables
Replies: 7
Views: 7109

Function Variables

I've encountered i problem I've never seen before. I have function that has variables declared at the start. One of the values is a list. The function works fine the first time i call it. But when i call it a second time the list variable retains the value it ended up with from the previous function...
by BIOS
Fri Apr 09, 2010 3:53 pm
Forum: Common Lisp
Topic: Lists of Functions
Replies: 9
Views: 9098

Re: Lists of Functions

Ah yes this is what my computer scientist friend told me i should really focus on. Data structure. Thanks for the direction.
by BIOS
Fri Apr 09, 2010 2:12 pm
Forum: Common Lisp
Topic: Lists of Functions
Replies: 9
Views: 9098

Re: Lists of Functions

What you want is to create a list of functions. Those either have to be preexisting function, which can be retrieved from the function namespace with FUNCTION , or anonymous functions . You can then call them with FUNCALL . Also, if you want random access the arrays/vectors are better than lists. R...
by BIOS
Fri Apr 09, 2010 1:43 am
Forum: Common Lisp
Topic: Lists of Functions
Replies: 9
Views: 9098

Re: Lists of Functions

Thanks for the link Ramarren. I don't recall seeing how to do it in that chapter. I've tried funcall etc. I'll have another look. Is it possible to structure lists of functions and then call those functions from the list with a function like nth or assoc? Sure, but you didn't make a list of function...