Skip to Content.
Sympa Menu

maude-help - [[maude-help] ] Creating higher order operators

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Chronological Thread  
  • From: Raghu Ranganathan <rraghu.11502 AT gmail.com>
  • To: maude-help AT lists.cs.illinois.edu
  • Subject: [[maude-help] ] Creating higher order operators
  • Date: Sat, 2 Dec 2023 14:30:17 +0800

I would like to create an operator that can take in a different operator and add that operator to its expansion. I want to implement things like map and filter in haskell or find useful alternatives to those.

For example:

mod FUNC{X :: TRIV} is
  ex LIST*{X} .
  pr META-TERM .
  var F : Term .
  var Y : List{X} .
  var N : Nat .
  op map : X List{X} -> List{X} .
  op inc : Nat -> Nat .
 
  eq map(F, Y) = append( [F(head(Y))], map(F, tail(Y)) ) .
  eq inc(X) = X + 1 .
endm

then red map(inc, [1 2 3])  should reduce to [2 3 4].

I'm not sure how to make this parse and work correctly. Thank you for your help in advance.



Archive powered by MHonArc 2.6.24.

Top of Page