Search found 12 matches

by samohtvii
Sun Sep 23, 2012 11:37 pm
Forum: Common Lisp
Topic: Binary tree insert.
Replies: 4
Views: 7463

Binary tree insert.

Ok I have one last problem... I have a binary tree like this.... (question1 (question2 (question4 (answ3) (answ4) ) (question5 (answ5) (answ6) ) ) (question3 (answ1) (answ2) ) ) question1 / \ question2 question3 / \ / \ question4 question5 answ1 answ2 / \ / \ answ3 answ4 answ5 answ6 yes goes left an...
by samohtvii
Sat Sep 22, 2012 9:32 pm
Forum: Common Lisp
Topic: Capitalize Lisp
Replies: 4
Views: 7359

Re: Capitalize Lisp

Thanks guys. Both really helpful. One last question. What is the easiest way to check if the letter i extracted is a vowel.
instead of writing a lot of if statements is there a way to check all vowels at one?
Thanks
by samohtvii
Sat Sep 22, 2012 12:17 am
Forum: Common Lisp
Topic: variable list - getting the element
Replies: 1
Views: 3967

variable list - getting the element

I have a list that only contains 1 element like this (setq x ("Thomas") (somefunction x)) (defun somefunction (x) (print x)) That's basically the problem I have in my code. I can't paste my code exactly cause a) it's too long and the problem is for a specific bit, prob just mak it more con...
by samohtvii
Fri Sep 21, 2012 6:39 pm
Forum: Common Lisp
Topic: Saving a list of variables
Replies: 3
Views: 6380

Saving a list of variables

How can you get input from a user and save that data in a list. e.g. (format t "First question?") (let ((firstQuestion (read-line))) //second question (let ((secondQuestion (read-line))) //third (let ((thirdQuestion (read-line))) (setq allQuestions '(firstQuestion secondQuestion thirdQuest...
by samohtvii
Fri Sep 21, 2012 5:57 pm
Forum: Common Lisp
Topic: Printing a list of lists
Replies: 6
Views: 9594

Re: Printing a list of lists

Sorry for the confusion but the DB contains an unknown amount of lists so I can't just print them all out one by one, like i think the last 2 suggestions where.
by samohtvii
Thu Sep 20, 2012 10:08 pm
Forum: Common Lisp
Topic: Capitalize Lisp
Replies: 4
Views: 7359

Capitalize Lisp

Is there any function to automatically make a string uppercase or lowercase or to capitalize the first letter?
I'm also looking to take a string and 'inspect' the first character so with : "example" i would want to get e as a variable.

THanks
by samohtvii
Wed Sep 12, 2012 8:41 pm
Forum: Common Lisp
Topic: Printing a list of lists
Replies: 6
Views: 9594

Re: Printing a list of lists

This might give you some ideas. (let ((db '((1 2) (1 2 3 4)))) (dolist (data db) (print (loop for x in data by #'cddr collecting x)))) (let ((db '((1 2) (1 2 3 4)))) (getf (cadr db) 3)) (let ((db '((1 2) (1 2 3 4)))) (dolist (data db) (print (loop for (key . val) on data by #'cddr collecting key)))...
by samohtvii
Tue Sep 11, 2012 9:44 pm
Forum: Common Lisp
Topic: Lambda vs Defun
Replies: 4
Views: 7958

Re: Lambda vs Defun

Does lisp care which one you use because I have a function that is not being evaluated ever. No matter where i put it in my code just to test it skips over it. I thought it may need to be a lambda function or something strange like that. Simply it looks like this. (defun dosomething(name) (format t ...
by samohtvii
Tue Sep 11, 2012 9:17 pm
Forum: Common Lisp
Topic: Lambda vs Defun
Replies: 4
Views: 7958

Lambda vs Defun

Can someone explain the difference between Lambda and Defun and when to use each one.
I have just been using defun the whole time.

Thanks
by samohtvii
Tue Sep 11, 2012 8:40 pm
Forum: Common Lisp
Topic: Printing a list of lists
Replies: 6
Views: 9594

Printing a list of lists

I made a database named db. db contains lists. db = ((a list)(a list)(a list)) a list = (:Question question :Answer answer) How can I print the question only and not the answer. (car (car db)) gives me "QUESTION" and not the data in question. I am pretty new to LISP so, yeah... Even better...