In fact, I'm beginning to thing that we ought to provide a Julia package ("GretlLink"?) on for communication with gretl with functions such as the above and more, ideally written by a specialist (Andreas, are you interested?). So in practice, a "using GretlLink" statement would be implicit every time we enter a "foreign" environment, possibly preceded by a 'Pkg.Add("GretlLink")' if necessary.

I'd like to help here, but I'm also bit swamped. I'm pretty up to date on the Julia side, but I'm not sure what it would take to make a good foreign environment in Gretl. If either of you can explain what is supposed to happen on the Julia side then I can probably do it without too much difficulty.

On Thu, Jan 21, 2016 at 3:38 AM, <> wrote:
A couple of Gretl scripts for
the same set of tests

21 січня 2016, 09:29:49, від "Riccardo (Jack) Lucchetti" <>:

On Wed, 20 Jan 2016, Allin Cottrell wrote:

> Perhaps we should offer a prize for the first example of actual time-saving 
> (and/or improvement in accuracy) in sending a calculation of the sort that 
> might be required in gretl out to julia for computation.

Easy: just take Oleh's recursion example.

set echo off
set messages off

function scalar fib(scalar n)
     return n<2 ? n : fib(n-1) + fib(n-2)
end function

set stopwatch
eval fib(30)
native = $stopwatch

foreign language=julia
 	function fib(n)
 		if n<2
 			return n
 			return fib(n-1)+fib(n-2)
end foreign
julia = $stopwatch

print native julia


          native =  71.920384

           julia =  4.4912745

   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)
Gretl-devel mailing list

Gretl-devel mailing list