Search found 406 matches

by gugamilare
Thu Mar 01, 2012 3:05 pm
Forum: Common Lisp
Topic: iterating through the same list with two indices
Replies: 3
Views: 2987

Re: iterating through the same list with two indices

I don't think the solution with MAPCAR is ugly at all, it's only verbose, but lispy at the same time

Another option would be:

Code: Select all

(loop for (elt1 . rest) on THE-LIST do
     (loop for elt2 in rest do
          (test-the-items elt1 elt2)))
by gugamilare
Tue Feb 28, 2012 3:55 pm
Forum: Common Lisp
Topic: Load a LISP Application into Java
Replies: 6
Views: 3354

Re: Load a LISP Application into Java

I added CODE tags in the last post for the identation of the code to be preserved.
by gugamilare
Sat Feb 25, 2012 7:48 pm
Forum: The Lounge
Topic: Grammar for message parsing?
Replies: 3
Views: 5896

Re: Grammar for message parsing?

The solution I comonly use is cl-yacc (manual). It is very simple to use IMO.

There are also other options available.
by gugamilare
Sat Feb 25, 2012 6:26 pm
Forum: Common Lisp
Topic: Optimizing speed and fixnum literal
Replies: 7
Views: 6229

Re: Optimizing speed and fixnum literal

AFAICT, fixnums are 63 bits wide on AMD64. (The SBCL internals wiki claims otherwise, but on my machine at least, MOST-POSITIVE-FIXNUM is 4611686018427387903, which is 2^62-1.). Thus, (* 3 m) is potentially outside the range of (SIGNED-BYTE 64) even for a fixnum m . In fact, those messages emitted ...
by gugamilare
Sat Feb 25, 2012 6:15 pm
Forum: Common Lisp
Topic: Finding number of saddle points of a matrix
Replies: 6
Views: 4308

Re: Finding number of saddle points of a matrix

You got it backwards. First you compute the saddle points of the submatrix, only then you use that information to compute the saddle points of the whole matrix.

It's more like merge sort than like quicksort. It's divide and conquer (merge sort), not conquer and divide (quicksort).
by gugamilare
Fri Feb 24, 2012 5:27 am
Forum: Common Lisp
Topic: Optimizing speed and fixnum literal
Replies: 7
Views: 6229

Re: Optimizing speed and fixnum literal

The problem is not that the 3 itself, it's that (* 3 m) isn't guaranteed to be a fixnum if m is, because it's thrice as large as m . If you're certain that (* 3 m) will never exceed the fixnum range, you can annotate it by saying (the fixnum (* 3 m)) . Actually, that is not quite accurate. If M was...
by gugamilare
Thu Feb 23, 2012 1:41 pm
Forum: Common Lisp
Topic: Load a LISP Application into Java
Replies: 6
Views: 3354

Re: Load a LISP Application into Java

Indeed, I'm not a big fan of Clojure and its purist ideology of side-effect-free programming.

Java does lack a good support from Lisp side. Python, on the other hand, has better options and is more similar to Lisp, in case you have the option of using Python instead of Java :)
by gugamilare
Wed Feb 22, 2012 1:18 pm
Forum: Common Lisp
Topic: Load a LISP Application into Java
Replies: 6
Views: 3354

Re: Load a LISP Application into Java

Try contacting ABCL's mailing list.

If you don't mind abandoning Common Lisp, you can try out Clojure.
by gugamilare
Tue Feb 21, 2012 9:09 pm
Forum: Common Lisp
Topic: Finding number of saddle points of a matrix
Replies: 6
Views: 4308

Re: Finding number of saddle points of a matrix

Divide and conquer :) Divide the matrix in 4 (cut in half both horizontally and vertically), then (recursively) find the saddle points in the submatrix. Then, any possible saddle point of the matrix must be one of the saddle points of the submatrix. For instance, to test if a saddle point of the upp...
by gugamilare
Tue Feb 21, 2012 9:54 am
Forum: Common Lisp
Topic: LIST vs TICK in a LET causing a global side-effect?!?
Replies: 6
Views: 3208

Re: LIST vs TICK in a LET causing a global side-effect?!?

Simplifying what Ramarren said, if you want to be able to modify the data, don't use TICK or QUOTE, and don't use array notation like #a(1 2 3). In those cases, construct the data with the appropriate functions, like LIST, VECTOR or MAKE-ARRAY.