World: r3wp
[!REBOL3-OLD1]
older newer | first last |
BrianH 13-Feb-2009 [11254] | Plus, I can copy-paste most of the code :) |
Steeve 13-Feb-2009 [11255] | and you say that foreach is slower than forall in this case ? (overhead with 3 path evaluations block/1 , no ?) |
Henrik 13-Feb-2009 [11256] | BrianH, nice GATHER function. :-) |
BrianH 13-Feb-2009 [11257x2] | FOREACH does a BIND/copy of its code block, but you might have a point in this case because the 3 paths are N*3. |
Final submitted R3 version: gather: func [ "Get the values of a given field from all objects in a block that have it." block [block!] "A block which may contain objects" word [word!] "The field to look for" /into "Insert into a buffer instead (returns position after insert)" output [series!] "The buffer series (modified)" ][ unless output [output: make block length? block] foreach item block [all [ object? :item in item word output: insert/only output select item word ]] either into [output] [head output] ] | |
Henrik 13-Feb-2009 [11259] | So FOREACH is better, anyway? |
Steeve 13-Feb-2009 [11260] | not anyway |
Henrik 13-Feb-2009 [11261] | Argh, I need to read better. You wrote this already. |
BrianH 13-Feb-2009 [11262x2] | It seems like speed is more important than memory in this function. |
Henrik, if you can write up a CureCode wish for this function I can mark it as pending. | |
Henrik 13-Feb-2009 [11264] | For GATHER? Should I just copy your code and credit it to myself? :-) |
Steeve 13-Feb-2009 [11265] | yes, we all do that :) |
BrianH 13-Feb-2009 [11266] | Write up a descriptive request, explaining why you need it, or reference your R3 chat message number. |
Henrik 13-Feb-2009 [11267] | Sounds bureaucratic, but OK :-) |
BrianH 13-Feb-2009 [11268x2] | CureCode is documentation of the new functions. We need the bureaucracy for the users' sake. |
If we don't have a record of why the function was added we won't know where to puut it when we modularize R3. | |
Henrik 13-Feb-2009 [11270] | Posted. |
Steeve 13-Feb-2009 [11271] | Henrik, don't forget to add: "Approved by the politburo" |
Henrik 13-Feb-2009 [11272x2] | :-) |
And 10 lines for signatures. | |
BrianH 13-Feb-2009 [11274] | That's my job (read the ticket comments :) |
Henrik 13-Feb-2009 [11275] | Curecode needs a trigger for rebdev links. |
BrianH 13-Feb-2009 [11276x5] | It will get one, but for now I say something like "R3 chat 1436". |
That is the /into option message, so I remember it :) | |
Here's the R2 version of GATHER: gather: func [ "Get the values of a given field from all objects in a block that have it." block [block!] "A block which may contain objects" word [word!] "The field to look for" /into "Insert into a buffer instead (returns position after insert)" output [series!] "The buffer series (modified)" ][ unless output [output: make block length? block] foreach item block [all [ object? get/any 'item in item word output: insert/only output get/any in item word ]] either into [output] [head output] ] | |
Do you want a /deep option? | |
That will require switching to PARSE for speed. | |
Henrik 13-Feb-2009 [11281x2] | I don't think it's worth it. |
for me it makes the most sense to gather values from a particular level. | |
BrianH 13-Feb-2009 [11283x2] | We can always add another CureCode wish for /deep if we need it. The current function is fast, so that's nice. |
I marked the ticket as pending, with the particular submitted files that contain it. | |
Henrik 13-Feb-2009 [11285] | I think there is merit for a cookbook recipe which briefly describes a table of all block manipulation functions, or we have a way in HELP to relate these functions, so they become very visible to beginners. The problem is that beginners are not likely to be looking for them, because they don't expect them to be there. They were created by experienced users who have been coding REBOL for years. |
BrianH 13-Feb-2009 [11286] | Breaking them up into modules will make it easier to understand - digestible chunks. |
Janko 13-Feb-2009 [11287] | will there be something like mezz fold/reduce function for r3? I would use it a lot |
BrianH 13-Feb-2009 [11288x5] | Fold is called ACCUMULATE - only functional languages call it fold. |
ACCUMULATE is basically fold-left. | |
Would you need a /reverse option? ACCUMULATE is already almost as fast as we can make it in REBOL, and more options would slow it down. The only way we could speed it up more now is to fix an APPLY bug with op! functions. | |
Filter is called REMOVE-EACH in REBOL. | |
I apologize, ACCUMULATE is whichever version of fold that starts at the beginning and ends at the end of series (left? right?). | |
Janko 13-Feb-2009 [11293] | thanks Brian :) great ! I don't have any use cases where I would want accumulate/reverse so far |
[unknown: 5] 13-Feb-2009 [11294] | This group needs more abstraction. The group is turned into mainly an R3 mezzanine group. Should we have a different group for that? Originally, I thought this would be about how R3 is developing more along the native level. |
Pekr 13-Feb-2009 [11295x2] | I agree with Paul. This group served as general R3 info channel for those, who were not available to other altme R3 related private worlds. Now as we go more into details, I propose to set-up groups as needed: R3-mezzanine, R3-plugins, R3-whatever ... what do you think? |
... untill there is GUI to DevBase, many ppl will prefer Altme channel for quite some time ... | |
[unknown: 5] 13-Feb-2009 [11297] | I think it is a good idea Pekr. |
BrianH 13-Feb-2009 [11298] | I prefer to have such discussions in R3 chat. Having them here means more work for me, since most of the rest of the crew that knows the internals doesn't come here, so it ends up being up to me to answer. |
Oldes 13-Feb-2009 [11299] | the rest of the crew .. do you mean Carl or someone elseas well? :) |
BrianH 13-Feb-2009 [11300] | Mostly Carl, though Gabriele and Cypher also work on the C-level stuff. I mostly know about the C stuff because I get involved with the discussions and remember them. Also many of the C-level changes to the core functions (not graphics or ports) were based on discussions I started. |
Oldes 13-Feb-2009 [11301] | If the data from users R3's command are correct, Gabriele last logged in 31 days and Cyphre 7 days ago. Both were here today.. so it was not good example:) |
BrianH 13-Feb-2009 [11302x2] | Yes, but they haven't been involved with the discussions that resulted in the core changes and new functions of the last year. |
I was speaking on Gabriele's behalf dring that time because he was busy. Now he doesn't answer these questions here. | |
older newer | first last |