r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Graham
16-Aug-2010
[17904x2]
ok, so this does involve some rewriting of functions
and I guess is not that different to passing a context to a function 
as discussed above
Gabriele
17-Aug-2010
[17906]
if you really can't touch the functions, you might as well just reuse 
the same globals, no? rebinding them is also "global" so there's 
not much difference.
amacleod
17-Aug-2010
[17907]
what's 'vid-context/to'?

I get an error?
Anton
17-Aug-2010
[17908]
It's in Gabriele's utility.r library which he mentioned on Saturday.
amacleod
18-Aug-2010
[17909]
thanks...i missed that
Graham
18-Aug-2010
[17910x2]
If I had a large numer of sorted strings, how can I most efficiently 
find the first string which partially matches my search string.  
Eg. I want search on '"find*"
A hash doens't allow me to do a wild card search
Gregg
18-Aug-2010
[17912]
http://www.rebol.org/view-script.r?script=like.rlets you do more 
than find/any, but you're still going to have the overhead of checking 
each string. Depending on your needs that may work, or you could 
make one big string out of them and just PARSE that.
Graham
18-Aug-2010
[17913x2]
find [ "ab" "bc" "bd" ] "b*"
looks like I should try and get a hash for each first letter, first 
and second letter etc so I can at least narrow it down to the first 
3 letters and then do search on everyone after that.
Gregg
18-Aug-2010
[17915]
How many strings and what kind of performance do you need?
Graham
18-Aug-2010
[17916x2]
18,000 strings....  real time.... as each time they type a character 
I am presenting a list of choices
I am emulating this http://rxterms.nlm.nih.gov:8080/
AdrianS
18-Aug-2010
[17918x2]
have you thought about using SQLite?
I wonder how that would compare with doing REBOL lookups
Graham
18-Aug-2010
[17920]
I was just thinking that!
Gregg
18-Aug-2010
[17921]
The example helps enormously Graham, because you said "first string" 
but now I see you want all matches for a given prefix.
Graham
18-Aug-2010
[17922]
once I get the first string .. then I can easily get the others as 
I sort the 18k strings first
AdrianS
18-Aug-2010
[17923]
is the existing sqlite driver work over the wire or does it do in 
process calls?
Graham
18-Aug-2010
[17924x4]
Maybe I need RIF
I've never used sqlite
I wonder if Ashley's rebdb would work ...
He doesn't have a like clause ... but I guess it could be faked
Gregg
19-Aug-2010
[17928x2]
Graham, did you try REFORMing into a single string and using FIND/ANY? 
I did a quick test here and it's instant for me with 18K random "words" 
making a 200K string finding the last word (non-random for testing).
Hmmm, some of the terms aren't single words though.
Graham
19-Aug-2010
[17930]
In effect you've created an index
Gregg
19-Aug-2010
[17931]
No, just a list of single-value records. :-)
Graham
19-Aug-2010
[17932]
Actually I wonder why find/any shouldn't work on series like these
Gregg
19-Aug-2010
[17933x2]
Or you can say I created an index and the query system with two function 
calls.
You mean a block containing string values?
Graham
19-Aug-2010
[17935x3]
sure ..
>> help find
USAGE:

    FIND series value /part range /only /case /any /with wild /skip size 
    /match /tail /last /reverse
Doesn't say blocks are not included
Gregg
19-Aug-2010
[17938]
But it's not find/deep, which is what you want.
Graham
19-Aug-2010
[17939x2]
for the /match refinement
Since it's a read only db, perhaps I could use Cyphre's compiler 
:)
Gregg
19-Aug-2010
[17941]
Not sure how /match is going to help you here. It only matches the 
start of the series.

>> find/match ["Aa" "Bb" "Cc"] ["Bb"]
== none
>> find/match ["Aa" "Bb" "Cc"] ["Aa" "Bb"]
== ["Cc"]
Graham
19-Aug-2010
[17942x2]
ok... find/deep then :)
for 18k strings, it seems overkill to use sqlite though
Gregg
19-Aug-2010
[17944]
REFORM + FIND/ANY

Just sayin'. ;-)
Graham
19-Aug-2010
[17945]
I'm sure that it is fast .. but I want real fast so I'm going to 
see if I can create a hash
PeterWood
19-Aug-2010
[17946]
Perhaps Sunanda's skimp.r may be hiding some gems you could adopt.
Sunanda
19-Aug-2010
[17947]
Graham -- consider using a Trie

[that is more-or-less what skimp.r does, but the skimp data structures 
are badly disorted as I was struggling to find a deeply-nested block 
structure that did not trigger garbage collection bugs in the then-current 
REBOL core. (those bugs have been fixed)]
   http://en.wikipedia.org/wiki/Trie
Graham
19-Aug-2010
[17948]
is there a port scheme for trie:// ?
Henrik
19-Aug-2010
[17949]
Graham, look at the filter function in LIST-VIEW.
Graham
19-Aug-2010
[17950]
filter-list ?
Henrik
19-Aug-2010
[17951x3]
no, FILTER.
sorry, FILTER-ROWS.
I guess it's been split in several parts now, so it may be too hard 
to read.