Why I chose D over Ada and Eiffel

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Aug 21 10:48:49 PDT 2013


On 8/21/13 5:39 AM, Joseph Rushton Wakeling wrote:
> On 20/08/13 22:43, Andrei Alexandrescu wrote:
>> It's a common omission to equate D's ranges with pipes/filters. That
>> misses the
>> range categorization, which is inspired from C++ iterators.
>>
>> A relatively accurate characterization of D ranges is a unification of
>> C++
>> iterators with pipes/filters.
>
> I'm not sure I quite follow this point.  The Clojure sequence API has
> all the stuff you'd expect from the range interface -- empty?, first
> (front), next (popFront), nnext (popFrontN), last (back), drop-last
> (popBack), ...

No random access. I didn't know about drop-last though - does it work in 
O(1)?

> Is the point here that in Clojure these are all implemented as
> pipes/filters on top of singly-linked lists, whereas in D range
> interfaces are a "first-class" part of the language that is agnostic
> about the underlying data structures?

More accurately was the point that Clojure's sequence API is (to the 
best of my understanding) only dealing with forward access, whereas D 
distinguishes between one-pass, forward, bidirectional, and random, and 
designs algorithms around these notions.


Andrei



More information about the Digitalmars-d mailing list