# HG changeset patch # User samer # Date 1348563444 -3600 # Node ID fc72b98aba8caebb1af765ff765ebc08c1927d2d # Parent adce0075bf6cd99162b621075e209d6be7630b50 Fixed formatting of lambda expressions with multiple arguments. (Was producing 'Illegal Matlab expression (a,b)' error.) diff -r adce0075bf6c -r fc72b98aba8c prolog/plml.pl --- a/prolog/plml.pl Sun Mar 04 16:10:23 2012 +0000 +++ b/prolog/plml.pl Tue Sep 25 09:57:24 2012 +0100 @@ -463,7 +463,7 @@ ml_expr(_,@B) --> !, "@", atm(B). ml_expr(I, \\B) --> !, "@()", ml_expr(I,B). ml_expr(I, A\\B) --> !, { term_variables(A,V), varnames(V) }, - "@(", ml_expr(I,A), ")", ml_expr(I,B). + "@(", varlist(A), ")", ml_expr(I,B). ml_expr(I,lambda(A,B)) --> !, ml_expr(I,A\\B). ml_expr(I,thunk(B)) --> !, ml_expr(I, \\B). @@ -534,6 +534,12 @@ range(I,A,B) --> !, "colon", args(I,A,B). +%% varlist(+Term)// is det. +% Format comma separated list of lambda expression arguments. +varlist((A,B)) --> !, atm(A), ",", varlist(B). +varlist(A) --> !, atm(A). + + %% clist(+Id:ml_eng, +Items:list(ml_expr))// is det. % Format list of Matlab expressions in a comma separated list. clist(_,[]) --> [].