- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Some guy's cad system has no vl-* functions,and I made some for him.most of implements I made are work well,but some of them are not.
Here is my implement.
my vl-remove-if,the func 1, works well.
(defun xg-remove-if (fn lst)
(cond ((null lst) nil)
(t
(if (apply fn (list (car lst)))
(xg-remove-if fn (cdr lst))
(cons (car lst) (xg-remove-if fn (cdr lst)))))))
and this is my vl-remove,the fun 2,works well too.
(defun xg-remove (elem lst) (xg-remove-if '(lambda (x) (equal elem x)) lst))
and then,I made my vl-remove-if-not,the fun 3, I would like it to work too,but it doesn't work!
(defun xg-remove-if-not (fn lst)
(xg-remove-if '(lambda (x) (not (apply fn (list x)))) lst))
I run it,the visual ide run out of it's memory and brokedown!
Why? I'm totally confused,I have no idea what happened.
Therefore, I've tried another way, I made my 2nd version of vl-remove-if-not,the fun 4, and it works!
(defun xg-remove-if-not2 (fn lst)
(vl-remove-if '(lambda (x) (not (apply fn (list x)))) lst))
Anyway, I have to deliver my functions to my guy,I made my 3rd version of vl-remove-if-not, the ugly one, the fun 5, not elegant at all.Whatever,it works well.
(defun xg-remove-if-not (fn lst)
(cond ((null lst) nil)
(t
(if (not (apply fn (list (car lst))))
(xg-remove-if-not fn (cdr lst))
(cons (car lst) (xg-remove-if-not fn (cdr lst)))))))
I wonder to know whether there is kind of bug in visual ide, because I don't find out bugs in my functions.
I rewrote those functions in dr racket, and all of them work well.
Is there anyone who could help me know what happened? Thank you for reading.
Solved! Go to Solution.