README.rdoc in cartesian-0.5.3 vs README.rdoc in cartesian-0.6.0

- old
+ new

@@ -28,23 +28,30 @@ or use the methods provided by the mixin in the Array class foo.cartesian(bar) #=> [[1, "a"], [1, "b"], [2, "a"], [2, "b"]] which include the short'n'sweet _x_ method v = [] #=> [] - for a,b in [1,2].x [3,4] + for a, b in [1,2].x [3,4] v << [a,b] end #=> true v #=> [[1, 3], [1, 4], [2, 3], [2, 4]] + for x, y, z in 0..1 The '**' operator provides a convenient way of iterating multi-dimensionally over the same array or range - v = [0,1]**3 #=> #<CartesianIterator:0x7f2fb8e54978 @tot_iter=8, @lists=[[0, 1], [0, 1], [0, 1]]> - v.to_a #=> [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]] + u = [0,1]**3 #=> #<CartesianIterator:0x7f2fb8e54978 @tot_iter=8, @lists=[[0, 1], [0, 1], [0, 1]]> + u.to_a #=> [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]] + v = [] + for x, y, z in (0...10)**3 + v << [x, y, z] if x*x + y*y + z*z == 6 + end + v #=> [[1, 1, 2], [1, 2, 1], [2, 1, 1]] + Finally, the grid search methods - require 'grid_search' + require 'cartesian/grid_search' [-1, 0, 1, 2].argmax {|x| x**2 } #=> 2 - [-1, 0, 1, 2].argmin {|x| x.abs } #=> 0 + 0.argmin {|x| x.abs } #=> 0 == REQUIREMENTS: * None, besides the Ruby interpreter and standard library. This gems was successfully tested on all relevant Ruby versions: MRI/YARV, JRuby, Rubinius, and REE. For details, see History.txt. @@ -54,10 +61,10 @@ == LICENSE: (The MIT License) -Copyright (c) 2011 Adriano Mitre <adriano.mitre@gmail.com> +Copyright (c) 2006-2011 Adriano Mitre <adriano.mitre@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,