Search found 78 matches

by David Mullen
Wed Apr 13, 2016 1:45 pm
Forum: The Lounge
Topic: New to Lisp and a bit confused...
Replies: 2
Views: 16530

Re: New to Lisp and a bit confused...

If you come to Lisp with the stance of trying to find a use for this or a use for that, you're bound to be confused. Common Lisp—never mind the implementation-specific stuff—has a shit-ton of features. So the short answer is that each feature got added at some point because somebody needed it—...
by David Mullen
Wed Apr 13, 2016 1:07 pm
Forum: Common Lisp
Topic: Genetic algorithms
Replies: 5
Views: 13197

Re: Genetic algorithms

You can randomize it with sort: (defparameter *lst* (list a b c d)) ; list of the elements (setf *lst* (sort *lst* (lambda (&rest lst) (< 0.5 (random 1.0))))) That code seems work,but how exactly that work? It won't work with every sorting algorithm. With something like quicksort, you're partit...
by David Mullen
Thu Apr 07, 2016 10:48 am
Forum: Common Lisp
Topic: Genetic algorithms
Replies: 5
Views: 13197

Re: Genetic algorithms

What are the elements of the list? I imagine a destructive shuffle would be fast enough—but that's assuming you already have a list for shuffling.
by David Mullen
Sat Mar 19, 2016 8:40 pm
Forum: Common Lisp
Topic: How can I process RUNE-DOM::ELEMENTs?
Replies: 12
Views: 31685

Re: How can I process RUNE-DOM::ELEMENTs?

I guess what I'd do, then, is take the most direct route. Walk the elements DOM-wise and build a list structure recursively. Something like this ought to work: (defun attribute-list (attribute) (list (dom:name attribute) (dom:value attribute))) (defun node-expression (node) (if (dom:text-node-p node...
by David Mullen
Sat Mar 19, 2016 3:35 pm
Forum: Common Lisp
Topic: How can I process RUNE-DOM::ELEMENTs?
Replies: 12
Views: 31685

Re: How can I process RUNE-DOM::ELEMENTs?

OK. How about this. If we have the matching box-elements, then stick them in a document and try the dom:map-document thing as I suggested previously. Something like this: (loop with mini-document = (dom:create-document 'rune-dom:implementation nil nil nil) with root = (dom:append-child mini-document...
by David Mullen
Sat Mar 19, 2016 3:00 pm
Forum: Common Lisp
Topic: How can I process RUNE-DOM::ELEMENTs?
Replies: 12
Views: 31685

Re: How can I process RUNE-DOM::ELEMENTs?

Maybe something like (I'm going strictly from the documentation here) this:

Code: Select all

(dom:map-document (cxml-xmls:make-xmls-builder) document)
Does that work? I don't know. I don't have CXML installed. Just taking a stab at it.
by David Mullen
Sat Mar 19, 2016 1:58 pm
Forum: Common Lisp
Topic: How can I process RUNE-DOM::ELEMENTs?
Replies: 12
Views: 31685

Re: How can I process RUNE-DOM::ELEMENTs?

The DOM is what it is. It isn't Lispy and it isn't exactly lightweight from a conceptual standpoint, but, hey, it's a "standard." I imagine you can use it to pick out the relevant pieces from the elements and build a more useful structure.
by David Mullen
Sat Mar 19, 2016 12:52 pm
Forum: Common Lisp
Topic: How can I process RUNE-DOM::ELEMENTs?
Replies: 12
Views: 31685

Re: How can I process RUNE-DOM::ELEMENTs?

It's not exhaustive, I guess, in that it doesn't document the DOM interface itself. You could look at how the DOM gets used in domtest.lisp.
by David Mullen
Sun Mar 13, 2016 3:38 pm
Forum: Common Lisp
Topic: Vacuum agent problem
Replies: 1
Views: 6186

Re: Vacuum agent problem

In find-some-in-grid, that last reference to BEST is outside of the let form that binds it.
by David Mullen
Sat Mar 12, 2016 11:33 am
Forum: Common Lisp
Topic: New to LISP
Replies: 3
Views: 9368

Re: New to LISP

You mean you want the position to be global variables instead of parameters?