Search found 11 matches

by Johny22
Tue Nov 10, 2009 2:24 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

I made them work :d, thanks to all that tried to help me :D
by Johny22
Sun Nov 01, 2009 8:01 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

I've wrote these 3 functions : (defun flatten (list) "Flatten the list" (if (null list) '() (loop for i in list if (listp i) append (flatten i) else collect i) ) ) (defun rem_mo (list) "Remove the math operators" (if (null list) '() (delete-if-not #'alphanumericp list) ) ) (defun...
by Johny22
Sat Oct 31, 2009 1:42 pm
Forum: Emacs Lisp
Topic: nth element of a lisp
Replies: 5
Views: 21896

Re: nth element of a lisp

Like Cristopher Oliver said, u can use the nth function. [Function] nth n list (nth n list) returns the nth element of list, where the car of the list is the ``zeroth'' element. The argument n must be a non-negative integer. If the length of the list is not greater than n, then the result is (), tha...
by Johny22
Sat Oct 31, 2009 1:36 pm
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

for the problem where i need to get the nth variable from an expresion, I found how to flatten the list :), here is the code i used (i used the loop function :)): (defun flatten (list) (loop for i in list if (listp i) append (flatten i) else collect i) ) Now i want to use the alpha-char-p and alphan...
by Johny22
Sat Oct 31, 2009 9:20 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

For the second problem with nth var, how can i use delete-if ? i tried writing some code but it didn't work :(, can someone help me with this code and correct it if necesary ? (defun nth_var (el l) (if (null l) '() (and (delete-if-not #' (lambda (x) alpha-char-p (x)) (l))(delete-if-not #' (lambda (x...
by Johny22
Fri Oct 30, 2009 9:21 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

I do not know the concept of nested list, can you please explain a little ?
by Johny22
Fri Oct 30, 2009 2:32 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

the argument can also be like (+ (* a b)(/ c a )), i think i will combine that alphanumericp and numberp functions to remove any other symbol and than use nth on the resulting list.

Thanks for the tip about the alphanumericp function !
by Johny22
Thu Oct 29, 2009 4:38 pm
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

i mean like this (+ (* 2 3) (/ 8 2)), or more complex ones, i wonder if there is a function that test for alpha-numeric elements, for example : if not alpha-numeric remove from list => ((2 3)(8 2)) and then to aply the nth element to return the variable that i look, but for this i will look into mys...
by Johny22
Thu Oct 29, 2009 3:16 pm
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

That is only a simple example, for more complex ones the math operator can be somewhere in the middle, anyway I will read more about flattening and try that one. For the first one, i don't really know hoe else to explain :(. I will try this way: a this is my tree example / \ b e / \ c d In LISP i ca...
by Johny22
Thu Oct 29, 2009 11:29 am
Forum: Common Lisp
Topic: Need some help..
Replies: 17
Views: 17698

Re: Need some help..

I didn't said it isn't a homework(sorry anyway, it is my first time here on this forum), i tried to do it for the last 2 days and nothing good. this is the reason why i asked here, maybe someone who knows more can help. For the first problem I need to convert from one tree form into another. For the...