Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#31 Let functions - first argument failure

closed
None
5
2011-10-21
2011-10-20
No

Last Trunk version gives an error when passing symbolic, non-numeric arguments to let-defined functions.

In this example:

======================================================================
for all t,f,nt,nf let fun( t,f,nt,nf) =
fun_t * t + fun_f * f + fun_nt * nt + fun_nf * nf + fun_0
$

x := fun( 1,b,c,d) ;
y := fun( a,b,c,d) ;

end ;

execution:

-------------------------------------------------------------------
*** fun declared operator
x := fun( 1,b,c,d) ;
x := b*fun_f + c*fun_nt + d*fun_nf + fun_0 + fun_t
y := fun( a,b,c,d) ;
***** `a' is an unbound ID
-------------------------------------------------------------------
The x is assigned correctly, with symbolic values of b,c,d.
The second call to fun fails when the first argument is not a number.
If the first argument involves an undefined variable, it gives the error "unbound ID"

In REDLOG (in which context i found this), passing as argument an expression "t+1" where t is
a quantified variable gave an error "Non-numeric argument in arithmetic"

Additional Bug data: revision Trunk- 1483 (last).
Using PSL lisp, but in CSL gives similar errors with slightly different text.
Ubuntu 11.10, 64 bits x86.

Discussion

  • the bug "reduce" script

     
    Attachments
  • Rainer Schöpf
    Rainer Schöpf
    2011-10-20

    The problem is the use of the variable name t, which is a reserved variable (section 2.4 of the manual). If you use, e,g., tt instead, your example works.

    This fact should be made clearer in the manual.

    Rainer

     
  • Rainer Schöpf
    Rainer Schöpf
    2011-10-21

    Fixed in trunk revision 1485, Variable name "t" can now safely be used as free variable in rules.

     
  • Rainer Schöpf
    Rainer Schöpf
    2011-10-21

    • assigned_to: nobody --> schoepf
    • status: open --> closed-fixed