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

World: r3wp

[Core] Discuss core issues

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-)
BrianH
26-Aug-2010
[18044x5]
Here's the R3 version:
extract: func [
	"Extracts a value from a series at regular intervals."
	series [series!]
	width [integer!] "Size of each entry (the skip)"
	/index "Extract from an offset position"
	pos "The position(s)" [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
][  ; Default value is "" for any-string! output

 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 [

  unless parse pos [some [number! | logic!]] [cause-error 'Script 'invalid-arg 
  reduce [pos]]
		unless output [output: make series len * length? pos]
		if all [not default any-string? output] [value: copy ""]
		forskip series width [forall pos [
			if none? set/any 'val pick series pos/1 [set/any 'val value]
			output: insert/only output :val
		]]
	][
		unless output [output: make series len]
		if all [not default any-string? output] [value: copy ""]
		forskip series width [
			if none? set/any 'val pick series pos [set/any 'val value]
			output: insert/only output :val
		]
	]
	either into [output] [head output]
]
If you aren't using 2.7.7 the THROW-ERROR in the block pos checking 
won't work, since earlier versions don't have that function.
It's mezzanine too though. Let me know if you need it.
This bit in the R2 version (twice):
	; R2 PARSE doesn't work well for binary!, so spoof a string!.
	if binary? series [series: as-string series]

is I think left over from trying to optimize away the FORSKIP and 
FORALL from the R2 version using PARSE. That approach was rejected 
a couple years ago, so those lines could be removed in theory. FORALL 
and FORSKIP are native in R3, as all loop functions must be for now.
Never mind, it is just the comments that are wrong. The AS-STRING 
is legit, but related to the general design flaws in R2's binaries 
that are fixed in R3.
Graham
27-Aug-2010
[18049]
>> within? 0x0 0x0 2x2
== true
>> within? 0x0 0x0 0x0
== false
Anton
27-Aug-2010
[18050x3]
It's a zero sized box, right?
No point can be in a zero sized box.
So those results look fine to me.
Graham
27-Aug-2010
[18053x3]
the 0x0 point occupies all points of the box simultaneously :)
methinks that within? should take, integers, pairs and triplets


so integers for a one dimension, pairs for two dimensions and triplets 
for 3D
and maybe take an optional function if you want to supply a sphere 
or other volume
BrianH
27-Aug-2010
[18056x3]
We don't have triplets. And the source of within is simple enough 
(on purpose, because of performance issues) that any optional function 
should be separate.
Anton, points have zero size. A zero-size rectangle could contain 
in theory one point. The question is whether WITHIN? is inclusive 
of that last point or not.
However, WITHIN? isn't for points, it's for pixels, and pixels have 
area. Which is I guess why that point isn't included.
Graham
27-Aug-2010
[18059]
tuple
Henrik
28-Aug-2010
[18060]
tuple is 8-bit only. I think WITHIN? looks ok.
Graham
28-Aug-2010
[18061]
triplets then!
Anton
28-Aug-2010
[18062]
(sorry, I did actually mean pixel)
BrianH
28-Aug-2010
[18063]
(I figured as much, but felt that the distinction was worth mentioning)
Gabriele
30-Aug-2010
[18064]
Should this be considered a bug? (R2)

>> b: reduce [:print :insert :read :+]  
== [native action native op]
>> find b :print
== none
>> find b :insert
== [action native op]
>> find b :+
== [op]
>> find b :read
== none
>> :print = :print
== true
>> :print = :read
== false
Anton
30-Aug-2010
[18065x2]
So FIND cannot locate native! types by direct comparison.

Looks like a bug to me !  I confirm the above behaviour with my testing 
on View 2.7.6.4.2 on Linux.
(FIND can locate native! datatypes, however, so that's working ok.)
>> find b native!
== [native action native op]
>> find next b native!
== [native op]
elenay
30-Aug-2010
[18067x2]
FAST ?
k: enbase checksum/secure to-string now/precise