Search found 406 matches

by gugamilare
Sat Mar 21, 2009 5:39 am
Forum: Common Lisp
Topic: Better then loop/iterate?
Replies: 41
Views: 58419

Re: Better then loop/iterate?

That said, LOOP is standard and documented, and you can always count on it being there. It certainly has limitations (the extensibility of ITERATE is very interesting, too), but a flawed standard is often better than a perfect extension in terms of creating a baseline for interoperability. Well, I ...
by gugamilare
Sat Mar 21, 2009 5:22 am
Forum: Common Lisp
Topic: Playing with iterate
Replies: 4
Views: 5833

Re: Playing with iterate

One problem about interning iterate symbols I had was with metatilities. Metatilities' and iterate's package both export the symbol minimize (and another symbol I can't remember), so using both packages generates a conflict. Fortunatelly, I don't use those functions in metatilities, so I just shadow...
by gugamilare
Sat Mar 21, 2009 5:17 am
Forum: The Lounge
Topic: Qt and Lisp...a great opportunity?
Replies: 18
Views: 41684

Re: Qt and Lisp...a great opportunity?

Wow, nice! This is a great new.
by gugamilare
Thu Mar 19, 2009 3:19 pm
Forum: Common Lisp
Topic: Better then loop/iterate?
Replies: 41
Views: 58419

Re: Better then loop/iterate?

I agree that loop shouldn't be standard. It is a monster macro which was firstly created to make the learning process easier for beginners. What most annoys me is that you can't write (loop for elt in list (if elt (collect elt))) I am obligated to write (loop for elt in list if elt collect elt) This...
by gugamilare
Thu Mar 19, 2009 7:19 am
Forum: Common Lisp
Topic: Recursive macro.
Replies: 6
Views: 10854

Re: Recursive macro.

I don't know how to make that funcall with multiple elements, but the following might help: Are you looking for apply? (apply #'+ '(1 2 3)) => 6 A quick hack: (defun n-mapcar (func lists) (if (null (cdr lists)) (car lists) (let ((acc ())) (dolist (x (car lists)) (dolist (y (cadr lists)) (push (func...
by gugamilare
Wed Mar 18, 2009 7:20 pm
Forum: Common Lisp
Topic: Better then loop/iterate?
Replies: 41
Views: 58419

Re: Better then loop/iterate?

Implemented. I tried to get it to work for a list directly, but somehow (setf last (last last)) doesn't get it to work properly. I just did it by adding them one by one. I have (collecting &rest collected), instead of a single argument; i wouldn't know what to do with the rest of the arguments ...
by gugamilare
Tue Mar 17, 2009 5:05 pm
Forum: Common Lisp
Topic: Better then loop/iterate?
Replies: 41
Views: 58419

Re: Better then loop/iterate?

Hum, I had fixed that, but copied the wrong version. Basically, it works with 2 variables, the "list" itself and "last", which is analogous to (last list) (i.e. if you call (last list) you obtain the same value which last is bound to).. (let ((list nil) (last nil)) (flet ((collec...
by gugamilare
Tue Mar 17, 2009 9:20 am
Forum: Common Lisp
Topic: Better then loop/iterate?
Replies: 41
Views: 58419

Re: Better then loop/iterate?

I hate loop and love iterate. One problem (which is mostly not a big deal) is that iterate sometimes does not respect order of the computation (I do not have examples of this right now), but it works quite well. The only big problem with iterate is that the symbols you have to use are the ones expor...
by gugamilare
Tue Mar 17, 2009 8:53 am
Forum: Common Lisp
Topic: pushing links, not elements
Replies: 15
Views: 27956

Re: pushing links, not elements

I just remembered why i associated using lists as reference as causing trouble, If x is a variable, (list x) does not behave as a reference to x, since x is passed by value to list. (let ((x 1)) (flet ((set-two (ref) (setf (car ref) 2))) (set-two (list x))) x) => 1 But here comes a distinction. I d...
by gugamilare
Mon Mar 16, 2009 4:39 pm
Forum: Other Dialects
Topic: Lisp type system, lang-lisp
Replies: 8
Views: 20929

Re: Lisp type system, lang-lisp

Don't really get what you mean here, as i said i should learn some more. But that this works, does not mean that the way lang-lisp would do it is worse. You can see this in CFFI's documentation (compile-to-foreign and compile-from-foreign generic functions). Anyway, I won't insist in this subject a...