• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Kaj
18-Jul-2012
[713x2]
I think the latter was Windows, so that would make ik very susceptible 
to anything else going on in the machine
Still, the difference between the Red functions is mysterious. I 
think Nenad would have to analyse that
Rebolek
18-Jul-2012
[715]
It isn't causing any problems, I'm just curious why it happens.
Kaj
18-Jul-2012
[716x5]
Yes, it's a good point
Syllable Server (Linux):
bash-4.0# ./test                                                 
                                                                 
           
sine-osc time: 5330000
square-osc time: 2760000
bash-4.0# ./test 
sine-osc time: 5450000
square-osc time: 2830000
That's stable scheduler timing. Problem solved, I guess, but not 
a good verdict for Windows
There could still be a performance issue on Windows
Rebolek
18-Jul-2012
[721]
These numbers look like something I expected :)
DocKimbel
18-Jul-2012
[722x3]
These are the timings on my Win7/Corei7 box:

sine-osc time:   1003
square-osc time: 939

sine-osc time:   997
square-osc time: 938

sine-osc time:   997
square-osc time: 952

-- reversed order --

square-osc time: 938
sine-osc time:   995

square-osc time: 939
sine-osc time:   996

square-osc time: 939
sine-osc time:   996
(ran the tests 3 times for each order)
Do you run Windows virtualized?
Rebolek
18-Jul-2012
[725]
No
DocKimbel
18-Jul-2012
[726]
I had a quick look at the code paths of both generated `square-osc` 
and `sin-osc` functions, all seems fine. But I do concurr that the 
results are not intuitive. I guess that the relative performances 
in such case are just too hardware-dependent.
Rebolek
18-Jul-2012
[727]
Probably yes.
DocKimbel
21-Jul-2012
[728]
Rebolek: issue #221 has been fixed.
Rebolek
22-Jul-2012
[729x5]
Doc, I can still reproduce it with this code:

x: 0.0
x: either x > 0.0 [x][0.0 - x]
print [x lf]

If I assign the result to 'y instead of 'x, it works.
Ah, that's not the reason. It happens when the condition is FALSE 
and FALSE block ends with expession.So the above code works for x 
= 1.0
When I change order, the code works:

x: 0.0
x: either x <= 0.0 [0.0 - x][x]
print [x lf]
But this also throws 11: float stack check error when used in function:

fabs: func [x [float!] return: [float!] ][
	either x < 0.0 [0.0 - x][x]
]
print [fabs -3.14 lf]
Final workaround :)

fabs: func [
	x			[float!]
	return:	[float!]
][
	x: either x < 0.0 [0.0 - x][x]
	x
]
print [fabs -3.14 lf]
DocKimbel
22-Jul-2012
[734x2]
Thanks, I will debug that tonight.
Issue fixed.
Rebolek
24-Jul-2012
[736]
It's fixed but this fix brings another 9: float invalid operation 
problem that wasn't present in last version. I'll post an example 
once I separate the problem.
DocKimbel
24-Jul-2012
[737x3]
I guess I should have added a few more unit tests from those tickets.
For people wondering what I was working on these last couple of month, 
here's a screenshot of the customer app I'm finishing now: http://sidl.fr/tmp/generator01.png


It's a visual editor for trading strategies that emits MQL4 code 
for Metatrader-based solutions (FOREX trading). The tree is editable 
and redraws itself automatically (no need to drag all the nodes around 
manually). This app also relies on an intermediary DSL for serializing 
the strategy on disk or before compiling it to MQL4. Here's an extract 
from the corresponding dialect representation of the tree from screenshot: 

start on 1 
if 1 buy 5 take 10 stop 10 on-profit [
    buy 6 take 10 stop 10 on-profit [
        buy 10 take 10 stop 10 loop
    ]
] on-loss [
    sell 7 take 10 stop 10 on-profit [
        buy 4 take 10 stop 10 loop
    ]
] 


All is done in REBOL/View 2.7.6 (to avoid CALL bug in 2.7.8) and 
all the source code is 47KB (25KB for the custom styles and VID events 
callbacks).


I'm at 99% completion of that app, so I've resume the work on Red 
since a couple of days.
(CALL is required for this app to invoke the MQL4 to EX4 native compiler)
Pekr
24-Jul-2012
[740x3]
Really nice :-)
Hopefully you got also refreshed, and got some new ideas for RED 
:-)
e.g. that native RED GUI would be handy, one day :-)
DocKimbel
24-Jul-2012
[743x3]
Certainly! But I must admit that I have hesitated in the beginning 
between HTML5 and VID for the GUI.
I chosed VID only because I knew I could do it faster than messing 
around with HTML/JS libs and intricacies. I was just a bit concerned 
about hitting some performance walls or native bugs I couldn't workaround. 
Fortunately, all went well.
*chose
Janko
24-Jul-2012
[746]
wow, looks really nice. I was never good with R gui's so I have no 
idea how you made those custom components
Rebolek
24-Jul-2012
[747]
Reaaly nice, Doc! btw see issue #222. This one is bit harder to trigger 
:)
DocKimbel
24-Jul-2012
[748]
Janko: it's not difficult, maybe the VID docs are just lacking some 
simple HOW-TO for that?
Janko
24-Jul-2012
[749x2]
I don't know. Please don't be bogged down by things like gui in Red 
too fast! You first have to make a langauge / a platform that others 
(we) can use and build upon and add libs when we need them. And for 
all the love to VID and like, my oppinion is still that usability 
matters the most and it's hard to beat usability (all the little 
conventions) with non-native GUI-s. Or big delevoloped libraries 
that emaulate them well enough (Qt, GTK, ...)
(I mean "we" add libs when we need them, not you when we need them 
;))
DocKimbel
24-Jul-2012
[751x2]
Priorities haven't changed, of course getting the core part done 
first is still the main goal. ;-)
I've pushed the enhanced get-word syntax support, so it's now possible 
to get a pointer on integer!, byte!, float! and float32! variables 
(without having to wrap them in a struct!). For example:

	s: declare int-ptr!
	a: 123
	s: :a
	print s/value		;-- will output 123


I will add the ARM backend support for that and update the documentation 
tonight.
Janko
24-Jul-2012
[753]
OT: Did I see right on FB that you moved to Montenegro? If you are 
passing Slovenia at any time you could present Red at it's biggest 
CyberCenter / Hackerspace ... Kiberpipa (and/or Hekovnik) if you 
wisted to. basically if you do let me know (they don't operate in 
the summer though) http://www.kiberpipa.org/en/
Rebolek
24-Jul-2012
[754]
Wow, great update! Will really simplify things!
DocKimbel
24-Jul-2012
[755]
Janko: right, I live in Podgorica now. I will check the kiberpipa 
site.
Rebolek
24-Jul-2012
[756x3]
Also, #222 seems gone with this update.
or not...
see comment in #222 and also see #223 for another variant of this 
problem.
Gregg
24-Jul-2012
[759]
Thanks for the update Doc!
Arnold
24-Jul-2012
[760]
Vid frees you from the browser and its limitations. If REBOL only 
had a HTML interface I would have dropped the language without further 
hesitation.
Kaj
24-Jul-2012
[761]
You would have missed great batch and server programming :-)
MaxV
25-Jul-2012
[762]
Did you installed the Rebol plug-in in your browser? Look at  http://www.maxvessi.net/rebsite/plugin/index.html