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

World: r3wp

[Core] Discuss core issues

BrianH
19-Apr-2010
[16410]
We have &= already though, it's called APPEND.
Ashley
19-Apr-2010
[16411]
As long as the first argument is a series ...
BrianH
20-Apr-2010
[16412x2]
All of the operators above are modifying, and the only things you 
can concatenate to in R3 are supported by APPEND. So yeah.
Series, or map or object.
Maxim
23-Apr-2010
[16414x5]
is there a function which looks like find but return true here:

Type desktop to start the Viewtop.
>> a: ["111" "222" "111"]
== ["111" "222" "111"]
>> b: a/3
== "111"
>> same? find a b b
== false
otherwise this HAS to be added to R3
something like FIND/EXACT
or even better  FIND/SAME
it would also be a hell of a lot faster  :-D
Ladislav
23-Apr-2010
[16419]
no native of this kind is available yet AFAIK
Pekr
23-Apr-2010
[16420]
or index? being extended, to return you a pointer to the originating 
series? But such information might not be available to interpreter 
after the assignment?
Ladislav
23-Apr-2010
[16421]
(but I wrote a corresponding function to the Identity articticle)
Maxim
23-Apr-2010
[16422x2]
its a shame cause looping a large list manually and comparing with 
same?  is VERY slow  :-(

on a 10 million sized series. 


my fastest FIND-SAME loop is 20 time slower than FIND, which would 
be much faster, since all it would have to do is compare a pointer.
did you time it vs find?  maybe its faster than mine?
Ladislav
23-Apr-2010
[16424]
No way, I did not optimize for speed
Steeve
23-Apr-2010
[16425]
can't you wrap the items of the list inside objects ?
In that case, it will be a find/same
Maxim
23-Apr-2010
[16426x2]
here's my fastest one yet... I tried two so far...

	;-----------------
	;-     find-same()
	;-----------------
	find-same: func [
		series [block!]
		item [series! object!]
		/local s i
	][
		i: 1
		repeat s series [
			i: i + 1
			if same? s item [
				break
			]
		]
		unless i > length? series [
			at series i - 1
		]
	]
	

using until was slower probably because REPEAT is faster than UNTIL 
(no exit condition or series index to increase).
steeve no... its a database like flast list of labels with corresponding 
data items.
Steeve
23-Apr-2010
[16428]
Hey it's your choice, nothing is unchangeable :-)
Maxim
23-Apr-2010
[16429x2]
its for the list style... hehe would you rather do

fill my-list/aspects/list ["Steeve" 1 "Max" 2 "Lad" 3] 

or


fill my-list/aspects/list reduce [context [label: "Steeve" data: 
1] context [label: "Max" data: 2] context [label: "Lad" data: 3]]
note the multi-column list will use the same data interface


IMHO it gets even less fun if you are using DB queries to populate 
the list.


it also generates a lot of useless & SLOW binding everytime you change 
the list
sqlab
23-Apr-2010
[16431]
How about combining find with a loop
find-same: func [
	series [block!]
	item [series! ]
	/local s 
][
	while [s: find series item] [
		if same? first s item [return  true]
		series: next s
	]
	false
]
Maxim
23-Apr-2010
[16432x3]
that's a hell of good a idea  :-)
thanks why didn't I think of that

to close to the tree to see the forest   :-/
yep much faster.   :-)


still /SAME has to be added to FIND.  the search would be almost 
instantaneous (Relatively speaking, of course) if done natively.
Pekr
23-Apr-2010
[16435]
the same goes for /first (find first occurance in a block of multiple 
targets ... a long planned feature)
Maxim
23-Apr-2010
[16436]
you mean as in deep searching a tree of blocks ?
Steeve
23-Apr-2010
[16437x2]
should be a little bit faster

while [serie: find/tail serie item][
	all [same? serie/-1 item return  true]
]
Optimization is a never ending story
Maxim
23-Apr-2010
[16439]
Steeve, I think your major contribution to GLASS can be in optimising 
various things.
Steeve
23-Apr-2010
[16440]
Or port it to R3
Maxim
23-Apr-2010
[16441]
because of liquid's lazyness, very few things are actually optimised 
(really need to)... but right now I have a problem on initialization 
where there is so much linkeage being done, it does create a nagging 
pause on startup.


I already know a few things that will greatly optimise liquid itself, 
and will implement speed minded plugs specifically for GLASS, but 
your input will be invaluable.


you've spent sooo much time on this specific aspect of REBOL coding 
that it will come naturally to you.
Steeve
23-Apr-2010
[16442]
Well, It will a pleasure :)
Optimizing scripts is my hoby
Maxim
23-Apr-2010
[16443]
in the last 6 months, I've allready optimized liquid's kernel by 
a factor of at least 50 times I think I can speed it up at least 
10x more.  on specific points, I can probably improve it even more. 
 that will probably come at increased memory use for some plugs though.
Steeve
23-Apr-2010
[16444]
Propably some inspectors could be added in the flow  to do some JIT 
compilation of your plugs ;-)
Maxim
23-Apr-2010
[16445x5]
for example, I am thinking of building a !node and !container base 
plugs which cannot mutate into different processing mechanisms.... 
will all the removed overhead, that will make a BIG difference.  


it will require a bit more experience in handling liquid... but within 
controled environments like glass and glob, this can be a non-issue.
yes.  it would be exceedingly easy, since you have state information 
about things being clean or not, and liquid is 100% class based OOP 
(as opposed to prototype) so once a node has been defined, it can 
be freely JIT, since every reference to the instance is referenced, 
not bound.
which is why it used at least 100 times less RAM than it (and is 
200 times faster) than would be under traditional REBOL object use.
with R3 I want to replace every part of the kernel with commands, 
but for that, we need access to the object! datatype within extensions 
(or host-kit).
AFAICT the next few extension release will allow some acces to context, 
so that might be the green light for me to go ahead and adapt my 
dataflow framework to R3.
Gregg
23-Apr-2010
[16450]
I wouldn't say We MUST add /SAME to FIND, though it could be useful 
in special cases. Another posssibility, though I want to think about 
it more before standing behind it, would be to allow AT to take an 
index value that is a reference. Hmmm, no, maybe not. It would then 
have to return NONE if the item wasn't in the block. Nevermind.
Steeve
23-Apr-2010
[16451]
lol
Tomc
23-Apr-2010
[16452x2]
find/at  foo bar
== NaN
revolucent
30-Apr-2010
[16454x3]
How can I check that a given value conforms to a typeset? E.g.,  
If I say "make typeset! [string! integer!]" how can I check that 
the number 17 conforms to that typeset?
I've written a recursive function to do it, but I wondered if there 
weren't some better way.
Never mind. I just issued "source any-string?" and got my answer: 
find typeset type? :value. Perfect.
Gregg
3-May-2010
[16457x2]
On MIN/MAX with pairs, sorry I wasn't clear. I do NOT think it's 
a bug. I use that behavior myself, and seem to recall it being discussed 
long ago. It may not be what you expect initially, but I think it's 
the right design choice.
I just wanted to point it out in the context of pair comparisons.
Terry
7-May-2010
[16459]
how does one probe a map! ?