greggirwin on master
FIX: removed dead code FIX: \\\uXXXX sequences are now… FEAT: 4x speedup by using parse… and 4 more (compare)
mold/all
to see what is the string result used by save/all
.
I find myselft using really often the the /skip
refinement with select. Having a block like the following (or any one treated as record)
myblock: [
key1 value1 value2 value3
key2 value1 value2 value3
key3 value1 value2 value3
key4 value1 value2 value3
key5 value1 value2 value3
]
Select/skip
can't select anything other than the the first column: value1, which is quite limiting.
I see useful removing this limit adding an additional /pos
(or /offset
) integer refinement to select
so instead of the first value, any other could be selected! Without /skip
the pos
/offset
refinement should return the nth value after the key.
>> my_func: function [params [block!]][foreach x params [print x]]
== func [params [block!] /local x][foreach x params [print x]]
>> ? my_func
USAGE:
MY_FUNC params
DESCRIPTION:
MY_FUNC is a function! value.
ARGUMENTS:
params [block!]
>> my_func ["one" "two" "three"]
one
two
three
>>
>> copy/part find/skip myblock [key2 value1] 4 4
== [
key2 value1 value2 value3
]
>> third find/skip myblock [key2 value1] 4
== value2
mydata: make hash! [
key1 value11 value12 value13
key2 value21 value22 value23
key3 value31 value32 value33
key4 value41 value42 value43
key5 value51 value52 value53
]
myselect: func [data key len pos][
pick find/skip data key len pos
]
myselect mydata 'key1 4 1
;== key1
myselect mydata 'key1 4 3
;== value12
myselect mydata 'key3 4 2
;== value31
myselect mydata 'key5 4 4
;== value53
@GiuseppeChillemi select
is not going to add this feature. It's design was reconsidered to match R3, not R2, and @toomasv showed the way to do this. What is one short line in Red, would be a large amount of Red/System code in multiple datatypes, because it's an action.
I appreciate that you have a different perspective, but when deeply experienced Reducers push back on your idea, you tend to push forward with the same request again. Do NOT write a request for these. Find/Select
work this way by design.
I was working on this Atomica stuff back in 2010, so trying to refresh my memory climbing over the Altme archives, and came across this historical conversation. It's @dockimbel , @gchiu and I discussing the pros and cons of cloning Rebol. Interesting read.
@greggirwin
but when deeply experienced Reducers push back on your idea, you tend to push forward with the same request again
Greg, I didn't read this part. Why I ask a second time ? I see in my this vision the RED documentation chapter on Select with an example like mine and new developers all thinking: "great I can search in a blocks like I actually do in databases table, what a great language!". This because in the example you will show them intersects with what they are used to manage day after day. Do you know that showing to the potential adopters, in the very first moments, an operational framework similar to their usual one increases the adoption chance? I am a developer too and I remember when I have chosen something because of that something interacting with my needing. These are the reasons that would drive the request to reconsider that /pos
refinement: its a MARKETING one other than a functional one.
However, thanks to your reply came the idea of creating a page about using RED blocks as database tables in programming.red.