This seems to be working for me. What do you think?
%% getting the number of items in a list that satisfy a predicate (closure)
%% we need to use the $_ variable inside the closure
%% to pass the items in the list to be tested in the predicate
%% for example:
%% (number of {($_ < 5)} in $List into $N)
(number of $Closure in $List into $N)
(collect $Element){
*($Element is one of $List)
(query $Closure $Element)}
(into $Sublist)
(length of $Sublist into $N)
In Dialog, predicates are not “first class”, meaning that they can’t be passed around as values. Prolog has terms to represent computations as data.
The concrete syntax is different. Dialog has a markup-like syntax, where the primary type of content is text. Prolog is more like a traditional programming language, where the primary type of content is code.
Many Prolog versions include a Finite Domain constraint-solver, but Dialog does not.
Dialog has special IF-related features, like object tree operations, status bar, save/restore/undo, and so on.