%%center
[䷁ Contents|ReferenceManualExample2] [⬆ Up|ReferenceManualExample2] [⬅ Prev|ReferenceManualExample2] [➡ Next|ReferenceManualExample2]
/%

!!!Factory site {{Cell}}

The Cell site creates a write-once storage location.

!!''(default method)''

%%prettify 
{{{
site Cell[A]() :: A
}}}
/%

!Preconditions Required/Postconditions Asserted/Invariants Maintained

!Side-Effects of Invocation/State Maintained

!Abnormal Outcomes

!External Dependencies

!Performance Characteristics 

----
!!!{{Cell}} Instances

!State Maintained

Each {{Cell}} instance maintains a reference to zero or one contained value.

!!''read''
Read a value from the cell. If the cell does not yet have a value, block until it receives one.

%%prettify 
{{{
site Cell[A].read() :: A
}}}
/%

| __Idempotent__ | __Blocking__

!Postconditions Asserted

Cell has been written to.


!!''readnb''

Read a value from the cell. If the cell does not yet have a value, halt.

%%prettify 
{{{
site Cell[A].readnb() :: A
}}}
/%

| __Idempotent__ | __Non-blocking__

!Postconditions Asserted

If the {{readnb}} call published, the cell has been written to.


!!''write''

Write a value to the cell. If the cell already has a value, halt.

%%prettify 
{{{
site Cell[A].write() :: Top
}}}
/%

| __Idempotent__ | __Non-blocking__

!Preconditions Required/Postconditions Asserted/Invariants Maintained

!Side-Effects of Invocation/State Maintained

!Abnormal Outcomes

!External Dependencies

!Performance Characteristics 


%%collapsebox-closed
!! Example(s)
! Example 1
{{{
-- Publishes: 5 5
val c = Cell()
  c.write(5) >> c.read()
| Rtimer(1) >> ( c.write(10) ; c.read() )
}}}
/%
%%columns
!! Related Reference Topics
* [Combinators | ExampleCombinatorsReference]
* [Parallel Server Network | ParallelServerNetwork]
* [Site|ReferenceManualExample2]
* [JavaCall|ReferenceManualExample2]
* [Baz|ReferenceManualExample2]
----
!! Related Tutorial Sections
* [The . notation|https://orc.csres.utexas.edu/userguide/html/ch01s04.html#N10B4D]
* [Constants|https://orc.csres.utexas.edu/userguide/html/ch01s02.html#cor.constants]
* [Closures|https://orc.csres.utexas.edu/userguide/html/ch01s02.html#cor.closures]
/%

%%center
[䷁ Contents|ReferenceManualExample2] [⬆ Up|ReferenceManualExample2] [⬅ Prev|ReferenceManualExample2] [➡ Next|ReferenceManualExample2]
/%