Skip to Content.
Sympa Menu

k-user - Re: [K-user] How to Remove a Key from a Map

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] How to Remove a Key from a Map


Chronological Thread 
  • From: Traian Florin Șerbănuță <tserban2 AT illinois.edu>
  • To: "Seyed H. HAERI (Hossein)" <hossein.haeri AT gmail.com>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] How to Remove a Key from a Map
  • Date: Thu, 23 Feb 2012 19:14:13 -0600
  • Authentication-results: mr.google.com; spf=pass (google.com: domain of traian.serbanuta AT gmail.com designates 10.52.240.177 as permitted sender) smtp.mail=traian.serbanuta AT gmail.com; dkim=pass header.i=traian.serbanuta AT gmail.com
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user>
  • List-id: <k-user.cs.uiuc.edu>

Hi Hossein,

2012/2/23 Seyed H. HAERI (Hossein) <hossein.haeri AT gmail.com>
Hi Traian,

> There are two ways.

Cool! Both work. :)

 > One suggestion would be to check the k-prelude.maude from $K_BASE/core/maude/lib directory  for the syntax and definitions of the basic Set/Map constructs.  This would require
> some familiarity with Maude, though.

Had a look and it's well beyond me at the moment. I wonder how you do
value lookup for an existing key now?



As you might have guessed from the previous answer, there are two ways, again :-)

The first, is using direct matching.  For example the rule:
rule <k> X => V ...</k>  <state>... X |-> V ...</state>

matches X on top of the <k> cell and replaces it with the value V which X is mapped to in the state.

Alternatively, you can use the built-in map retrieval function for that, like this:

rule <k> X => Map(X) ...</k>  <state> Map </state>


hope this helps.

best wishes,
- traian


 
TIA,
--Hossein

--------------------------------------------------------------------------------------------------------------

Seyed H. HAERI (Hossein)

Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany

ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------

_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user




Archive powered by MHonArc 2.6.16.

Top of Page