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

World: r3wp

[!REBOL3-OLD1]

Anton
21-Aug-2006
[1142]
Yes I prefer repeat too, (my initial thought, at least).
Were the bugs/issues with FOR ever fixed ? I can't remember now.
Cyphre
21-Aug-2006
[1143]
I also vote for the REPEAT behaviour.
Ladislav
21-Aug-2006
[1144]
Were the bugs/issues with FOR ever fixed ?
 - no
Pekr
21-Aug-2006
[1145]
and will there be? :-)
Ladislav
21-Aug-2006
[1146]
maybe ;-)
Pekr
21-Aug-2006
[1147]
well, surely, such thing is not main priority in such big task as 
R3 is :-)
Volker
21-Aug-2006
[1148]
Silly idea: how to use 'protect for the loop-var? is that to expensive?
Jerry
21-Aug-2006
[1149]
I would like to know the difference between action! and native!. 
Thanks!

In Carl's REBOL 3 Blog Article #0039, he says that the ordinal functions 
(first, second, ...) are of the action! type in REBOL 2, and will 
be of native! type in REBOL 3.
Gabriele
22-Aug-2006
[1150x2]
actions are like "methods" (if you are familiar with OOP languages) 
for values.
i.e. insert series value is like  series.insert(value) in oop languages.
Pekr
22-Aug-2006
[1152]
and series.insert(value) will not be true in the native instead of 
action type?
Gabriele
22-Aug-2006
[1153x2]
a native is more like a C function, an action is more like a C++ 
method. anyway it's mostly an implementation detail.
the distinction will make more sense once we get custom types.
Henrik
22-Aug-2006
[1155]
so no speed differences?
Ladislav
22-Aug-2006
[1156]
what do you think about this:

    repeat i 3 [probe i i: "a"]
Henrik
22-Aug-2006
[1157]
ladislav, I think that's OK. interestingly, you can skip with decimal! 
values to make a smaller step than 1. I noticed two funny things 
though:

>> repeat i 3 [probe i i: i - 0.5]
1
0.5
1.11022302462516E-16
-0.5
-1.0
-1.5
-2.0
-2.5


One is that 0 isn't exactly zero and the other thing is that it counts 
to the absolute value of 'i
Ladislav
22-Aug-2006
[1158x2]
funny, indeed
actually the "0 isn't exactly zero" says something else - there is 
an error in the computation, which is expectable e.g. for 0.3 - 0.1 
- 0.1 - 0.1 (binary floating point numbers cannot represent 0.1 exactly), 
but is not expectable for 1 - 0.5 - 0.5 , because such numbers are 
exactly representable using binary floating point
JaimeVargas
22-Aug-2006
[1160x2]
Humm. I don't like it. It violates  the contract for REPEAT.

USAGE:
   
	 REPEAT 'word value body

 

DESCRIPTION:
     
	Evaluates a block a number of times or over a series.
	REPEAT is a native value

.

ARGUMENTS:
	word -- Word to set each time (Type: word)
     

 value -- Maximum number or series to traverse (Type: integer series)
 
  ;;;;; This part of the contract is being broken by the example. 
  
	body -- Block to evaluate each time (Type: block)
In my opinion Rebol should prevent the programmer  from shooting 
himself in the foot.  Also there are other forms such as FOR and 
WHILE that can be used for loops with variable steps. Maybe CFOR 
should be added to the core language.  


The problem with [ repeat i 3 [probe i i: i - 0.5]] is that it obscures 
the intention of the programmer. Does he wants to iterate 3 times, 
or more? This is not clear with such code.
Ladislav
23-Aug-2006
[1162]
yes, Jaime, the example may be named "how to shoot yourself in the 
foot using REPEAT"
Gabriele
23-Aug-2006
[1163]
Henrik: well, actions need to look into a function table, but natives 
probably need to check the type. unless the code for the action/native 
is very small the speed difference is probably unnoticeable.
Ladislav
23-Aug-2006
[1164x2]
this is "a bit problematic":

all [true ()]
all [() true]

any thoughts?
actually, it *is* consistent, it only does not cooperate well with 
IF
JaimeVargas
23-Aug-2006
[1166x7]
>> true = all [true ()]
** Script Error: Operator is missing an argument
** 
Near: true = all [true ()]
>> true = all [() true]
== true
>> true = all [true ()]

** Script Error: Operator is missing an argument

** Near: true = all [true ()]

>> true = all [() true]

== true
Hmm. Why the breaking of symmetry?
IMHO the behaviors should be consistent.
It also seems that in the first case "all [true () ]" is not escaped 
after the first valid predicate and the parens are still evaluated 
which sort of explaings the error because unset! is returned. Maybe 
we need too allow do [()] should return none instead of unset!.
After some thoughts the breaking of symmetry is valid in this case. 
Still the error thrown due to the return unset! value is missleading.
Maybe unset! should be expelled from the  ALL and ANY natives. After 
all there is not much that you can do with unset!, but expelling 
it is going to be hard. Lad, I am curious about your opinion.
Anton
23-Aug-2006
[1173x3]
I think I'm happy with ALL and ANY as is.
Of that repeat example:   repeat i 3 [probe i i: "a"]

I think that repeat must be checking the datatype and breaking when 
it is wrong (ie. false = integer? "a"). This can be seen as protecting 
the user from infinite loops caused by such user mistakes. Jaime 
is right that this behaviour has not been written into the function 
description, though.
repeat i 3 [?? i i: 3.0]   ; different datatype, decimal instead 
of integer
Ladislav
31-Aug-2006
[1176x2]
My point of view is, that in this case REBOL behaves as Weakly Typed 
Language, because REPEAT considers any value to be integer.
Anbody with an inspiration having a perfect (or at least better) 
name for REJOIN?
Oldes
31-Aug-2006
[1178]
why? maybe GLUE?
Ladislav
31-Aug-2006
[1179x2]
Re REPEAT once again - I should rather have said, that REPEAT was 
Type Unsafe in this case
GLUE - sounds interesting
Oldes
31-Aug-2006
[1181]
but what's wrong with REJOIN?
Pekr
31-Aug-2006
[1182]
why give rejoin different name? it is reduce join after all? Well, 
I know that "rejoin" sounds like once again joining something, but 
maybe re-join
Ladislav
31-Aug-2006
[1183]
not much except for the fact, that beginners don't know what it means
Pekr
31-Aug-2006
[1184x2]
reduce-join
not short, but clear ...
Oldes
31-Aug-2006
[1186]
I like REJOIN and never had problem to understand what it means and 
I don't like longer name for it, I write it too often
Pekr
31-Aug-2006
[1187]
if we think in an object method/action fashion, it could be element.reduce 
element.join (or element.add) - simply it is not typical that you 
combine two methods in one ...
Oldes
31-Aug-2006
[1188]
but JOIN is reducing as well
>> a: 1 b: 2 join "x" [a b]
== "x12"
Pekr
31-Aug-2006
[1189]
interesting :-)
Oldes
31-Aug-2006
[1190x2]
I think that thw word GLUE would be better for joining objects together, 
than joining series like strings
But 3 people, who are not english natives, should not decide, which 
english names should be used:-))