Search found 15 matches

by murali
Wed Jul 06, 2011 5:06 pm
Forum: Common Lisp
Topic: counting if equal
Replies: 9
Views: 7856

the third trail

for this code i dont know the error but it seems to be corect with a small error

Code: Select all

(setq y 0)
(defun counting (x l)
  (cond
   ((null l) 0)
   ((eq x (car l) ) (setq y (+ y 1)) )
   (t  (counting x (cdr l)))
))
by murali
Wed Jul 06, 2011 3:43 pm
Forum: Common Lisp
Topic: counting if equal
Replies: 9
Views: 7856

another trail

(defun count3(x l)
(cond
((null l) 0)
((count x (car l)) (count3 (cdr l)))
(t f)
)
)
by murali
Wed Jul 06, 2011 3:01 pm
Forum: Common Lisp
Topic: counting if equal
Replies: 9
Views: 7856

Re: counting if equal

Ya my work for above one is using recursion as followos

(defun count1(x l y)
(cond
((null l) 0)
((eq x (car(l))) (setq y (+ y 1)))
(t (count1( (x (cdr(l)) y)
))
by murali
Wed Jul 06, 2011 2:18 pm
Forum: Common Lisp
Topic: counting if equal
Replies: 9
Views: 7856

counting if equal

Write a LISP function "count" of two arguments, an atom x and a list L, which returns the number of times that x appears in the list L. Use recursion. example: > (count ‘a `(a b c a c a) ). Returns: 3 > (count ‘d ‘(a b c a c a) ) Returns: 0 Write the LISP function “count” of exer...
by murali
Sat Jul 02, 2011 7:27 pm
Forum: Common Lisp
Topic: partial paths
Replies: 7
Views: 6576

Re: partial paths

what would we replace set!
by murali
Fri Jul 01, 2011 4:02 pm
Forum: Common Lisp
Topic: partial paths
Replies: 7
Views: 6576

Re: partial paths

i got some code like this (define (partialpaths X Y) (cond ((null? X) Y) ((member1 (car(car X)) Y) (partialpaths (cdr X) Y)) (#t (cons (car(car X)) Y)) ) ) (define (member1 X Y) (cond ((null? X) #f) ((eq? Z (car X)) #t) (#t (member1 Z (cdr X))) ) ) but i am not sure this code by using lisp.
by murali
Fri Jul 01, 2011 2:08 pm
Forum: Common Lisp
Topic: partial paths
Replies: 7
Views: 6576

Re: partial paths

k thank u very much for u r help my friend
by murali
Fri Jul 01, 2011 2:01 pm
Forum: Common Lisp
Topic: partial paths
Replies: 7
Views: 6576

partial paths

CAN ANY ONE HELP Write the function partialpaths, of two arguments. The first argument is a list of lists, representing a graph(adjacency list representation of a graph). The second argument is a partial path in the reverse order, for example the path "from a to b to c" is represented by t...
by murali
Fri Jul 01, 2011 1:48 pm
Forum: Common Lisp
Topic: ascending-help me
Replies: 4
Views: 5052

Re: ascending-help me

thank u
by murali
Fri Jul 01, 2011 1:21 pm
Forum: Common Lisp
Topic: any function is there
Replies: 4
Views: 4752

any function is there

is there any funtion to test wherther the given list is in ascending or descendin order
I saw one funtion INSEQA but ts not working