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

World: r3wp

[Core] Discuss core issues

Romano
19-Sep-2005
[2135]
it is the context which select - as
1) unary minus (- 2)
2) subtract op!  (2 - 3)
3) subtract action! (- 2 3)
- is a monster! :-)
Ladislav
19-Sep-2005
[2136]
:-)
Carl
19-Sep-2005
[2137x4]
WRT +-  It seemed to me that there was another good reason to give 
that other meaning.
It is possible to imagine a "range" or "interval" datatype that may 
need +- word.
Regarding order of arguments:
The fundamental rule is an abstraction - it is this: the primary 
"focus" or "object" of the function or action is first.
Geomol
19-Sep-2005
[2141]
Makes sense.
Carl
19-Sep-2005
[2142x3]
So it is: verb main-object modifiers (or other objs)
(Rather than direction of evaluation flow or direction of human reading 
flow.)
Shells often use: verb source destination
Geomol
19-Sep-2005
[2145]
Carl, I ask, because I'm writing REBOL-versions of some of the old 
Amiga graphics.library functions. BltBitMap e.g., in the Amiga version, 
the arguments are: source bitmap, source position, destination bitmap, 
destination position, mask, etc...
Should I turn source and destination around in a REBOL version?
Carl
19-Sep-2005
[2146]
In that case, when source and destination are of equal weight, then 
you can apply other rules.
Geomol
19-Sep-2005
[2147x2]
Or rather: what would you do?
ok
Carl
19-Sep-2005
[2149]
It depends on if you want to keep it true to the Amiga order, or 
if you are creating something new.
Geomol
19-Sep-2005
[2150x2]
I plan to let the functions be available to other developers, so 
I was wondering, what people would feel as the right 'REBOL' way.
My idea is, that it's new, but Amiga developers should recognize 
it.
Carl
19-Sep-2005
[2152x4]
In the example you show above... it seems good.  The source bitmap 
could be considered the primary object, although the dest is also 
very important.
Romano, yes, it is a monster!
Neg for negate may be simplest. We already have abs for absolute.
And, it seems that there are people pushing for sin (sine), cos (cosine), 
tan, etc.
Romano
19-Sep-2005
[2156]
I should remember that the doc of the original functions are in source-destination 
order, so for me is a good idea to make the same in Rebol,  there 
a direct map of OS function and OS doc on rebol functions
Geomol
19-Sep-2005
[2157]
Yeah, I should probably keep the order of the arguments, as they 
are in the Amiga version, so it'll be recognizable. Thanks! :-)
Graham
19-Sep-2005
[2158x7]
The word browser is nice, but I spend most of my time in the console. 
 How about a man command that looks up the manual pages on the net, 
and dumps them to the console?
And since the console responds to escape sequences, we could even 
have some formatting ?
I thought tags were a special form of strings ...
However, this appears not to be the case ...

>> probe rejoin [ "<html>" "testing" "</html>" ]
<html>testing</html>
== "<html>testing</html>"
>> probe rejoin [ <html> "testing" </html> ]
<htmltesting</html>>
== <htmltesting</html>>
>> html: ""
== ""
>> repend html [ <html> "testing" </html> ]
== "<html>testing</html>"
Is 'rejoin trying to do some datatype conversion?
>> rejoin [ "" <html> "testing" </html> ]
== "<html>testing</html>"

Guess it must be.
Tomc
19-Sep-2005
[2165]
they take the first item's datatype
Ashley
19-Sep-2005
[2166]
re: negate. If "10 + neg 5" was the functional equivalent of the 
unary minus example, and its a known performance exception, then 
I for one would vote for it's removal. I, and I suspect many others, 
didn't even realize REBOL supported this (I use the 'negate function 
instead quite often).
Sunanda
20-Sep-2005
[2167]
<<How about a man command that looks up the manual pages on the net, 
and dumps them to the console?>>

It wouldn't be that hard to adapt the existing code for other purposes 
too.

Like, it'd be good  if someone extended it to emit MakeDoc codes. 
Those files could then go straight up on the web -- instant searchable 
ocumentation.

I get the impression that Carl would be happy for people to volunteer 
to extend the project.
Ladislav
20-Sep-2005
[2168]
Ashley: I am supporting the same as long as we get a reasonably short 
and readable name (like Neg)
Geomol
20-Sep-2005
[2169]
Ashley, you've got my support aswell, at least to hear Carl on this. 
Maybe the performance issure is very small, and if many programs/scripts 
will break, it probably shouldn't be changed. But otherwise yes! 
We like fast code! :-)

The asm dialect of REBOL, "rebcode", might change the situation. 
If removing unary minus is a problem, and we don't have it in rebcode 
(and rebcode will boost performance a lot of course, as it will), 
then it maybe shouldn't be changed.
Ladislav
20-Sep-2005
[2170x2]
there may be other influences IMO
(like readability,debuggability, ...)
Geomol
20-Sep-2005
[2172x2]
I agree, readability is very important! (Many forget that though.)
Why did he put unary minus in in the first place!?? ;-)
We want the full story!
Ladislav
20-Sep-2005
[2174]
to comfort the ones who would miss it above all, I think
Romano
20-Sep-2005
[2175]
The performance issue depends from the fact that Rebol must understand 
from the context what is the the meaning of "-": it can be one of 
three (see before). While all other op can work as action! or op! 
(+ 2 3 or 2 + 3) , minus can work in three different modes (2 different 
actions: negate and subtract and an op! 2 - 3). I would remove not 
the unary minus but the fact that any op! can work like an action 
(+ for add, * for multiply) this would make the evaluation loop a 
little more fast.
Benjamin
21-Sep-2005
[2176]
read/skip never work's will this bug ever be fixed ?
Henrik
21-Sep-2005
[2177]
benjamin, are you using the latest core with the /seek refinement?
Graham
21-Sep-2005
[2178]
see http://www.rebol.net/article/0199.htmlregarding seek.
Benjamin
22-Sep-2005
[2179]
seems to work ok, but i think the original purpose was a simple line 
of code to make the seek  with a simple read, any whay this works 
ok to me many thanks
Ingo
22-Sep-2005
[2180x2]
Why do I get an error "invalid argument" here?


>>       comp-length: func [a b][compare (length? a/2) (length? b/2)]
>>       sort/skip/compare files 2 :comp-length
** Script Error: Invalid argument: 2
** Near: sort/skip/compare files 2 :comp-length
>> source compare
compare: func [

    {compares to values, and returns -1 / 0 / 1 for values a<b / a=b 
    / a>b}
    a b
    /local return
][
    case [
        a > b [-1]
        a < b [1]
        true [0]
    ]
]

REBOL/View 1.3.1.3.1
files is somthing like [%abc [%a/ %xx/] %def [%xyz/] ...]
Sunanda
22-Sep-2005
[2182]
Add /all to the sort:
sort/all/skip/compare files 2 :comp-length
Ingo
22-Sep-2005
[2183]
That still doesn't work, I just checked wether I had accidentally 
overwritten 'sort, but no ...
Sunanda
22-Sep-2005
[2184]
It works for me:
files: copy  [%abc [%a/ %xx/] %def [%xyz/]]
compare: func [

        {compares to values, and returns -1 / 0 / 1 for values a<b / a=b 
        / a>b}
        a b
        /local return
    ][
        case [
                a > b [-1]
                a < b [1]
                true [0]
            ]
    ]


print system/version
sort/compare/all/skip files  :compare 2
probe files

1.3.1.3.1
== [%def [%xyz/] %abc [%a/ %xx/]]