----- "Mathieu Bouchard" matju@artengine.ca a écrit :
On Wed, 23 Jun 2010, patko wrote:
using gridflow for sorting lists, [#grade] over a 1D grid give me a
level value for each imported list, by using the first element
extracted
from the list, and all the lists are stored in a two dim grid. Now
how
can I use those level values like indexes for outputting each list
from
[#store]?
I'm not sure I understand... are you using [#grade] n times with grids of size (m) each time, or are you using [#grade] once with a grid of size
(n m) ? or are you sorting a bunch of lists according to what's the first element of each list ? or anything else...
It's about sorting a bunch of lists according to what's the first element of each list.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Thu, 24 Jun 2010, patko wrote:
It's about sorting a bunch of lists according to what's the first element of each list.
Ok, I just made you a patch for it.
The trick is to use a [#slice] to extract the information to sort about ; however the [#slice] needs to know the height of the grid, so you need a [#dim]. the [#unpack] and msgbox is only one way to do it in two steps : you can also do [# * (1 0)] [# + (0 1)] and there are a bunch of other equivalent ways.
Then, when you have a grid of size (n 1) and you need to get it to size (n), you'd do something like [#fold +] or [#fold put], and to undo it back to size (n 1), you'd do something like [#outer + (0)] or [#outer ignore (0)]. Note that the parens are essential in the latter case, unlike a typo I removed yesterday.
It's national holiday today (basically, same as your july 14th), and our law says that any work done on that day has to be paid triple rate. So I'm gonna charge you 3 times the amount I usually charge you. ;)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Thu, 24 Jun 2010, Mathieu Bouchard wrote:
The trick is to use a [#slice] to extract the information to sort about ; however the [#slice] needs to know the height of the grid, so you need a [#dim]. the [#unpack] and msgbox is only one way to do it in two steps : you can also do [# * (1 0)] [# + (0 1)] and there are a bunch of other equivalent ways. Then, when you have a grid of size (n 1) and you need to get it to size (n), you'd do something like [#fold +] or [#fold put],
Actually, in the case where you only want the last column, you can skip [#slice] and [#dim] and just use [#fold put].
Therefore, if you only want the last column, you can flip the grid using [#reverse 1] before using [#fold put].
And if you know the number of columns in advance, you can select the column using a one among zeroes, as in [#inner (5 # 1 0 0 0 0)], which in this case is the same as [# * (1 0 0 0 0)] then [#fold +] (this equivalence only works with simple cases of #inner, those where the right-inlet has only one dim)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801