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

World: r3wp

[Core] Discuss core issues

Gabriele
8-Jul-2011
[1673x2]
binary diff can be expensive - if you control the application that 
modifies the data, can you log the changes instead?
if not, you probably want something like this: http://publications.cse.iitm.ac.in/734/
Gregg
8-Jul-2011
[1675x3]
I did some a long time ago Henrik. It isn't fast enough to work on 
data of any size though. I can dig it out if you're interested. Can't 
remember what state of completion it's in.
Any *significant* size that is.
It's also high space complexity.
Henrik
8-Jul-2011
[1678]
The biggest object here is around 4 MB or 550 kb compressed. I expect 
that binary diff would only be used during load and save, and then 
keep full objects in memory.
Gregg
8-Jul-2011
[1679x2]
Mine will be way too slow for that.
My original goal was not binary diffs, but diffing blocks.
Henrik
9-Jul-2011
[1681]
you are right. I looked into it and it looks to be way too slow, 
so I'm trying another approach.
Geomol
11-Jul-2011
[1682x3]
>> negate 2 + - 2
== 0
>> - 2 + - 2
== -4

Bug?
Isn't unary minus introducing a third semantic rule? Functions are 
prefix, operators are infix with precedence over functions. And then 
unary minus is prefix with precedence similar to operators?
w> - (2 + (- 2))
== 0
w> (- 2) + (- 2)
== -4

Question is, how would we read
- 2 + - 2
Endo
11-Jul-2011
[1685]
It does correctly I think, here is the trace log:
>> - 2 + - 2
Trace:  - (word)
Trace:  2 (integer)
Infix:  op (add)
Trace:  - (word)
Trace:  2 (integer)
Geomol
11-Jul-2011
[1686]
I'm asking, if unary minus should work as if being defined like this:

>> set '- :negate
Maxim
11-Jul-2011
[1687]
no,  AFAICT the unary minus is applied exactly like all operator 
precedence (from left to right).


negate and  "-"  do not have the same precedence, as you noted, so 
its normal for:
    >> negate 2 + - 2    
and
    >> - 2 + - 2
to give different results.
Geomol
11-Jul-2011
[1688]
Ok, intensional then. I'm surprised.
Steeve
11-Jul-2011
[1689]
You shouldn't old pal :-)
Geomol
11-Jul-2011
[1690x2]
Is unary minus the only prefix thing, that has same precedence as 
operators?
:) Sometimes I feel, I have no clue about this language. ;)
Steeve
11-Jul-2011
[1692]
actually, unary minus has an higher precedence than other ops
Geomol
11-Jul-2011
[1693x2]
Functions with literal arguments works about the same.

>> f: func ['a] [probe a]
>> f 2 + 2
2
== 4

So f gets the value 2 in this example.
Complicated rules! ;)
Steeve
11-Jul-2011
[1695]
because functions with literals stop the evaluation flow
Geomol
11-Jul-2011
[1696x2]
yeah
Tonight's Moment of REBOL Zen:

>> switch/default 'a [a 1] 2 
== 2
Andreas
11-Jul-2011
[1698]
What's the insight here?
Geomol
11-Jul-2011
[1699]
>> switch/default 'a [a [1]] 2
== 1
Steeve
11-Jul-2011
[1700]
so what ?
Geomol
11-Jul-2011
[1701]
Isn't it strange, that if the value being searched for (in this case 
a) is found, and the next item in the block isn't a block, then it 
fails to defaul?
Andreas
11-Jul-2011
[1702]
No.
Geomol
11-Jul-2011
[1703x2]
*default*
ok :)
Andreas
11-Jul-2011
[1705x2]
From the docstring for SWITCH: "Selects a choice and evaluates the 
block that follows it."
>> switch 'a [a b [1]]
== 1
>> switch 'b [a b [1]]
== 1
Steeve
11-Jul-2011
[1707]
must be a block, nothing else
Geomol
11-Jul-2011
[1708]
Oh, the docs are different at
http://www.rebol.com/docs/words/wswitch.html
It sais "Selects a choice and evaluates what follows it."

Must be a block
 ... hm why?
Steeve
11-Jul-2011
[1709]
because it says so
Geomol
11-Jul-2011
[1710]
Ok, got it from Andreas' example. Multiple values. :)
Andreas
11-Jul-2011
[1711x2]
C-style fallthrough.
(I think that was the intention behind that particular behaviour.)
Geomol
11-Jul-2011
[1713]
yup, cute! :)
Steeve
11-Jul-2011
[1714x2]
the syntax of switch evolved
it was different back...
Geomol
11-Jul-2011
[1716]
Damn, now I have to change my own switch. ;)
Andreas
11-Jul-2011
[1717x2]
Yes, I think back in 2.5 (or earlier), switch 'a [a 1] actually returned 
1.
Ah, that was still the case in 2.6, even.
Geomol
11-Jul-2011
[1719]
I'm behind schedule, since I haven't noticed this.
Andreas
11-Jul-2011
[1720]
2.7.2 it was:
http://www.rebol.net/upnews/0008.html
Maxim
11-Jul-2011
[1721]
the change to switch was a good thing... wasn't it also mezz code 
a wee back?  IIRC this happened at the same time... and it made A 
LOT of code much faster.
Ladislav
11-Jul-2011
[1722]
>> - 2 + - 2
** Script error: - operator is missing an argument