emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: moving more cl seq/mapping support into core


From: MON KEY
Subject: Re: moving more cl seq/mapping support into core
Date: Mon, 27 Sep 2010 15:07:01 -0400

On Fri, Sep 24, 2010 at 6:48 PM, MON KEY <address@hidden> wrote:

>
> Are there any others like this that I've missed?
>

Looks like I missed `edmacro-mismatch' .
This is mismatch from cl-seq.el with "mandatory keywords"...

The signatures of the two functions are quite similiar:

 (edmacro-mismatch seq1 seq2 start1 end1 start2 end2)

 (mismatch seq1 seq2 [keyword value]...)

Note, that the _real_ source level signature of `edmacro-mismatch' is:

 (edmacro-mismatch cl-seq1 cl-seq2 cl-start1 cl-end1 cl-start2 cl-end2)

Indeed `edmacro-mismatch's local vars even "borrow" from the cl "namespace" in
that it let binds cl-from-end, cl-test, cl-test-not, cl-key, and cl-from-end.
Curiously (for me anyhow) `edmacro-mismatch's has to let bind over cl-test and
cl-test-not locals b/c like its cl.el counterpart `edmacro-mismatch' even
evaluates `cl-check-match', i.e. it has to go out of its way to nullify the test
symbols.

As such the difference between the two functions is that `edmacro-mismatch'
doesn't evaluate the `cl-parsing-keywords' macro and offers the same basic set
of keywords (lest :test :test-not) they just aren't opaquely lumped into an
&rest as with `mismatch'.

Following is the wordwise diff of the two functions:

***************
*** 1,11 ****
! (defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
    "Compare SEQ1 with SEQ2, return index of first mismatching element.
  Return nil if the sequences match.  If one sequence is a prefix of the
! other, the return value indicates the end of the shorter sequence.
! \nKeywords supported:  :test :test-not :key :start1 :end1 :start2
:end2 :from-end
! \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
!   (cl-parsing-keywords (:test :test-not :key :from-end
!                               (:start1 0) :end1 (:start2 0) :end2) ()
      (or cl-end1 (setq cl-end1 (length cl-seq1)))
      (or cl-end2 (setq cl-end2 (length cl-seq2)))
      (if cl-from-end
--- 1,9 ----
! (defun edmacro-mismatch (cl-seq1 cl-seq2 cl-start1 cl-end1 cl-start2 cl-end2)
    "Compare SEQ1 with SEQ2, return index of first mismatching element.
  Return nil if the sequences match.  If one sequence is a prefix of the
! other, the return value indicates the end of the shorted sequence.
! \n(fn SEQ1 SEQ2 START1 END1 START2 END2)"
!   (let (cl-test cl-test-not cl-key cl-from-end)
      (or cl-end1 (setq cl-end1 (length cl-seq1)))
      (or cl-end2 (setq cl-end2 (length cl-seq2)))
      (if cl-from-end

--
/s_P\



reply via email to

[Prev in Thread] Current Thread [Next in Thread]