Search found 17 matches
- Wed Apr 07, 2010 12:44 am
- Forum: Common Lisp
- Topic: Trees
- Replies: 14
- Views: 13770
Re: Ternary Trees
Thanks everyone for your help. I FINALLY understand how the tree works. It's pretty simple when I got down to it. I got a create-tree function set up. and it seems to work no errors so far. just understanding the concept was the hardest part. I also got an insert function. my print function isn't wo...
- Tue Apr 06, 2010 10:10 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
Re the global variable: Just (setf *example-list* new-value) -- though why not pass the list as a parameter? Re the undefined function: Did you copy his prompt function into your package and compile it first? Ya I put it in my package and ran (load "CS.lisp") and it said *** - EVAL: undef...
- Tue Apr 06, 2010 9:03 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
Ah Ok i think I understand. Although our Professor emailed us because people were asking. APPARENTLY i was just supposed to read in all the values into a list and then do the other functions. instead of what I initially thought (reading in an integer 1 by 1, then performing the task on it....1 by 1)...
- Tue Apr 06, 2010 6:09 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
Ok so it'd be something like defun readin() (let ((list ;; <- this is the variable created, its value will be the next form (loop for value = (prompt "Please enter an integer or \"end\" to finish:") until (eq value 'end) collect value))) )) Btw thanks a ton. u've been a HUGE help...
- Tue Apr 06, 2010 4:51 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
Ok So it's saved into the variable list "element" there im assuming? or is the list variable actually called list (sorry this is my first time with lisp lol.....can u tell haha)?
Either way could I make this into a function that I could use in my function loop?
Either way could I make this into a function that I could use in my function loop?
- Tue Apr 06, 2010 2:58 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
You mean like this? cl-user> (loop for value = (prompt "Please enter an integer or \"end\" to finish:") until (eq value 'end) collect value) Please enter an integer or "end" to finish:: 1 Please enter an integer or "end" to finish:: 2 Please enter an integer ...
- Tue Apr 06, 2010 11:30 am
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Re: Reading in Integers to a list
Well Is there any way to read these into a list? (like add them)
say User enters 5
the list is [5]
I do my functions/insert/etc
Next the user enters 7
the list is now [5 7]
do functions/insert etc/
and so on..
say User enters 5
the list is [5]
I do my functions/insert/etc
Next the user enters 7
the list is now [5 7]
do functions/insert etc/
and so on..
- Mon Apr 05, 2010 11:46 pm
- Forum: Common Lisp
- Topic: Reading in Integers to a list
- Replies: 16
- Views: 14014
Reading in Integers to a list
Simple question which sadly I cannot find an answer to. Basically Im finishing up my ternary tree Program (it was in another thread) but I Have the Insert/ and print functions done. problem is is that I need to read in integers into a list before I run the insert/print function on them. Anyways Befo...
- Sun Apr 04, 2010 8:21 pm
- Forum: Common Lisp
- Topic: What exactly does DESTRUCTURING-BIND Do?
- Replies: 2
- Views: 3523
Re: What exactly does DESTRUCTURING-BIND Do?
Oh ok I think I understand, so it's a way of matching.
I've noticed it's used in "Tree's" alot. maybe simply a way of binding values to nodes perhaps
I've noticed it's used in "Tree's" alot. maybe simply a way of binding values to nodes perhaps
- Sun Apr 04, 2010 7:27 pm
- Forum: Common Lisp
- Topic: What exactly does DESTRUCTURING-BIND Do?
- Replies: 2
- Views: 3523
What exactly does DESTRUCTURING-BIND Do?
I was reading up on Trees and such in the book "Practical Common Lisp" but I dont exactly understand what DESTRUCTURING-BIND does exactly? but it seems to be used in alot of tree's when dealing with lisp? can someone give me a very simple layout of what exactly this function does? (remembe...