Welcome to dranges

Dranges is a small project to bring some new ranges and algorithms to D. Its main source of inspiration is

  • D2 std.range and std.algorithm
  • functions/actions on sequences found in other languages, like Haskell, Clojure, Python and Scala.
  • general algorithms found anywhere: permutations, graphs spanning trees, etc.

Mainly, it's a way for me to understand ranges and algorithms on sequences.

New!

Modules

As of this writing, dranges is divided into the following modules:

  • range.d, which contains new higher order ranges (drop, dropWhile, takeWhile, knit...)
  • algorithm.d, containing extensions on map/filter/reduce and some other algorithm like list comprehensions, unfold, iterate, etc.
  • phobos_extension.d, which proposes modification of std.range and std.algorithm functions: map (adding back/popBack/opIndex/length), filter (back/popBack) and some bug corrections. This module will be deprecated: the recent (2.045-2.050) versions of D2 have incorporated most of the changes presented here.

Helper modules

  • traits.d, bringing some traits used by the first two modules.
  • templates.d, templates and meta-templates.
  • typetuple.d acting on type tuples
  • functional.d, also bringing some support for range and algorithm: mainly transforming functions and transforming strings into n-ary functions.
  • predicate.d, to bring together all predicates (boolean-returning functions)
  • lambda.d, a small expression template module to create anonymous functions on the fly, with arithmetic expressions.

Extension modules

  • eager.d, eager versions of some algorithms.
  • tuple.d, functions on tuples (mapping, reducing, reversing, extracting, glueing, appending, etc.)
  • variadic.d, almost the same, but acting on variadic lists (ie T...)
  • rangeofranges.d, creating and mapping/folding on range of ranges (rank 2 or higher).
  • associative.d, to act on associatve arrays with range-like functions: filter, map, etc.
  • experiments.d, some experimentations with some not-quite-ranges.

Graph and tree modules

  • recursive.d, to experiment with recursive ranges, to act on trees and graphs while conserving the 'shape' information: mapping trees, folding them, etc.
  • morphism.d, a first try to code generalization of folds/unfolds for branching/recursive structures (branching ranges, like trees and graphs, not yet added there).
  • treerange.d a small module, just for me to understand how to iterate on binary trees.
  • graph.d, a module offering a basic graph implementation. It's coming from an old code base, and will be cleanly integrated afterwards.
  • graphalgorithm.d, offering the common graph algorithm: strongly connected components, shortest path, metagraph, spanning tree, etc.
  • graphrange.d, ways to project a graph into a linear range, by depth-first or breadth-first iteration.
  • tupletree.d, a module to work with trees encoded as tuples: heterogeneous trees.

Small containers

  • stack.d. A small module with a basic stack, used by the graph algorithms.
  • queue.d. A small module with a basic queue, used by the graph algorithms.
  • set.d. A small module with a basic set, used by the graph algorithms.
  • binaryheap.d. A small module with a basic binary heap, used by the graph algorithms.
  • priorityqueue.d. A small module with a basic priority queue, used by the graph algorithms.

Pattern modules

  • patternmatch.d. Testing waters with a pattern-matching function.
  • typepattern.d. Patterns for typetuples: 'one int, then one or more double, and then anything but a float'.
  • tuplepattern.d. Same as typepattern, but for tuples: extract values when they match some type pattern.

Zip archive

You can grab all the files in a .zip archive here. It's not updated for all revision, though. Right now, it's a rev #111 (November 12th, 2010).

TODO

Project Information

For a complete list of local wiki pages, see TitleIndex.

Namedranges
CategoryDevelopment Tools
Status3 - Alpha
Short Descriptionnew algorithms and ranges based on and inspired by D2 std.algorithm & std.range and some functional languages
Long Description
Forum/forums/viewforum.php?f=253
Home Page