G'MIC exercises

onfail is necessary only in very rare cases. Like if what follow foo_no_arg_ would be something that destroys the math expression, but at the same time corresponds to some weird filename.
Like:

$ gmic foo_noarg_ ").jpeg"

it’s unlikely to happen in practice, but who knows ? :slight_smile:

And you your other request, I’d propose something like this:

foo : skip ${1=?},${2=?},${3=?}
  l[]
    a,b,c=?,?,?
    if ("(isnum($1) || ['$1']=='?') &&
         (isnum($2) || ['$2']=='?') &&
         (isnum($3) || ['$3']=='?')")
       a,b,c=${1-3}
    else noarg
    fi
  onfail noarg
  endl
  sp $a sp $b sp $c
1 Like