Skip to Content.
Sympa Menu

maude-help - [[Maude-help] ] higher order FILTER function

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

[[Maude-help] ] higher order FILTER function


Chronological Thread 
  • From: "Francesoc Bongiovanni" <bongiovanni AT gmail.com>
  • To: maude-help AT lists.cs.illinois.edu
  • Subject: [[Maude-help] ] higher order FILTER function
  • Date: Fri, 22 Apr 2016 09:42:18 -0500

Hi there,

I am playing a bit with Maude and trying to implement the filter higher order
function based on some code for the MAP function I found on this archive a
long time ago.

fmod AP{X :: TRIV, Y :: TRIV} is
*** one param function
sort Func{X,Y} .
op _[_] : Func{X,Y} X$Elt -> Y$Elt [prec 17] .
*** no param function
sort FFunc{X} .
op _[] : FFunc{X} -> X$Elt [prec 17] .
endfm


fmod FILTER{X :: TRIV, Y :: TRIV} is
inc AP{X,Y} .
inc BOOL .
pr LIST{X} .
pr LIST{Y} .

var E : X$Elt .
var L : List{X} .
var F : Func{X,Y} .

op filter : List{X} Func{X,Y} -> List{Y} .
eq filter(nil, F) = nil .
ceq filter(E L, F) = E filter(L, F) if F[E] == true .

endfm

When I load the module, the interpreter does not expect E there...why? what I
am missing ?

Thanks in advance for your insights

- Francesco



Archive powered by MHonArc 2.6.16.

Top of Page