World: r3wp
[Core] Discuss core issues
older newer | first last |
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. | |
Gabriele 19-Aug-2010 [17954] | Graham, I did that recently, where you get choices as you type. I had ~1000 strings though, so not sure how much it scales. I just indexed by the first two characters. |
Graham 19-Aug-2010 [17955x2] | It seems to be working not too bad for me without a hash .. but I'll need to test it on a slower PC ( test inside a VM I guess ) ... |
video of my current implementation http://screencast.com/t/ZGI5ZTJkOTct | |
Gregg 19-Aug-2010 [17957] | Very nice Graham! Thanks for posting. How did you end up doing the matching? |
Graham 19-Aug-2010 [17958x2] | search each one from the start :) |
rebol seems fast enough | |
Gregg 19-Aug-2010 [17960] | Cool. Yeah, there are times we need to use advanced algorithms, and times we don't. |
Brock 19-Aug-2010 [17961] | Carl has a character by character search in Rebodex. Not sure if that is any better than what you have done. |
Tomc 20-Aug-2010 [17962] | G raham a suffix tree may be what tou want for trem compleation |
Graham 20-Aug-2010 [17963] | suffix tree? |
Tomc 20-Aug-2010 [17964x2] | a forest of trees where the words are on the path from root to leaf so at any interior node the possible compleations are the subtree the node you are on is the root of |
if not clear blame it on post op drugs... I'm recovering from bad cellulitus | |
Sunanda 20-Aug-2010 [17966] | It's a type of denormalised trie: http://marknelson.us/1996/08/01/suffix-trees/ |
Graham 20-Aug-2010 [17967x3] | It clearly has affected your typing! |
I guess you didn't get the necrotizing fasciitis version! | |
So, all I need is to write a function that takes my data and builds the tree ... | |
Tomc 20-Aug-2010 [17970] | it has affected my typing in that I have time to spend here |
Graham 20-Aug-2010 [17971] | Since my data is also invariant ... I could save the data structure and send it to my users :) |
Tomc 20-Aug-2010 [17972x2] | if your controlled vocab chantes much it will be expensive |
this is why controlled vocabularies are good | |
Graham 20-Aug-2010 [17974x2] | There aren't that many new drugs added to the pharmacopaiea on a monthly basis |
The FDA makes sure of that! | |
Tomc 20-Aug-2010 [17976] | sounds ideal |
Graham 20-Aug-2010 [17977x2] | so how are the nodes represented? blocks? objects? |
http://www.mail-archive.com/[list-:-rebol-:-com]/msg07839.html | |
Tomc 20-Aug-2010 [17979] | if you can get away with blocks it should be cheaper , since you only decend, parent is not needed just child blocks and value may work |
Graham 20-Aug-2010 [17980] | Maybe Carl can add this as a native for find/deep :) |
Tomc 20-Aug-2010 [17981] | also look at prefix trees, may be a simpiler variant for word compleation |
Chris 21-Aug-2010 [17982] | Is there a case to be made for use/only ? >> use [a][a: 1] == 1 >> use/only [a][a: 1] == [a: 1] Replaces having to 'double bag' - >> use [a][[a: 1]] Am I missing an obvious equivalent? |
Ladislav 21-Aug-2010 [17983] | I would say, that your equivalent is fine. Since it is not that hard to use the "double bag", I doubt it justifies the refinement, since the refinement expression isn't shorter than the expression it is supposed to replace. |
Chris 21-Aug-2010 [17984x2] | You get longer line lengths in the standard style: use [a][ [ a: 1 ] ] ; picture a: 1 being slightly more code |
vs. use/only [a][ a: 1 ] Partly it's aesthetics - but this is a language, aesthetics can be important. | |
Ladislav 22-Aug-2010 [17986x2] | It still is possible to introduce just a special "double bag style", which is aesthetically acceptable, IMO (I have seen it somewhere, so it is not my invention): use [a] [[ a: 1 ]] |
>> f: func [] [[ [ a: 1 [ b: 2 [ ]] >> f == [ a: 1 b: 2 ] >> source f f: func [][[ a: 1 b: 2 ]] | |
Graham 22-Aug-2010 [17988] | I've got diplopia! |
Gabriele 22-Aug-2010 [17989] | The disadvantage of [[ is that it can be difficult to notice sometimes, but otherwise it seems acceptable in cases like this. |
Izkata 22-Aug-2010 [17990] | If I'm using that, I usually double-indent the surrounded code, to help make it easier to notice |
older newer | first last |