systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Boehm <mboe...@googlemail.com>
Subject Re: function default parameters
Date Sat, 22 Apr 2017 00:25:02 GMT
well, for arguments passed into dml scripts there is of course ifdef($b, 2)
but for functions there is indeed no good support. At runtime level we
still support default parameters for scalar arguments at the tail of the
parameter list but I guess at one point the corresponding parser support
was discontinued.

I personally would like a default specification similar to R in the
function signature with the corresponding function calls that bind values
to a subset of parameters.

Regards,
Matthias

On Fri, Apr 21, 2017 at 4:18 PM, Deron Eriksson <deroneriksson@gmail.com>
wrote:

> Is there a way to set default parameter values using DML? I believe both R
> and Python offer this capability.
>
> The only solution I could come up with using DML is to pass in a variable
> that is NaN and cast this to a string and use this string in an if
> conditional statement.
>
> addone = function(double b) return (double a) {
>     c = ''+b;
>     if (c == 'NaN') {
>         b = 2.0
>     }
>     a = b + 1;
> }
>
> z=0.0/0.0;
> x = addone(z);
> print(x);
> y = addone(4.0);
> print(y);
>
> Is there a cleaner way to accomplish this, or is DML lacking this R
> feature?
>
> Deron
>
> --
> Deron Eriksson
> Spark Technology Center
> http://www.spark.tc/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message