Search found 5 matches

by kiwifreak3
Wed Aug 01, 2012 1:42 pm
Forum: Homework
Topic: intersection of two lists
Replies: 2
Views: 13273

Re: intersection of two lists

Thanks a lot nuntius!
works perfectly now!
by kiwifreak3
Wed Aug 01, 2012 8:29 am
Forum: Homework
Topic: intersection of two lists
Replies: 2
Views: 13273

intersection of two lists

Hi, I'm trying to write a recursive function returning the intersection of two given lists... I can't figure out why I'm getting the error message: void function. I'd be grateful for help! (defun intersect(A B) (if (eq A ()) A (if (member (car A) B) (push (car A) (intersect(cdr A) B)) (intersect(cdr...
by kiwifreak3
Sun Jun 10, 2012 6:23 am
Forum: Homework
Topic: Code for calculating difference of sets not working
Replies: 4
Views: 10608

Re: Code for calculating difference of sets not working

Tanks so much, that realy is so much more simple than my version...

Code: Select all

; calculates A\B
(let (C)
  (dolist (element A)
    (if (not (member element B))
	(push element C)
    )
  )
C
)
)
(diff '(a b a c d) '(c d e d e f))
by kiwifreak3
Sun Jun 10, 2012 2:04 am
Forum: Homework
Topic: Code for calculating difference of sets not working
Replies: 4
Views: 10608

Re: Code for calculating difference of sets not working

Thanks a lot Ramarren, you really helped me out there... I see I made quite some mistakes; I think I've got rid of them now although I'm still using the setq command within the while-loop, because I can't quite figure out where I should put the end-bracket of let otherwise (- perhaps after the end-b...
by kiwifreak3
Sat Jun 09, 2012 8:42 am
Forum: Homework
Topic: Code for calculating difference of sets not working
Replies: 4
Views: 10608

Code for calculating difference of sets not working

Hi everyone, I'm trying to write a program (in emacslisp) to calculate the difference of two lists; could someone give me a hint as to why my code is returning an error saying "invalid function...", when I try it on an example? I'd be grateful for help, Thanks (defun diff (A B) ; calculate...