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

World: r3wp

[Core] Discuss core issues

Oldes
15-Sep-2010
[18141x3]
I found not use ALTER as it's not native.. I usually use the solution 
UNIQUE where the block is not much large, but if efficiency is needed, 
I would just go with:

unless find blk val [append blk val]
(I found = I would)
I don't want to add new refinements for such a easy to do solutions 
as they would slow every APPEND a little bit.
Pekr
15-Sep-2010
[18144]
it is just, at least for me, when using append at all - it is very 
often used idiom ...
Graham
15-Sep-2010
[18145]
some people prefer this construct

all [
	find blk val
	append blk val
]
Henrik
15-Sep-2010
[18146]
that would be ANY instead of ALL.
Graham
15-Sep-2010
[18147x2]
oh yeah :)
two characters shorter than Oldes' solution
Pekr
15-Sep-2010
[18149x2]
that's programmer's solution, but it does not read as nicely as - 
if not found? find blk val [append blk val] :-)
yes, Oldes' version reads even nicely ...
Graham
15-Sep-2010
[18151x3]
Who says?
These are just idioms ...
I always have to think twice or more when i come across 'unless :)
Pekr
15-Sep-2010
[18154x2]
And I have to think more than twice, when using combination of NOT 
ALL, NOT ANY :-)
Can I somehow get a difference of two blocks, with different sizes? 
Trying to avoid loops, but I will use loop most probably anyway ...

blk1 structure: [contract user tarif]
blk2 structure: [contract user street town tarif]


I know there are functions like intersect/difference, they even have 
/skip refinement, but those most probably can't treat different record 
sizes?
Oldes
15-Sep-2010
[18156]
Graham, you are not english native speaker? For me it's easy.. I 
learned that UNLESS = IF NOT and so I use it:) http://www.edufind.com/english/grammar/IF9.cfm
Pekr
15-Sep-2010
[18157]
I remember UNLESS from extended basic of ZX Spectrum. And I lowed 
the word itself, dunno why :-)
Oldes
15-Sep-2010
[18158x2]
Are you looking for this?

>> difference [contract user tarif] [contract user street town tarif]
== [street town]
or what result do you expect?
Pekr
15-Sep-2010
[18160x2]
no, sorry ... those are just structures, but blocks contain real 
data, hundreds and thousands of records ...
but never mind, I will use loop and look-up, no problem, just laziness 
:-)
Graham
15-Sep-2010
[18162]
unless is one more character than if not .. so why use it?
Ladislav
15-Sep-2010
[18163]
I guess, that what Pekr wants should be implemented carefully, otherwise 
it may end up being slow...
Oldes
15-Sep-2010
[18164]
Graham.. that's easy... because UNLESS is faster then IF NOT
Maxim
15-Sep-2010
[18165]
I really think, again, that  'append-or-insert-only-if-the-item-does-not-exist-already 
 should be a native in R3.


its a function MOST of us would use on a frequent basis.  it would 
be very usefull and its very powerfull with a /skip refinement
Pekr
15-Sep-2010
[18166]
agreed ...
Ladislav
15-Sep-2010
[18167]
As opposed to that, my opinion is, that it should not be a native, 
since no significant speedup against a mezzanine would be observable
Maxim
15-Sep-2010
[18168x2]
we can start with a mezz... but because of the find and then insert/tail 
and all the possible refinements its needs to handle... overall, 
it will be faster as a native.
this function will often be used in loops, and the less functions 
and REBOL stack usage you have the bigger the speed gains.
Anton
15-Sep-2010
[18170x2]
Yes, I agree that it would be useful built in. (Whether it's native 
or mezz, doesn't really bother me.)
(Graham, "unless" = 6 chars = "if not")
Graham
15-Sep-2010
[18172]
ascii printable characters ... we are talking about saving ink here!
Maxim
15-Sep-2010
[18173]
yes and LCD fatique too
Graham
15-Sep-2010
[18174]
No body wants "unless" burnt into their screens!
Gregg
15-Sep-2010
[18175]
I would like to see a version of REBOL where only the bare minimum 
natives are implemented and everything else is a mezz. It's possible 
that REBOL would run many months faster if not preamturely optimized. 
;-)
Henrik
15-Sep-2010
[18176]
I'd be interested in seeing how small an executable could be made, 
if utterly everything was stripped, even file and network access.
Gregg
15-Sep-2010
[18177]
That might be interesting, but not terribly useful.
Henrik
15-Sep-2010
[18178]
well, then you can say that you can fit your software on a floppy 
and wave a 5.25" floppy in people's faces :-)
Gregg
15-Sep-2010
[18179x2]
We can do that now. Base is ~270K.
It's really hard, now, to find media small enough to make an "it 
fits" claim. :-) I think the smallest memory sticks I have are 64MB.
Henrik
15-Sep-2010
[18181]
I wonder if you can fit a script onto those square barcodes.
Graham
15-Sep-2010
[18182x2]
sure....
You mean QRCodes
Oldes
15-Sep-2010
[18184]
Does anybody has a script which would convert JS like expressions 
to REBOL expressions with correct precedency?
for example to convert this:
-( y1 - y0 ) / ( y2 - 2 * y1 + y0 )
to:
-( y1 - y0 ) / ( y2 - (2 * y1) + y0 )
Maxim
15-Sep-2010
[18185]
I think Gabriele has an math expression compiler.
Sunanda
16-Sep-2010
[18186]
A version of Gabriele's work is here:
    http://www.rebol.org/ml-display-message.r?m=rmlXHTS
Ladislav
16-Sep-2010
[18187x2]
See also http://www.fm.tul.cz/~ladislav/rebol/evaluate.r
(using different precedence rules)
amacleod
16-Sep-2010
[18189]
what's wrong here?

>> num: 24
== 24
>>
>> tup: to-tuple [num num num]
** Script Error: Invalid argument: num
** Where: to-tuple
** Near: to tuple! :value
>>
Sunanda
16-Sep-2010
[18190]
Try:
    to-tuple reduce [num num num]