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

World: r3wp

[!REBOL3]

Maxim
7-May-2010
[2917]
yes Carls is struggling, but by what I hear, he really is committed 
to doing it.   he WANTS to do it... its just that he's realizing 
how deeply rooted the view code is... all kinds of tricks now have 
to be architectured and properly APIed.
Terry
7-May-2010
[2918]
Anyway to return the key used in a map when using find values-of 
map! ?
Paul
7-May-2010
[2919x4]
Carl is suddently on FIRE!!!!   Go Carl Go!!!!
Wouldn' t it be nice to do something like this:
a:   5
b: a < 10

where b gets set to the value of a instead of true?
We may have to include a new keyword such as bool to the mix just 
to get true or false when desired.

b: bool a < 10
Just a thought.
Maxim
7-May-2010
[2923]
bool: func [val][not not val]
;-)
Paul
7-May-2010
[2924x3]
:-)
See wouldn't that be a better way to do things?
That seems to be in line with simple thigns should be simple to do.
BrianH
8-May-2010
[2927]
BOOL: :TRUE?
Paul
8-May-2010
[2928]
Yeah forgot we have that in R3.  But we still can't do as I showed 
above.
Maxim
8-May-2010
[2929]
yay TRUE? is in R3 :-)
BrianH
8-May-2010
[2930]
Oh, you are right Paul, I was looking at Maxim's code, sorry. You 
want Icon-style conditionals, not TRUE?. Not sure how to fake that.
Paul
8-May-2010
[2931]
It's a feature I use in C# often.
Andreas
8-May-2010
[2932]
How, in C#?
Paul
8-May-2010
[2933x2]
The feature I use often is a reference to the boolean stuff.  We 
can do that part in REBOL already - always have been as far as I 
can remember.
It wasn't a reference to the code piece that I stated earlier.
Claude
8-May-2010
[2935x2]
R3 problem with é !!!!
>> upgrade
Fetching upgrade check ...

Script: "REBOL 3.0 Version Upgrade" Version: 1.0.1 Date: 7-Apr-2009
Checking for updates...

R3 current version: 2.100.99.4.2 
It was released on: 8-May-2010/0:13:33 

Your version is current.

** Script error: invalid argument: %/home/ramcla/Téléchargements/
** Where: change-dir all either applier do try upgrade
** Near: change-dir dir
BrianH
9-May-2010
[2937x2]
Paul, I don't understand your request. For the code:
      b: a < 10

and the request "where b gets set to the value of a instead of true?", 
there are at least two ways to interpret *why* b would be set to 
the value of a. Either you want the op < to return the value of a 
rather than true (Icon-style comparison behavior, which C# doesn't 
have) or you want the code to be equivalent to (b: a) < 10, different 
precedence levels for op evaluation (which C# does have), or something 
completely different that I don't get. Which interpretation is what 
you meant?
Claude, where is R3 getting the path %/home/ramcla/Téléchargements/ 
? And are you encoding é in Unicode or Latin1?
Claude
9-May-2010
[2939]
brianH in /etc/default/local i have  LANG="fr_BE.UTF-8"   (ubuntu 
lucid 10.4)
Paul
9-May-2010
[2940]
Brian I don't know Icon so I can't say if it is the same behavior. 
 However, what I was saying is that it would be nice to see if the 
expression is true then the value of the expression be assign to 
the set-word.   A change like this would have to happen at the parsing 
level of the code.  You couldn't just modify the operator.
Terry
9-May-2010
[2941]
Is there a word! limitation in R3?
Henrik
9-May-2010
[2942]
yes, but it's much higher than R2.
Terry
9-May-2010
[2943x2]
so a map! using.. 
n/xyz: "value

is limited?
in other words, am i forced to use binary or strings as keys to avoid 
the limitation?
Henrik
9-May-2010
[2945]
that is unknown to me. BrianH must know.
Terry
9-May-2010
[2946x2]
why  couldn't the number of available words in R3 have been limited 
to memory?
regardless, strings as keys are probably the way to go.
Ladislav
9-May-2010
[2948x3]
You couldn't just modify the operator.
 - actually, that is not true in R3
I can have such an "operator" even in R2, it just needs to be prefix
Or, if you insist, that it is impossible to have such an operator, 
you should at least try to specify it "thoroughly enough" for me 
to be able to know what are your requirements. (that is what BrianH 
was curious about too)
BrianH
9-May-2010
[2951]
Yup. And the value of the expression *is* being assigned to the set-word: 
the value of the expression a < 10 is either true or false. Unless 
you mean a different expression, at which point you should be more 
specific. If we understand exactly what you want, perhaps we can 
rig something up using magic evaluation tricks.
PeterWood
9-May-2010
[2952]
I think Paul is asking for a short form of :

b: either a < 10 [a] [false]


If none is an acceptable value when the condition fails, it can be 
shortened to:
b: if a < 10 [a]
Paul
9-May-2010
[2953]
Yes Peterwood that is similiar to what I had in mind.  I don't see 
this happening as I believe it would be a MAJOR change.
PeterWood
9-May-2010
[2954]
Perhaps what I suggested will help even if it can't be shortened:

>> a: 10
== 10
>> b: either a < 10 [a] [false]
== false
>> a: 2

== 2
>> b: either a < 10 [a] [false]
== 2
Paul
9-May-2010
[2955]
b: either a < 10 [a][b]
Izkata
10-May-2010
[2956]
Looks like   b: min a b
PeterWood
10-May-2010
[2957]
No because that could give the wrong answer, if b is greater than 
a and a is ten or greater.
Ladislav
10-May-2010
[2958x3]
; this works in R2 as well as in R3, since it is a prefix operator
combined-lesser?: func [
    :set-word [set-word!]
    value1
    value2
] [
    if value1 < value2 [set set-word value1]
]

; usage
a: 10
b: 'no
combined-lesser? b: a 10
b ; == no

a: 2
combined-lesser? b: a 10
b ; == 2
As you can see, in REBOL, MAJOR changes are in the power of the user.
(if you don't like the name of the operator, feel free to invent 
a better one, since that is a greater problem for me than to implement 
it)
Steeve
10-May-2010
[2961]
if=
Ladislav
10-May-2010
[2962]
nice idea, maybe if< ?
Steeve
10-May-2010
[2963]
What about a polymorphic function ?


if=: func [:sw :gw :op val][op: get op gw: get gw if (gw op val) 
[set sw gw]]

>>a: 1
>>b: 5
>>if= a: b < 10
== 5
>>if= a: b < 5
==none
Ladislav
10-May-2010
[2964x2]
aha, that is just for R3, as it looks
(and behaves in a little bit different way)
Steeve
10-May-2010
[2966]
the same goes for R2, a little different though...