Table of Contents
- The Orc Language
- The pruning combinator seems very inflexible; is there any way to select a publication based on some other criterion than "first"?
- How does Orc handle exceptions or errors?
- Running Orc programs
- I can't find X.inc in the Orc distribution.
- This demo I found on the web site does not work when I try and run it with the Orc interpreter on my computer.
- Building Orc
- I am getting a build error trying to compile Orchard (or OrcSites). Help!
The Orc Language#
The pruning combinator seems very inflexible; is there any way to select a publication based on some other criterion than "first"?#
Yes! The pruning combinator's behavior was chosen for its simplicity, but more complicated selection is possible using sites. For example, if you want to select the maximum value published by some expression f() (rather than the first value published):
val c = Buffer() f() >x> c.put(x) >> stop ; maximum(c.getAll())
Another typical request is to select some subset of values, not just one. For example, here is how you could get all the values published by f() within 1 second (and then terminate f):
val c = Buffer() repeat(c.get) << f() >x> c.put(x) >> stop | Rtimer(1000) >> c.closenb()
These are examples of a general idiom known as "routing", discussed in more detail in the Programming Idioms chapter of the User Guide.
How does Orc handle exceptions or errors?#
Semantically, Orc does not distinguish expressions which fail to yield a value from those which encounter an error. This makes sense in a distributed environment because when a distributed node fails it probably won't have a chance to notify the other nodes. Therefore the standard idiom for handling errors in Orc is to use timeouts or the "otherwise" combinator to detect when an expected publication does not occur and handle it appropriately.
Running Orc programs#
I can't find X.inc in the Orc distribution.#
This demo I found on the web site does not work when I try and run it with the Orc interpreter on my computer.#
The Orc distribution includes only the standard library for Orc. Many of the demos on the website need additional sites which are not included in the standard library. The implementations of these additional sites and the corresponding include files are found in Subversion:
- various web services and demo sites which do not require a web server, including search engines, Google Calendar, SMTP/IMAP/POP3 email, algorithmic animation, simple GUI tools, etc.
- demo sites which do require a web server, including web forms and direct receipt of email. These sites can only be used when running Orc programs via the web interface. Most users will not need to run these sites locally, but if you do, see HowToInstallOrchard for information on how to set up your own local Orc Web service.
I am getting a build error trying to compile Orchard (or OrcSites). Help!#
Please check the following before emailing us for help:
- You have checked out both OrcScala and OrcSites.
- You checked out OrcScala to a project named OrcScala (this is the default).
- All of your orc projects are in the same parent directory (this is the default).
- You have the latest version of all code from Subversion (select all projects, right click, and choose Team -> Update).
- If building Orchard, make sure you have built up-to-date JARs and copied them to Orchard/lib as instructed.
- Refresh all directories and do a Build -> Clean to make sure Eclipse isn't confused.