Warning
These guidelines haven't been updated since 2016. Learn more…
Table of contents
| /* | |
| Implements different bin packer algorithms that use the MAXRECTS data structure. | |
| See http://clb.demon.fi/projects/even-more-rectangle-bin-packing | |
| Author: Jukka Jylänki | |
| - Original | |
| Author: Claus Wahlers | |
| - Ported to ActionScript3 |
| #============================================================== | |
| # .picasa.ini FILE STRUCTURE | |
| # | |
| # reverse-engineered by Franz Buchinger <fbuchinger@gmail.com> | |
| # licensed to the public domain | |
| # | |
| # Picasa Version(s): 3.8.0 | |
| # | |
| # Changelog: | |
| # v0.1: initial release |
| import haxe.macro.Context; | |
| import haxe.macro.Expr; | |
| import haxe.macro.Type; | |
| using Lambda; | |
| /** | |
| Old school abstract class. | |
| Classes that implements it, and their sub-classes, will be able to declare abstract methods (methods that without body). | |
| There will be a check in compile-time such that no public constructor is allowed without all abstract methods implemented. | |
| */ |
| abstract ArrayRead<T>(Array<T>) from Array<T> { | |
| @:arrayAccess inline function get(i:Int):T return this[i]; | |
| public var length(get,never):Int; | |
| inline function get_length() return this.length; | |
| } |
Warning
These guidelines haven't been updated since 2016. Learn more…
Table of contents
| class MainTest { | |
| static public function main() { | |
| trace("Hello world!"); | |
| trace('Fibonacci of 7 is: ${fibonacci(7)}'); | |
| } | |
| static function fibonacci(n) { | |
| if (n == 0) return 0; | |
| else if (n == 1) return 1; |
| package ; | |
| #if macro | |
| import haxe.macro.Context; | |
| import haxe.macro.Printer; | |
| import haxe.macro.Expr; | |
| class MacroEnum { | |
| macro public static function buildToString():Array<Field> { |
| import haxe.ds.Either; | |
| abstract OneOf<A, B>(Either<A, B>) from Either<A, B> to Either<A, B> { | |
| @:from inline static function fromA<A, B>(a:A) : OneOf<A, B> return Left(a); | |
| @:from inline static function fromB<A, B>(b:B) : OneOf<A, B> return Right(b); | |
| @:to inline function toA():Null<A> return switch(this) {case Left(a): a; default: null;} | |
| @:to inline function toB():Null<B> return switch(this) {case Right(b): b; default: null;} | |
| } |
| package ; | |
| import haxe.macro.Type; | |
| import haxe.macro.Expr; | |
| import haxe.macro.Context; | |
| import haxe.macro.Compiler; | |
| using haxe.macro.ExprTools; | |
| class Macro { |
| class KeyValueIterator<K,V> { | |
| var map:Map<K,V>; | |
| var keys:Iterator<K>; | |
| static public inline function pairs<K,V>(map:Map<K,V>) return new KeyValueIterator(map); | |
| public inline function new(map:Map<K,V>) { | |
| this.map = map; | |
| this.keys = map.keys(); | |
| } |