All Projects → RealyUniqueName → Iterators

RealyUniqueName / Iterators

Licence: MIT license
A collection of useful iterators for Haxe

Programming Languages

haxe
709 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to Iterators

Gkvdb
[mirror] Go语言开发的基于DRH(Deep-Re-Hash)深度哈希分区算法的高性能高可用Key-Value嵌入式事务数据库。基于纯Go语言实现,具有优异的跨平台性,良好的高可用及文件IO复用设计,高效的底层数据库文件操作性能,支持原子操作、批量操作、事务操作、多表操作、多表事务、随机遍历等特性。
Stars: ✭ 109 (+419.05%)
Mutual labels:  iterator
Staticvec
Implements a fixed-capacity stack-allocated Vec alternative backed by an array, using const generics.
Stars: ✭ 236 (+1023.81%)
Mutual labels:  iterator
ctl
My variant of the C Template Library
Stars: ✭ 105 (+400%)
Mutual labels:  iterator
Designpatterns
🔑Elements of Reusable Object-Oriented Software🔓is a software engineering book describing software design patterns. The book's authors are Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch.
Stars: ✭ 134 (+538.1%)
Mutual labels:  iterator
Php Pdo Mysql Class
A PHP MySQL PDO class similar to the the Python MySQLdb, which supports iterator and parameter binding when using "WHERE IN" statement.
Stars: ✭ 213 (+914.29%)
Mutual labels:  iterator
oh-my-design-patterns
🎨 Record the articles and code I wrote while learning design patterns
Stars: ✭ 33 (+57.14%)
Mutual labels:  iterator
Easyiterator
🏃 Iterators made easy! Zero cost abstractions for designing and using C++ iterators.
Stars: ✭ 107 (+409.52%)
Mutual labels:  iterator
php-collections
A collection library for php
Stars: ✭ 34 (+61.9%)
Mutual labels:  iterator
Libdict
C library of key-value data structures.
Stars: ✭ 234 (+1014.29%)
Mutual labels:  iterator
spellbook
Functional library for Javascript
Stars: ✭ 14 (-33.33%)
Mutual labels:  iterator
Mir Algorithm
Dlang Core Library
Stars: ✭ 143 (+580.95%)
Mutual labels:  iterator
Pydesignpattern
Design Pattern that described by Python, This is the source code for the book of Everybody Know Design Patterns.
Stars: ✭ 174 (+728.57%)
Mutual labels:  iterator
AsyncIterator
An asynchronous iterator library for advanced object pipelines in JavaScript
Stars: ✭ 43 (+104.76%)
Mutual labels:  iterator
Rubico
[a]synchronous functional programming
Stars: ✭ 133 (+533.33%)
Mutual labels:  iterator
php-sorted-collections
Sorted Collections for PHP
Stars: ✭ 22 (+4.76%)
Mutual labels:  iterator
Gods
GoDS (Go Data Structures). Containers (Sets, Lists, Stacks, Maps, Trees), Sets (HashSet, TreeSet, LinkedHashSet), Lists (ArrayList, SinglyLinkedList, DoublyLinkedList), Stacks (LinkedListStack, ArrayStack), Maps (HashMap, TreeMap, HashBidiMap, TreeBidiMap, LinkedHashMap), Trees (RedBlackTree, AVLTree, BTree, BinaryHeap), Comparators, Iterators, …
Stars: ✭ 10,883 (+51723.81%)
Mutual labels:  iterator
iterator-driver
迭代器驱动
Stars: ✭ 32 (+52.38%)
Mutual labels:  iterator
deque
JavaScript implementation of a double-ended queue
Stars: ✭ 17 (-19.05%)
Mutual labels:  iterator
staticstep
Provides truly zero-cost alternatives to Iterator::step_by for both incrementing and decrementing any type that satisfies RangeBounds<T: Copy + Default + Step>.
Stars: ✭ 13 (-38.1%)
Mutual labels:  iterator
betterator
💯 A better sync and async iterator API.
Stars: ✭ 57 (+171.43%)
Mutual labels:  iterator

Iterators Build Status

This is a set of frequently used iterators for Haxe collections and other types.

All iterators are designed to have zero impact on runtime performance.

Compatible with Haxe 3.4 and 4.0

Installation

haxelib install iterators

Usage

using Iterators;

for(i in 10.to(0).step(-2)) { //.step() is optional
	trace(i);
}

var str = 'hello';
for(c in str.chars()) {
	trace(c);
}

Full list of available iterators:

class MapIterators {
	/**
	 *  Map iterator which allows you to get key & value in one go.
	 *  ```
	 *  var m = [1 => 'hello'];
	 *  for(p in map.pairs()) {
	 *  	trace(p.key); // 1
	 *  	trace(p.value); // hello
	 *  }
	 *  ```
	 */
	static public inline function pairs<K,V>(map:Map<K,V>) return new MapPairIterator(map);
}
class DynamicAccessIterators {
	/**
	 *  Iterator for `haxe.DynamicAccess` which allows you to get key & value in one go.
	 *  ```
	 *  var obj:DynamicAccess<String> = {hello:'world'};
	 *  for(p in obj.pairs()) {
	 *  	trace(p.key); // hello
	 *  	trace(p.value); // world
	 *  }
	 *  ```
	 */
	static public inline function pairs<V>(obj:DynamicAccess<V>) return new KeyValueDynamicAccessIterator(obj);
}
class ArrayIterators {
	/**
	 *  Array iterator which allows you to get index & value in one go.
	 *  ```
	 *  var a = ['hello'];
	 *  for(p in a.pairs()) {
	 *  	trace(p.index); // 0
	 *  	trace(p.value); // 'hello'
	 *  }
	 *  ```
	 */
	static public inline function pairs<V>(array:Array<V>) return new IndexValueIterator(array);
	/**
	 *  Array iterator which iterates from the end to the beginning of an array and allows you to get index & value in one go.
	 */
	static public inline function reversePairs<V>(array:Array<V>) return new IndexValueReversiveIterator(array);
	/**
	 *  Array iterator which iterates from the end to the beginning of an array.
	 */
	static public inline function reverseValues<V>(array:Array<V>) return new ValueReversiveIterator(array);
}
class StringIterators {
	/**
	 *  String iterator which allows you to get index & character in one go.
	 *  ```
	 *  var str = 'hello';
	 *  for(p in str.pairs()) {
	 *  	trace(p.index);
	 *  	trace(p.char);
	 *  }
	 *  ```
	 */
	static public inline function pairs(str:String) return new IndexCharIterator(str);
	/**
	 *  String iterator which iterates from the end to the beginning of a string and allows you to get index & character in one go.
	 */
	static public inline function reversePairs(str:String) return new IndexCharReversiveIterator(str);
	/**
	 *  String iterator over characters.
	 *  ```
	 *  var str = 'hello';
	 *  for(c in str.chars()) {
	 *  	trace(c); // Sequentially prints: h, e, l, l, o
	 *  }
	 *  ```
	 */
	static public inline function chars(str:String) return new CharIterator(str);
	/**
	 *  String iterator over characters from the end to the beginnning of a string.
	 */
	static public inline function reverseChars(str:String) return new CharReversiveIterator(str);
	/**
	 *  String iterator over codes of characters.
	 *  ```
	 *  var str = 'hi';
	 *  for(c in str.charCodes()) {
	 *  	trace(c); // Sequentially prints: 104, 105
	 *  }
	 *  ```
	 */
	static public inline function charCodes(str:String) return new CharCodeIterator(str);
	/**
	 *  String iterator over codes of characters from the end to the beginnning of a string.
	 *  ```
	 *  var str = 'hi';
	 *  for(c in str.charCodes()) {
	 *  	trace(c); // Sequentially prints: 105, 104
	 *  }
	 *  ```
	 */
	static public inline function reverseCharCodes(str:String) return new CharCodeReversiveIterator(str);
}
class LengthIterators {
	/**
	 *  Iterator for values with `length` field which iterates over indices from the end to the beginning of a `value`.
	 */
	@:generic
	static public inline function reverseIndices<T:{var length(default,never):Int;}>(value:T) return new IndexReversiveIterator(value.length);
}
class IntIterators {
	/**
	 *  Int iterator from `from` (including) to `to` (excluding).
	 *  ```
	 *  var value = 10;
	 *  for(i in value.to(13)) {
	 *  	trace(i); // Sequentially prints: 10, 11, 12
	 *  }
	 *  for(i in value.to(7)) {
	 *  	trace(i); // Sequentially prints: 10, 9, 8
	 *  }
	 *  for(i in value.to(15).step(2)) {
	 *  	trace(i); // Sequentially prints: 10, 12, 14
	 *  }
	 *  ```
	 */
	static inline public function to(from:Int, to:Float) return new IntIterator(from, to);
}
class FloatIterators {
	/**
	 *  Float iterator from `from` (including) to `to` (excluding).
	 *  ```
	 *  var value = 10.5;
	 *  for(i in value.floatTo(13)) {
	 *  	trace(i); // Sequentially prints: 10.5, 11.5, 12.5
	 *  }
	 *  for(i in value.floatTo(7)) {
	 *  	trace(i); // Sequentially prints: 10.5, 9.5, 8.5
	 *  }
	 *  for(i in value.floatTo(12).step(0.5)) {
	 *  	trace(i); // Sequentially prints: 10.5, 11, 11.5
	 *  }
	 *  ```
	 */
	static inline public function floatTo(from:Float, to:Float) return new FloatIterator(from, to);
}
class AnonymousObjectIterators {
	/**
	 *  Object iterator which allows you to get field name & value in one go.
	 *  It is only guaranteed to work with anonymous objects.
	 *
	 *  @throws iterators.exceptions.IllegalValueException - if `object` is not an object.
	 *
	 *  ```
	 *  var obj:Any = Json.parse(data);
	 *  for(f in obj.fields()) {
	 *  	trace(f.name);
	 *  	trace(f.value);
	 *  }
	 *  ```
	 */
	static public inline function fields(object:Dynamic) return new FieldValueIterator(object);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].