Search found 12 matches

by Lispoman
Sat Aug 22, 2009 5:45 am
Forum: Common Lisp
Topic: How to modify a function the way I need?
Replies: 2
Views: 4199

How to modify a function the way I need?

Hi all. I have a function which places @ symbol before every negative or evenp element of a list. It look's like this This is an example for even elements. (defun mufunc (x) (cond ((null x) nil) ((evenp (car x)) (cons (intern (format nil "@~a" (car x))) (mufunc (cdr x)))) (T (cons (car x) ...
by Lispoman
Wed Jun 10, 2009 3:17 am
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Nope I say it again... It isnt homework
by Lispoman
Tue Jun 09, 2009 5:02 pm
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Thanks but I've already combined two functions in a single one

Code: Select all

(defun myfunc (x)
   (cond ((null x) nil)
      ((< (car x) 0) (cons (intern (format nil "*~a" (car x))) (myfunc (cdr x))))
      (T (cons (car x) (myfunc (cdr x))))))
And now I need to modify this function with lambda.
by Lispoman
Tue Jun 09, 2009 12:28 am
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Thanks. But I need to modify this function with lambda
by Lispoman
Mon Jun 08, 2009 11:43 pm
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

After reading some philosophial and prectical books about lisp. :o After understanding some purposes of lambda functions and calls. :!: Guys! I still can't done my lamda call. I've modified a previous code :idea: Now it looks like this (defun myfunc (x) (cond ((null x) nil) ((< (car x) 0) (cons (int...
by Lispoman
Wed Jun 03, 2009 5:59 am
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Thanks again! Solved.

Ive just ried to run this code

Code: Select all

(defun add (number)
  (intern (format nil "*~a" number)))
in muLisp. but it retur error. I think it does not support format command. Is there a way to replace format by other code to get it work in muLisp?
by Lispoman
Tue Jun 02, 2009 10:10 pm
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Yeea! Solved. Nice working. (defun add (number) (intern (format nil "*~a" number))) (defun myfunc (x) (cond ((null x) nil) ((< (car x) 0) (cons (add (car x)) (myfunc (cdr x)))) (T (cons (car x) (myfunc (cdr x)))))) Thanks Now the question can lisp differ even and odd numbers? And how can t...
by Lispoman
Tue Jun 02, 2009 9:10 pm
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Yes you right. This code has no any practical value but. I need a sample how to do such a transform because I need to use it in some functions. I did'n post my code here cause it will take a lot to explain the purpose but I need such a so called transfirmation of the list. A function above is just w...
by Lispoman
Tue Jun 02, 2009 7:25 pm
Forum: Common Lisp
Topic: Need help with lambda function
Replies: 7
Views: 9658

Re: Need help with lambda function

I've tried to understand but have understood only a healf :? I can't clearly understand a code. (defun test(n) (greaterp high n low)) //That's clear: a function test with parameter n but what (greaterp high n low) mean? (setq l ‘(4 7 2)) //Here creation of the list l (4 7 2) (setq high 7) //Then a...
by Lispoman
Tue Jun 02, 2009 6:09 pm
Forum: Common Lisp
Topic: Replacing elements in a list
Replies: 22
Views: 25612

Re: Replacing elements in a list

Thanks for your attention. Ok let me to explain. So i have a list A(1 2 4 -1 3 -2 6 -8). As you see here is some members which has <0 values For ex. -1 -2 -8. and some members are >0 ok just simple list. ;) Now the goal. I need a function which place a symbol * before every member which has <0 value...