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

World: r3wp

[Core] Discuss core issues

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
Will
26-Aug-2010
[18031x2]
hello, is there a BUG or what I'm I doing wrong?
  extract [#[false]] 2
;   [none]
  extract [#[false] 1 2 3] 2
;   [none 2]
I want a false, not a none !   Thank you 8-)
Henrik
26-Aug-2010
[18033x2]
looks like a bug to me.
also in R3. both are mezzanines, so it should be possible to fix 
it.
BrianH
26-Aug-2010
[18035x2]
It's a bug. Scheduled to be fixed in 2.7.8 - fix already submitted, 
and in R2/Forward. Submitted for R3 as well.
I can post the fixed versions here as well if you like.
Will
26-Aug-2010
[18037x2]
Thank you, do you have a link where I can get the pathced version 
?
Oh, yes please, but I would still be interested in where I can get 
your latest R2/Forward 8-)
BrianH
26-Aug-2010
[18039]
It's where all the mezzanine source and fixes go: R3 chat, aka DevBase.
Will
26-Aug-2010
[18040]
humm ok I'll check how to browse R3 chat later, Now if you could 
paste a copy of extract here I would be very thankfull 8-)
BrianH
26-Aug-2010
[18041x2]
R3 mezzanines are in #26. R2 mezzanines are in #41. R2/Forward is 
in #837.
Here's the R2 version:
extract: func [
	"Extracts a value from a series at regular intervals."
	[catch]
	series [series!]
	width [integer!] "Size of each entry (the skip)"
	/index "Extract from an offset position"
	pos "The position" [number! logic! block!]
	/default "Use a default value instead of none"

 value "The value to use (will be called each time if a function)"

 /into "Insert into a buffer instead (returns position after insert)"
	output [series!] "The buffer series (modified)"
	/local len val
][

 if zero? width [return any [output make series 0]]  ; To avoid an 
 infinite loop
	len: either positive? width [  ; Length to preallocate
		divide length? series width  ; Forward loop, use length
	][

  divide index? series negate width  ; Backward loop, use position
	]
	unless index [pos: 1]
	either block? pos [

  if empty? pos [return any [output make series 0]] ; Shortcut return
		parse pos [some [number! | logic! | set pos skip (

   throw-error 'script 'expect-set reduce [[number! logic!] type? get/any 
   'pos]
		)]]
		unless into [output: make series len * length? pos]
		if all [not default any-string? output] [value: copy ""]
		; R2 PARSE doesn't work well for binary!, so spoof a string!.
		if binary? series [series: as-string series]
		forskip series width [forall pos [
			if none? set/any 'val pick series pos/1 [set/any 'val value]
			output: insert/only output get/any 'val
		]]
	][
		unless into [output: make series len]
		if all [not default any-string? output] [value: copy ""]
		; R2 PARSE doesn't work well for binary!, so spoof a string!.
		if binary? series [series: as-string series]
		forskip series width [
			if none? set/any 'val pick series pos [set/any 'val value]
			output: insert/only output get/any 'val
		]
	]
	either into [output] [head output]
]
Will
26-Aug-2010
[18043]
THANK YOU! 8-)