Skip to Content.
Sympa Menu

maude-help - [Maude-help] Parametrized programming: unmapped sort...

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

[Maude-help] Parametrized programming: unmapped sort...


Chronological Thread 
  • From: Marc Boyer <Marc.Boyer AT onera.fr>
  • To: maude-help AT cs.uiuc.edu
  • Subject: [Maude-help] Parametrized programming: unmapped sort...
  • Date: Fri, 22 Jan 2010 16:57:12 +0100
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help>
  • List-id: <maude-help.cs.uiuc.edu>

Dear All,

I am still working with parametrized modules. I am trying to make
some map (like the calm list map, but with a third parameter).

**********************************************************************
*** Parametrized MAP

fth FUNCTION is
sorts Arg Dom Param .
op f( _ , _ ) : Arg Param -> Dom .
endfth

view FUNCTION-ARG from TRIV to FUNCTION is
sort Elt to Arg .
endv

view FUNCTION-DOM from TRIV to FUNCTION is
sort Elt to Dom .
endv

fmod MAP{ F :: FUNCTION } is
protecting LIST{FUNCTION-ARG}{F} *
( sort List{FUNCTION-ARG}{F} to List{Arg} ) .
protecting LIST{FUNCTION-DOM}{F} *
( sort List{FUNCTION-DOM}{F} to List{Dom} ) .

op map( _ , _ ): List{Arg} Param -> List{Dom} .

var arg : F$Arg .
var p : Param .
var l-arg : List{Arg} .
eq map( nil , p ) = nil .
eq map(arg l-arg , p ) = f( arg , p ) map( l-arg , p ) .
endfm


**********************************************************************
*** Here come instantiation

view ADD from FUNCTION to NAT is
sort Arg to Nat .
sort Dom to Nat .
sort Param to Nat .
op f( A:Arg , P:Param ) to term ( A:Nat + P:Nat ) .
endv

fmod TEST-MAP-INC is
protecting LIST{Nat} .
protecting MAP{ADD} .
subsort List{Nat} < List{Arg} .

op l : -> List{Nat} .
eq l = 3 4 2 8 6 9 3 2 .
op a : -> List{Arg} .
endfm

**** Add here is the problem: is can parse the first statement,
*** but none of the two others.

red map( l , p:Param ) .
red map( l , 10 ) .
red map( a , 10 ) .

*** End of code

Any idea ?

Regards,
Marc Boyer
--
Marc Boyer, Ingenieur de recherche ONERA
Tel: (33) 5.62.25.26.36 DTIM
Fax: (33) 5.62.25.26.52 2, av Edouard Belin
http://www.onera.fr/staff/marc-boyer/ 31055 TOULOUSE Cedex 4




Archive powered by MHonArc 2.6.16.

Top of Page