Some tools for D
Downs
default_357-line at yahoo.de
Tue Aug 21 10:19:00 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here's a collection of useful, generic tools code that extends the D
language. Originally written for Phobos, it should be easily adaptable
to Tango.
Includes:
* tools.tests: Some simple test functions for unittests,
used throughout the package itself
* tools.iter: Iterator templates, including some useful
default iterators such as the classical
map, reduce, filter and zip as well as concat
* tools.mrv: Multiple Return Values implementation, consisting
of a TupleStruct and a MultiVariableHolder based on
pointers (I've posted this one before, I believe)
* tools.ext: Combines tools.iter and tools.mrv into TSzip,
a zip iterator using tuple structs. Also allows chaining of
delegates. Example (identity function):
chain~(int e) { return e*2; }~(int e) { return e/2; }
Furthermore, a Loop template based on chain, ifIs and mustBe,
which simplify testing for an object's type. Example:
class A { } class B : A { } A foo=new B;
// evaluates to true
ifIs(foo, (B b) { return true; }, { return false; });
Furthermoar, an Integers iterator, used like Integers[5..50].
* tools.threadpool: A really simple threadpool class.
Also allows distributed foreach over an iterator.
Do not be disturbed by the total lack of comments - most of it is fairly
straightforward code which I simply didn't see any need to annotate.
Have fun!
--downs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGyx6EpEPJRr05fBERAls7AKCWtOA/gDafE8iwCOHOHhM2FayhgwCfaKSE
KoEYFlbXpQRGpCK+b8kiOBM=
=6EOM
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tools.tar.bz2
Type: application/octet-stream
Size: 4484 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070821/d4504d90/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tools.tar.bz2.sig
Type: application/octet-stream
Size: 65 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070821/d4504d90/attachment-0001.obj>
More information about the Digitalmars-d
mailing list