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

World: r3wp

[Core] Discuss core issues

Tomc
20-Aug-2010
[17981]
also look at prefix trees, may be a simpiler  variant for word compleation
Chris
21-Aug-2010
[17982]
Is there a case to be made for use/only ?

>> use [a][a: 1]
== 1
>> use/only [a][a: 1]
== [a: 1]

Replaces having to 'double bag' -
>> use [a][[a: 1]]

Am I missing an obvious equivalent?
Ladislav
21-Aug-2010
[17983]
I would say, that your equivalent is fine. Since it is not that hard 
to use the "double bag", I doubt it justifies the refinement, since 
the refinement expression isn't shorter than the expression it is 
supposed to replace.
Chris
21-Aug-2010
[17984x2]
You get longer line lengths in the standard style:

use [a][
    [
	a: 1
    ]
]

; picture a: 1 being slightly more code
vs.

use/only [a][
    a: 1
]


Partly it's aesthetics - but this is a language, aesthetics can be 
important.
Ladislav
22-Aug-2010
[17986x2]
It still is possible to introduce just a special "double bag style", 
which is aesthetically acceptable, IMO (I have seen it somewhere, 
so it is not my invention):

use [a] [[
    a: 1
]]
>> f: func [] [[
[        a: 1
[        b: 2
[        ]]
>> f
== [
    a: 1
    b: 2
]
>> source f
f: func [][[
        a: 1
        b: 2
    ]]
Graham
22-Aug-2010
[17988]
I've got diplopia!
Gabriele
22-Aug-2010
[17989]
The disadvantage of [[ is that it can be difficult to notice sometimes, 
but otherwise it seems acceptable in cases like this.
Izkata
22-Aug-2010
[17990]
If I'm using that, I usually double-indent the surrounded code, to 
help make it easier to notice
Chris
22-Aug-2010
[17991x2]
Gab: right, it's more difficult to visually parse, and it's ugly 
(two different issues, I'd say).  Perhaps I need to use a 'double-bag 
function.
It's also mentally uncomfortable - it feels like there should be 
a way to do use/only [a][a: 1]

parse "this" use/only [mk][opt "t" mk: to end (probe mk)]
Izkata
22-Aug-2010
[17993]
Any reason not just pull the 'use outwards?

use [mk][
   parse "this" [opt "t" mk: to end (probe mk)]
]
Chris
22-Aug-2010
[17994]
In that case, no.
Gabriele
23-Aug-2010
[17995x2]
alternatively... one could think of extending WITH (not sure if we 
ever decided if we wanted that built-in)
(hmm, no, same problem, WITH still evaluates)
Anton
23-Aug-2010
[17997]
The current USE does:
1. Create context of specified words.
2. Bind body.
3. Evaluate.
Chris wants to be able to remove the evaluation.

In a perfect world with no legacy issues to worry about, I would 
prefer USE to do only steps 1 & 2, and USE/DO to do all three steps.

Or, a new function could be introduced (which I might name ENCLOSE 
or COOP) which does only steps 1 & 2.


Alternatively, if there was a function which returned a context created 
from a block of words, eg:


 CONTEXTUALIZE: func [words [block!]] [ ... ]  ; Returns a new context 
 containing words without evaluation.


then you could imagine using an idiom to get steps 1 & 2, or all 
three steps. eg:

	bind body contextualize words  ; Steps 1 & 2.
	do bind body contextualize words   ; All three steps.

So Chris' example would be:


 parse "this" bind [opt "t" mk: to end (probe mk)] contextualize [mk]

(<sigh> If only BIND had its argument order reversed...)
Maxim
24-Aug-2010
[17998x3]
I'm working on a high-performance windows counter for R2.   on my 
system, the resolution is 1 / 3500000  !!!


just calling the function twice, back to back returns more than 6700 
counts in difference.. which is pretty fast.
AFAICT, it uses something like the CPU frequency counters directly.
wow, this is so precise, I can time a single call to a native!  :-)
Pekr
24-Aug-2010
[18001]
why R2? You have got sources to R3. Improve timers in there :-)
Maxim
24-Aug-2010
[18002x2]
not timers, counters....   ;-)
its probably the same high-precision counters that R3 uses.
Pekr
24-Aug-2010
[18004]
why are you working on counters, instead of releasing Glass, which 
was supposed to be out 3 months ago? :-) Is that somehow related?
Maxim
24-Aug-2010
[18005]
I am on vacation, I having fun working on my animation/game/math 
package.  this will allow more precise animation timing... cause 
as it stands, in R2 I can't manage much more than 32 OR 66 frames 
per second, since all time values are stuck in 0.016 increments.
Pekr
24-Aug-2010
[18006]
good enough :-) So we finally can make a Scala killer later :-)
Maxim
24-Aug-2010
[18007]
did you try my little view test app?
Pekr
24-Aug-2010
[18008x4]
While REBOL can animate fast, the movement of elements is still jerky. 
Double buffering does not help here either.
Yes, I did. And I was really impressed - cool performance - it is 
... realtime :-)
... but I don't know, if we can prevent tearing/flickering, unless 
using DirectX (or OGL?) Simply put - when I visit my friend, and 
he turns-on his A500, and we watch some demos, I still have to say 
- wow, WTF - 7MHz machine? :-)
hmm, wrong group for such a discussion anyway ....
Gabriele
24-Aug-2010
[18012]
Anton: see make-context in http://www.rebol.it/power-mezz/mezz/module.html#section-7


I agree that it would probably make sense to have this as a native. 
The common usage though is that of USE so I don't think it should 
be changed.
DideC
25-Aug-2010
[18013x2]
I have a question about 'unique that could become a feature request.

Somebody ask (on the french Rebol forum) how he could remove the 
duplicate records from this dataset :
database: [
	a "b" "c 1" "d"
	a "b" "c 2" "d" 
	a "b" "c 3" "d"
	a "b" "c 2" "d" ;ligne 4 to delete
	a "b" "c 5" "d" 
	a "b" "c 6" "d" 
	a "b" "c 7" "d" 
	a "b" "c 2" "d" ;ligne 8 to delete
]

My first though was "use 'unique func". But it turns out that it 
can't do what I though.

As usual, the doc tells nothing about that (in fact it ells pretty 
nothing on the func), but with the /skip refinment, it seems it only 
checks the first value at each skip position (so the 'a in this dataset), 
not all the values of the record.
ells=tells
Henrik
25-Aug-2010
[18015x3]
AFAIR, this is a bug.
http://www.rebol.net/cgi-bin/rambo.r?id=4018&

Only 4 years old.
R3 has the same flaw
DideC
25-Aug-2010
[18018]
Goog memory (and you were fastest than me at finding the RAMBO ticket).
Henrik
25-Aug-2010
[18019]
I was betting there was a RAMBO ticket. Ran into this bug earlier 
this year.
DideC
25-Aug-2010
[18020]
It could be its behaviour (if documented), but then a /all refinment 
would be nice to toogle the "all fields check" (like the 'sort func 
one).
Izkata
25-Aug-2010
[18021x3]
'unique appears to be using the entire record with the /skip refinement 
- if it was just the first value ('a), then there would only be 1 
record remaining (2.7.6)
wait, nevermind
confused myself when testing in-place functions with the not-in-place 
'unique
DideC
25-Aug-2010
[18024]
I see several UNIQUE bugs in CureCode too. And this one is already 
posted (by you Henrik) http://curecode.org/rebol3/ticket.rsp?id=726&cursor=22
So far, I understand your answer speed ;-)
Henrik
25-Aug-2010
[18025x2]
ok, I forgot submitting it, but that's how I remember it, I guess.
added a comment about the R2 bug
DideC
25-Aug-2010
[18027]
Good idea.
Anton
25-Aug-2010
[18028]
Gabriele, it would certainly be good to have your nice MAKE-CONTEXT 
built in. I had a strong feeling you had something like that already 
done. I just wish for a shorter function name. You're probably right 
about the higher frequency usage of USE, but I was just trying to 
find a way to minimize the characters typed.

In my proposed alternative reality, where  USE and DO USE  replace 
 MAKE-CONTEXT and USE, there would be a saving in typing only if 
DO USE was used less than 3 times as often as USE (ie. < 75% of the 
time).

If I could show that, then my alternative reality would at least 
have some typing advantage.
I don't have much hope of that, so I withdraw.
I'd be very happy with your MAKE-CONTEXT built in, anyway.
shadwolf
25-Aug-2010
[18029x2]
can't it be easyer to have a delet function that will delet the 4th 
and 8th entry  (but once the 4th entry is deleted then ... the 9th 
entry become the 7th entry) i was always suprised that in the list 
management it was easy to add sort  locate information in a list 
but so painfull to be able to simply remove a record... (anyway if 
each "line" would be stored in a subblock it would be easier to remove 
them as line)
4 year old persisting bug is not cool ...  it hae to be fixed