changeset 33:fc72b98aba8c

Fixed formatting of lambda expressions with multiple arguments. (Was producing 'Illegal Matlab expression (a,b)' error.)
author samer
date Tue, 25 Sep 2012 09:57:24 +0100
parents adce0075bf6c
children 439e7d337647
files prolog/plml.pl
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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(_,[]) --> [].