Attila Lendvai | 3 Apr 16:57 2008
Picon

Re: Re: length=1

>  then i thought of turning length= into a function that takes &rest
>  arguments and each argument can be either an integer or a sequence.
>  you can find the current implementation at the end of the mail, but
>  i'm not sure vetoers will like it... it's somewhat dwim-ish in that it
>  accepts both integers and sequences at any position, but on the other
>  hand anything else feels crippled from the user point of view.

final call for vetos for length=...

--

-- 
 attila
Tobias C. Rittweiler | 4 Apr 23:25 2008
Picon

Re: [PATCH] COPY-HASH-TABLE

"Tobias C. Rittweiler" <tcr <at> freebits.de> writes:

> "Nikodemus Siivola" <nikodemus <at> random-state.net> writes:
>
> > Perhaps you might be better served with MAP-HASH-TABLE, which maps
> > into a new hash-table? Something like this (untested), maybe:
>
> I can see this being the better choice. I'll make the necessary changes.

This can finally be pulled from

  http://common-lisp.net/~trittweiler/darcs/alexandria/
Tobias C. Rittweiler | 5 Apr 14:19 2008
Picon

DOSEQUENCE and WITH-SEQUENCE-ITERATOR


* sequences.lisp (dosequence): New macro. DOLIST analagon.
(with-sequence-iterator): New macro. WITH-HASH-TABLE-ITERATOR analogon.
(%make-sequence-iterator): New internal function.

* package.lisp: Export DOSEQUENCE, and WITH-SEQUENCE-ITERATOR.

* tests.lisp (dosequence.1): New test case.
(with-sequence-iterator.1): Ditto.
(with-sequence-iterator.2): Ditto.

pullable from

 http://common-lisp.net/~trittweiler/darcs/alexandria/

  -T.
Samium Gromoff | 14 Apr 19:56 2008
X-Face
Picon

BISECT


Good day list,

I believe the code below might meet the conservative standards of Alexandria.

What do you think?

(defun bisect (test n &optional (base 0))
  "Find, using bisection, the largest positive integer below N and above,
   or equal to BASE, which satisfies TEST of one argument.
   Assumes monotonous truth value of TEST."
  (labels ((traverse (x fallback attack)
             (if (funcall test x)
                 (cond ((zerop attack) x)
                       ((= attack 1)   (if (funcall test (1+ x)) (1+ x) x))
                       (t              (rebalance x (1+ attack))))
                 (cond ((= fallback 1) (when (funcall test (1- x)) (1- x)))
                       (t              (rebalance (- x fallback) fallback)))))
           (rebalance (origin span &aux (middle (ash span -1)))
             (traverse (+ origin middle) middle (- span middle 1))))
    (rebalance base (- n base))))

regards, Samium Gromoff

Gmane