Skip to content

wilzbach/linq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

A mapping of the feature set of the LINQ API to D's Range API.

Filtering

LINQ D
Where filter
OfTyp castSwitch

Projections

LINQ D
Select map
SelectMany =
Anonoymous Types Tuples
Indexed enumerate
from c in customers
from o in c.Orders
where c.Region == "WA"

Partitioning

LINQ D
Take take
Skip drop
TakeWhile until
SkipWhile find

Ordering

LINQ D
OrderBy sort
OrderBy + Comparer sort + opCmp
OrderByDescending sort
OrderByDescending + Comparer sort + opCmp
ThenBy multiSort
ThenBy + Comparer multiSort + opCmp
ThenByDescending multiSort
ThenByDescending + Comparer multiSort + opCmp
Reverse retro

Grouping

LINQ D
GroupBy chunkBy, group
GroupJoin

Grouping: https://msdn.microsoft.com/en-us/library/mt693097.aspx

Set operators

LINQ D
Distinct uniq
Union merge
Intersect setIntersection
Except setDifference

D expects sortedness of all inputs.

Conversion

LINQ D
ToArray array
ToList array
ToDictionary assocArray
ToLookup chunkby.assocArray
Cast no need (universal API)
AsQueryable isInputRange
AsEnumerable isRandomAccessRange
OfType typeof

Element operators

LINQ D
First front
FirstOrDefault r.empty ? "default" : r.front
ElementAt [[]]
ElementAtOrDefault i < r.length ? "default" : r[i]
Last back
LastOrDefault r.empty ? "default" : r.front
Single r.length == 1 ? r.front : throw new Exception("Range is supposed to contain a single value only")
SingleOrDefault r.length <= 1 ? (r.empty ? "default" : r.front ) : throw new Exception("Range is supposed to contain a single value only")

Generation operators

LINQ D
Range iota
Repeat repeat
Empty empty
DefaultIfEmpty r.empty ? "default" : r.front

Quantifiers

LINQ D
Any any
All all
Contains find, canFind

Aggregate

LINQ D
Count length if RandomAccess, otherwise walkLength
Sum sum
Min minElement
Max maxElement
Average
Aggregate reduce
LongCount length / walkLength use size_t

Equality

LINQ D
SequenceEqual equal

Concatenation

LINQ D
Concat chain

Query execution

LINQ D
Deferred Execution Ranges in D are lazy
Immediate Execution e.g. each
Query Reuse save
Custom generator generate

Joins

  • Cross Join
  • Group Join
  • Cross Join with Group Join
  • Left Outer Join

https://msdn.microsoft.com/en-us/library/mt693045.aspx

About

Feature mapping from LINQ to D Ranges

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published