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

World: r3wp

[!REBOL3]

Maxim
22-Jul-2010
[4025x2]
I just think that 'SINGLE? will hardly ever be used, as it doesn't 
fit well with the naming of all other series handlers.


if LAST? where there, I think we'd use it naturally.  since it fits 
it with TAIL? LAST FIRST, etc.
I'll CC it.
BrianH
22-Jul-2010
[4027x2]
Suggest both alternatives: Renaming it, or making an alias.
Carl suggested SINGLE? - he uses it (presumably).
Maxim
22-Jul-2010
[4029]
but he might not have tought of LAST?   sometimes these little things 
escape us, since we implement this or that within a current "frame 
of mind" ;-)
BrianH
22-Jul-2010
[4030]
The change would need to be backported to 2.7.8, so we need a ticket.
Maxim
22-Jul-2010
[4031]
CC ticket added,  #1636
Henrik
22-Jul-2010
[4032]
In fact, I suggested SINGLE? (see R3 chat #4330) and Carl took it 
up immediately. I use SINGLE? a lot.
Maxim
22-Jul-2010
[4033]
not saying single be removed... its just like   empty? and tail? 
  they have different semantic meanings, but in rebol are equal in 
implementation.
BrianH
22-Jul-2010
[4034x2]
...more or less :)
Good suggestion, Henrik :)
Maxim
22-Jul-2010
[4036x2]
as I stated in the ticket, 'LAST? should be none tolerant, whereas 
'SINGLE?  could stay strict as it is.
hum...  I thought ordinal functions had become none safe in R3?

>> first none
** Script error: cannot use pick on none! value
** Where: first
** Near: first none

(this is in A96)
BrianH
22-Jul-2010
[4038]
No, they are bounds safe. We want FIRST none to trigger an error.
Ladislav
26-Jul-2010
[4039]
Originally I thought, that the FUNCT function was quite adventurous 
doing a deep search for set-words. But, after using it a couple of 
times, it really looks like it does what is useful most of the time.
Graham
26-Jul-2010
[4040]
saves time ..
Henrik
26-Jul-2010
[4041]
FUNCT is very nice. I love it.
Graham
26-Jul-2010
[4042]
I wonder if we can do the same for use ... uset
Henrik
26-Jul-2010
[4043]
CONTEXT would be close.
Endo
26-Jul-2010
[4044]
@Graham: context [...] is not enough?
Graham
26-Jul-2010
[4045x2]
Hmm.. could work :)
so what advantage is there for  use [ ] [ ... ] as opposed to context 
[ ] ?
Endo
26-Jul-2010
[4047]
use doesn't return an object, so its overhead is less I guess.
Henrik
26-Jul-2010
[4048]
and you can specify a list of words, thus being entirely independent 
of the code inside.
Endo
26-Jul-2010
[4049x2]
So, you can define a global variable without using set 'xxx = yyy.
Here is my benchmarks:

benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]] ; == 0:00:01.094
benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]] ; ==0:00:01.484
my benchmark function runs the block 1.000.000 times.
Henrik
26-Jul-2010
[4051]
interesting
Endo
26-Jul-2010
[4052]
benchmark: func [b][s: now/precise loop 1000000 [do b] difference 
now/precise s]
Graham
26-Jul-2010
[4053x2]
miniscule difference
I should use this for my web pages ...
sqlab
26-Jul-2010
[4055]
I get different results
>> benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.455
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:03.753
Endo
26-Jul-2010
[4056x2]
strange..
>>  benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.468
>> benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.469
>> benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.469
>> benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.5
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.093
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.094
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.094
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:01.094
@sqlab: try to bigger value.
sqlab
26-Jul-2010
[4058]
>> benchmark [context [a: 1 b: "xyzdddddddd" c: 3 d: a * c]]
== 0:00:14.423


>> benchmark [use [a b c d] [a: 1 b: "xyzdddddddd" c: 3 d: a * c]]
== 0:00:37.302
Endo
26-Jul-2010
[4059]
very strange.. I guess it's because of OS, hardware etc.
>> benchmark [context [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:15.048
>> benchmark [use [a b c d] [a: 1 b: "xyz" c: 3 d: a * c]]
== 0:00:11.11
for 10.000.000 times.
Ladislav
26-Jul-2010
[4060]
Endo, the thing is much simpler than that. I bet, that you are using 
R2
Endo
26-Jul-2010
[4061]
ofcourse :)
Ladislav
26-Jul-2010
[4062]
then, read the name of this group
sqlab
26-Jul-2010
[4063]
That explains it.
Endo
26-Jul-2010
[4064x2]
oh, yes, sorry, I just wanted to reply Grahams question..
so, use and context are really different in R3.
BrianH
26-Jul-2010
[4066x2]
USE is a wrapper around a closure!. CONTEXT creates an object. Very 
different.
USE is mezzanine in R3 - source it.
Endo
26-Jul-2010
[4068]
Sure, I would think that USE would be faster than CONTEXT (as in 
R2) but it is not.
BrianH
26-Jul-2010
[4069x3]
USE is just a helper function in R3. We use modules as the primary 
structuring model now.
Or objects.
Now if you created the closure yourself ahead of time, instead of 
creating a new closure every time (as USE does) then it would be 
faster.
Oldes
26-Jul-2010
[4072]
Can you show how?
BrianH
26-Jul-2010
[4073]
blah: closure [a b c d] [a: 1 b: "xyzdddddddd" c: 3 d: a * c]
benchmark [apply :blah []]
RobertS
26-Jul-2010
[4074]
HTML of new R3 doc pages has similar problems on most pages due to 
no urlencode of ampersand in urls and invald <th> declarations using 
old <tr> attrib values for vertical-align in a <th> element.  I would 
gladly fix ad hoc and you can fix your page gen tools (?) later