emacs-devel
[Top][All Lists]
Advanced

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

Re: Why aren't there functions such as filter, take-while, etc. "by def


From: Deniz Dogan
Subject: Re: Why aren't there functions such as filter, take-while, etc. "by default"?
Date: Sun, 25 Apr 2010 22:27:18 +0200

2010/4/25 David Kastrup <address@hidden>:
> Deniz Dogan <address@hidden> writes:
>
>> Why does it have to be so hard to write Emacs Lisp without requiring cl?
>>
>> Why aren't there functions such as filter (the equivalent of
>> remove-if-not in cl-seq.el), take-while, reduce etc. "native" in
>> Emacs?
>
> They make for no-surprise efficient programs primarily when the language
> has lexical closures.
>

I see, I had never thought of that.

What about including these functions "by default" (or other
implementations of them) but with warnings in the docstrings about the
possibly unexpected behavior due to the dynamic scoping?

There are already functions that don't always act like one could
expect, e.g. `sort' which given a list and a predicate sorts the list
destructively (rendering the original list useless) and then returns a
sorted copy of the original list. These two behaviors are usually
mutually exclusive in other languages.

(let* ((my-list (list 3 2 1))
       (sorted (sort my-list '<)))
  my-list) ;; returns (3)

-- 
Deniz Dogan




reply via email to

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