From: Mark Thom Date: Sun, 28 Feb 2021 16:15:03 +0000 (-0700) Subject: enable op declarations with lists of operands using term expansion (#839) X-Git-Tag: v0.9.0~150^2~10 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=8e6a89b2792bd03c6ef09c16d08185dffd964a6e;p=scryer-prolog.git enable op declarations with lists of operands using term expansion (#839) --- diff --git a/src/toplevel.pl b/src/toplevel.pl index b46bf49d..4a861259 100644 --- a/src/toplevel.pl +++ b/src/toplevel.pl @@ -108,6 +108,17 @@ repl :- repl :- repl. +%% Enable op declarations with lists of operands, i.e., +%% :- op(900, fy, [$,@]). + +user:term_expansion((:- op(Pred, Spec, [Op | OtherOps])), OpResults) :- + expand_op_list([Op | OtherOps], Pred, Spec, OpResults). + +expand_op_list([], _, _, []). +expand_op_list([Op | OtherOps], Pred, Spec, [(:- op(Pred, Spec, Op)) | OtherResults]) :- + expand_op_list(OtherOps, Pred, Spec, OtherResults). + + read_and_match :- '$read_query_term'(_, Term, _, _, VarList), instruction_match(Term, VarList).