Skip to Content.
Sympa Menu

k-user - Re: [K-user] count cells

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] count cells


Chronological Thread 
  • From: Omar Duhaiby <3omarz AT gmail.com>
  • To: Dwight Guth <dwight.guth AT gmail.com>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>, "Musab A. AlTurki" <musab AT kfupm.edu.sa>
  • Subject: Re: [K-user] count cells
  • Date: Fri, 14 Nov 2014 19:14:04 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Yes, that's right. I already have the wrapper cell. That didn't answer my question though. My question was: Can I get a count of only certain threads that have certain contents?


On Nov 12, 2014 11:56 PM, "Dwight Guth" <dwight.guth AT gmail.com> wrote:
The mechanism that we generally recommend is to wrap multiplicity-* collections inside a wrapper cell. So for example instead of:

configuration <thread multiplicity="*"> <k> ...

you have an additional layer:

configuration <threads> <thread multiplicity="*"> <k> ...



On Wed, Nov 12, 2014 at 2:42 PM, Omar Duhaiby <3omarz AT gmail.com> wrote:

Thank you, that's useful. But then I can't count threads that for example enclose a <k> . </k>, Can I?

On Nov 12, 2014 7:37 PM, "Dwight Guth" <dwight.guth AT runtimeverification.com> wrote:
The recommended way to do this is to create a function that takes a bag of Cells and returns how many copies of that cell are in the bag. Then, you create a rule similar to the following:

rule <threads> C:Bag </threads> <someOtherCell> countThreads(C) </someOtherCell>

On Tue, Nov 11, 2014 at 3:12 PM, Omar Duhaiby <3omarz AT gmail.com> wrote:

Hello,

Can I get a count of the number of instances of a certain cell type? For example, I want to count the number of threads in the environment.

I could keep a count of course by incrementing it every time I create a thread, and decrementing every time I destroy one, but I'm asking if such a feature is available in K.

Thank you
Omar Alzuhaibi


_______________________________________________
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