Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:22
    Oldes commented #60
  • 17:22
    hiiamboris commented #4739
  • 17:21
    hiiamboris commented #4739
  • 17:10
    hiiamboris commented #4739
  • 17:08
    hiiamboris commented #4739
  • 17:01
    hiiamboris commented #4739
  • 16:56
    hiiamboris commented #88
  • 16:35
    hiiamboris commented #4739
  • 16:26
    Oldes edited #88
  • 16:25
    Oldes edited #88
  • 16:24
    Oldes opened #88
  • 12:42
    dockimbel assigned #4739
  • 09:56
    rebolek commented #87
  • 09:55
    rebolek commented #87
  • 09:32
    loziniak commented #87
  • 08:50
    qtxie opened #4739
  • 08:29
    rebolek commented #87
  • 07:37

    qtxie on master

    FIX: better fix for issue #4706… (compare)

  • Nov 29 19:29
    dockimbel commented #4716
  • Nov 29 19:29
    dockimbel labeled #4716
Oldes Huhuman
@Oldes
Btw.. you can use mold/all to see what is the string result used by save/all.
Oldes Huhuman
@Oldes
@LFReD and I'm not able to reproduce your loading issue...
>> db
== ["user1" "pred1" "val1" "user2" "pred2" "val2" "user3" "pred3" "val3" "user4" "pred4" "val4" "user5" "pred5" "val...
>> save %/a/db.txt db
>> length? db
== 75000
>> length? load %/a/db.txt
== 75000
LFReD
@LFReD
Continuing this in red/bugs..
LFReD
@LFReD
Regarding that bug. I was using the older binary from the red-lang site.. using latest build and it works fine.
LFReD
@LFReD
Ah, I've heard bits and pieces about a /pro version of Red? Any docs on that or deets?
Gregg Irwin
@greggirwin
Not at this time.
LFReD
@LFReD
ooh, now I'm really intrigued! :P
Gregg Irwin
@greggirwin
I don't do Go, so would have to read up on the struct/def format, but it seems like we could do a nice data-driven version of this in Red for the Gophers. Their binary is 30M for Linux, and 45M for Windows. We could save them some bandwidth. :^)
LFReD
@LFReD
Any chance of variable length arguments with Red func?
Gregg Irwin
@greggirwin
Nope. Use a block.
GiuseppeChillemi
@GiuseppeChillemi

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.

Jose Luis
@planetsizecpu
Block works well for me:
>> 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
>>
xqlab
@xqlab
@GiuseppeChillemi Does this help
>> copy/part find/skip myblock [key2 value1]  4 4
== [
    key2 value1 value2 value3
]
or this
>> third find/skip myblock [key2 value1]  4 
== value2
Gregg Irwin
@greggirwin
@GiuseppeChillemi select already has a lot of refinements, and what you want is easy to do at the mezzanine level. It also makes sense, in many cases, to use sub blocks.
hiiamboris
@hiiamboris
With such a fixed table one shouldn't use select at all, as it'll be slow. Hash is the way to go ;)
GiuseppeChillemi
@GiuseppeChillemi
@xqlab Thanks, I already use a solution like this. I suggested this improvement to Select because, using Gregg's term, "it makes sense". Having a block treated as a record with elements and you can only select the first one, is limiting.
GiuseppeChillemi
@GiuseppeChillemi
@greggirwin from your experience, in presence of a SKIP refinement, do you could think it could be possible to be considered as key an element different from the first one?
Rudolf Meijer
@meijeru
Why not use find/skip?
GiuseppeChillemi
@GiuseppeChillemi
@meijeru because the selection phrase using find would be long and also the intent is having a select not limited to the first column but capable of retrieveing the others composing the record.
@meijeru it is really useful when you have external database tables stored in a block and you need to select an item:
The first feature let you access any column, the second one let you use any column as key.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi Why not do it? Something like this:
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
@GiuseppeChillemi
@toomasv good! Why not implementing it in select? It's seems so easy!
Toomas Vooglaid
@toomasv
Because it is so easy !?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv 😁 because you do not have to learn another word and it's syntax and select will become a very powerful command? (promise I will not continue!)
Toomas Vooglaid
@toomasv
IOW "Red should do everything I think it might do." You are going to rob programmers their job :imp:
GiuseppeChillemi
@GiuseppeChillemi
@toomasv (hovever, thank you for your implementation)
Toomas Vooglaid
@toomasv
:smile:
It's like Lego. If you have an idea, you put pieces together to realize it, not write a letter to Lego Company to do it.
GiuseppeChillemi
@GiuseppeChillemi
@toomasv Yes but Legos once where sufficient to create some buildings, now you can create and drive full robots. That's because mother house has not stopped receiving and implementing suggestions and ideas.
GiuseppeChillemi
@GiuseppeChillemi
I see find too could receive the same improvement. You could find on different position than the first one of the /SKIP group.
I will write a request for both.
hiiamboris
@hiiamboris
find already supports that
Gregg Irwin
@greggirwin

@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.

Well, you can write a request if you want, but it will be rejected. Save your time for other things. :^)
GiuseppeChillemi
@GiuseppeChillemi
@greggirwin Greg, I don't know how deep is the change to implement this feature. I have thought about the speed and completeness of the selection/find mechanism but I can survive until resources and willingness be available. But please admit you liked this feature too in the first instance! @toomasv Please stop creating solutions to my ideas so quickly, you are ruining my requests! ;-)
(I have just corrected my text)
LFReD
@LFReD

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.

http://www.rebol.org/aga-display-posts.r?post=r3wp495x8388

GiuseppeChillemi
@GiuseppeChillemi
@hiiamboris I am not able to understand the code (and maybe today I am too tired). Is has find this feature or that code mimics this feature ?
hiiamboris
@hiiamboris
>> key: 1  b: [0 0 0 1 1 1 2 2 2]  find/skip (skip b 2) key 3
== [1 2 2 2]    -- search by 3rd column of b
GiuseppeChillemi
@GiuseppeChillemi
So find is able to skip the searched series without interfering with its index. Good to know, great!
GiuseppeChillemi
@GiuseppeChillemi

@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.

Petr Krenzelok
@pekr
I would like any such discussions to move into some other channel. It is imo too much related to one's own projects vs the proposal towards the general language developments ....
GiuseppeChillemi
@GiuseppeChillemi
@pekr I don't agree. Select is one of the core instruction of Red. I have not asked for help for a solution (despite very welcome) but to have another refinement in select/find. Now the discussion is at its end, and the topic drifted and we need to move but until now we were talking about one of the Red core functions.
Feel free to continue this discussion on https://gitter.im/red/chit-chat
Semseddin Moldibi
@endo64
@GiuseppeChillemi Here is another solution with parse:
>> pos: none parse [1 2 a 3 4 b 5 6 c] [some [pos: 2 skip 'b (print ["Found record at index" index? pos] pos ) fail | 3 skip]] pos
Found record at 4
== [3 4 b 5 6 c]
GiuseppeChillemi
@GiuseppeChillemi
@endo64 you are all so generous, thank you!