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

World: r3wp

[Core] Discuss core issues

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]
Maxim
16-Sep-2010
[18191]
add a reduce.
amacleod
16-Sep-2010
[18192]
dope
james_nak
16-Sep-2010
[18193]
I give up. I have a routine that creates CSV files but I am stuck 
with how change what is an 0D 0A  to just an 0A  when it comes to 
setting up the actual CSV text file.  Anyone know?
Maxim
16-Sep-2010
[18194x2]
write converts linefeeds to OS defaults unless you use /binary
if your source data actually has CRLF in them, just do:

replace/all datastr CRLF LF
james_nak
16-Sep-2010
[18196x2]
Maxim, I'll try that. Thanks.
Are you kidding me? It was the write function the whole time! Thanks 
Maxim.
Maxim
16-Sep-2010
[18198]
surprising you didn't know about this yet  :-)
james_nak
16-Sep-2010
[18199]
Maybe I did at one time but at my age it's easy to forget! Real easy. 
I just took a look at the reb dictionary and aha! , there it is in 
black and white.
Steeve
16-Sep-2010
[18200x2]
in R3 --> deline
>> num: 24
>> 1.1.1 * num
== 24.24.24
DideC
17-Sep-2010
[18202]
I need some help dealing with paths.

I have a block of sublocks and values refered by words.

I want to make a function that increment a value in a subblock based 
on a process number and a path. But adding subpath to a path seems 
to work only with file! type.

I hope that the code bellow obviously show what I want :

values: [

 1 [dos [new 0 modified 0 deleted 0] fic [new 0 modified 0 deleted 
 0]]

 2 [dos [new 0 modified 0 deleted 0] fic [new 0 modified 0 deleted 
 0]]
]

inc-counter: func [process path /local p] [
	p: select values process
	p/(path): 1 + p/(path)
]

inc-counter 1 'dos/new
inc-counter 1 'dos/new
inc-counter 2 'dos/deleted
inc-counter 2 'fic/modified
Sunanda
17-Sep-2010
[18203]
The code below seems to do what you want......Just lacks the clever 
optimisation that'll turn it into a one-liner :)

inc-counter: func [process path /local p] [
    p: select values process
    path: parse mold path "/"
    p: select p to-word path/1
    p: find p to-word path/2
    p/2: p/2 + 1
]
Ladislav
17-Sep-2010
[18204x2]
Hmm, I see such expressions as

    parse mold path ...

as a very bad habit
It is puzzling me, how often it can be encountered, even though it 
is discouraged in the documentation.
DideC
17-Sep-2010
[18206x2]
Thanks Sunanda. I need any length paths, but its a proposal I can 
work  based on.
Ladislav: anything better to propose ?
sqlab
17-Sep-2010
[18208]
inc-counter: func [process path /local p] [
	p: select values process
	p: select p first path
	change next find p second path 1 + p/(second path)
]
Sunanda
17-Sep-2010
[18209]
Thanks Ladislav and sqlab -- I was having a blindspot about being 
able to directly access the parts of a path.


DideC -- if you need to go to any depth, this version may help (subject 
to optimisation by the gurus):

inc-counter: func [process path /local p] [
    p: select values process
    foreach pp copy/part path -1 + length? path [
        p: select p pp
        ]
    p: find p to-word last path
    p/2: p/2 + 1
]