Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Select VS path access

From: janko:mind-nest at: 9-Nov-2002 20:41

Hi all!
> RMM> Hi, is there a difference (speed?) between the following two methods?
I made the folowing... b: [ a "leter a" b "leter b" c "leter c" d "leter d" ] a: func [ x ][ start: now/time/precise loop 100000 [ do x ] print now/time/precise - start ] and then tested with (>> is from rebol console)
>> a "b/d"
>> a "b/a"
>> a "select b 'd"
>> a "select b 'a"
0:00:00.99 You can see that in hundred thousand repetitons select and path spend exactly same time ---------------------------------------------------------------------------- ------------ There is one difference betwen this two, that I know off. if you have block like a: [ "a" "leter a" "b" "leter b" ] you cant use path
>> print a/"a"
** Syntax Error: Invalid path -- a/
>> print a/a
** Script Error: Invalid path value: a but you can use select...
>>print select a "a"
leter a This is often used in rebol databases where you use select to retrieve the record by the key. [ .... key002 [ "ksadfk" "dfkasdf" "adfa"] key003 [ "dfkasdf" "adfa" "ksadfk"] ..... ] I hope this helped! :janko url: [ ]