Promise (computing)

Promise (computing)

:"See also Lazy evaluation"A promise is the final item in a Stream. A Stream itself is a way to shorten a very long sequence into a short one, and request only the items needed at the moment. For example, in pseudocode, assuming intseq reports an integer sequence up to its input:

intseq(5)=(1, 2, 3, 4)

For long computations, like intseq(10000), a program may not immediately need a list containing 10,000 elements. Upon a closer look at intseq, it may look something like this:

define intseq (value, this=1) { if (this = value) return; return flatten(this, intseq(value, this+1)); }

If not all integers were needed immediately, it would be moer efficient to return a promise instead. A stream_intseq may look like this (in pseudocode):

define stream_intseq(value, this) { if (this = value) return; return flatten(this, "*end*", way_to_invoke(stream_intseq(value, this+1))); }

In this way, a way to invoke (generated by way_to_invoke) the next operation is returned after a custom value that defines the end of data input (in this case, "*end*"). When needed, the caller can use the handle generated by way_to_invoke to invoke the next result. This will be added to the data part of the list, and the next invocation will be stored. For example, for stream_intseq(5), through all invocations:

(1, *end*, way_to_invoke(stream_intseq(5, 2))) (1, 2, *end*, way_to_invoke(stream_intseq(5, 3))) (1, 2, 3, *end*, way_to_invoke(stream_intseq(5, 4))) (1, 2, 3, 4, *end*, way_to_invoke(stream_intseq(5, 5))) (1, 2, 3, 4)

Notice the one extra invocation of stream_intseq, that is determined afterward to be empty. This is normal, as it happens to intseq as well.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Promise theory — In computer science, the Promise theory describes policy governed services, in a framework of completely autonomous agents, which assist one another by voluntary cooperation alone. It is a framework for analyzing realistic models of modern… …   Wikipedia

  • Promise (disambiguation) — A promise is a transaction whereby a person makes a vow or guarantee.Promise may also refer to:MusicPromise: * Promise (rapper), Canadian hip–hop artist * Promise (female rapper), Los Angeles–based hip hop/electro artist * Promise (album), by… …   Wikipedia

  • Timeline of quantum computing — Timeline of quantum computers1970s* 1970 Stephen Wiesner invents conjugate coding.* 1973 Alexander Holevo publishes a paper showing that n qubits cannot carry more than n classical bits of information (a result known as Holevo s theorem or Holevo …   Wikipedia

  • Microsoft Open Specification Promise — The Microsoft Open Specification Promise (or OSP), is a promise by Microsoft, published in September 2006, to not assert legal rights over certain Microsoft patents on implementations of an included list of technologies.[1] The OSP is an example… …   Wikipedia

  • Next-Generation Secure Computing Base — The Next Generation Secure Computing Base (NGSCB), formerly known as Palladium, is a software architecture designed by Microsoft which is expected to implement parts of the controversial Trusted Computing concept on future versions of the… …   Wikipedia

  • Timeline of computing 1990–1999 — History of computing Hardware before 1960 Hardware 1960s to present Hardware in Soviet Bloc countries Artificial intelligence Computer science Operating systems Programming languages …   Wikipedia

  • High Performance Computing and Communication Act of 1991 — The High Performance Computing and Communication Act of 1991 (HPCA) is an Act of Congress promulgated in the 102nd United States Congress as Pub.L. 102 194 on 1991 12 09. Often referred to as the Gore Bill,[1] it was created and introduced by… …   Wikipedia

  • Timeline of computing 1990–present — This article presents a timeline of events in the history of computing from 1990 to the present. For a narrative explaining the overall developments, see the related history of computers and history of computer science.Computing timelines: 2400… …   Wikipedia

  • Bishop Stopford's Maths and Computing School — Infobox Secondary school name = Bishop Stopford s Maths Computing School native name = motto = animus noster dei gloria established = 1967 type = Voluntary aided [ [http://www.bishopstopfords.enfield.sch.uk/i governors.php School web sit:… …   Wikipedia

  • Photonic computing — Today s computers use the movement of electrons in and out of transistors to do logic. Photonic computing is intended to use photons or light particles, produced by lasers, in place of electrons. Compared to electrons, photons are much faster… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”