1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 7. Advanced Programming with GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius Manual"><link rel="up" href="index.html" title="Genius Manual"><link rel="prev" href="ch06s09.html" title="Lvalues"><link rel="next" href="ch07s02.html" title="Toplevel Syntax"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Advanced Programming with GEL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s09.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel-programming-advanced"></a>Chapter 7. Advanced Programming with GEL</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch07.html#genius-gel-error-handling">Error Handling</a></span></dt><dt><span class="sect1"><a href="ch07s02.html">Toplevel Syntax</a></span></dt><dt><span class="sect1"><a href="ch07s03.html">Returning Functions</a></span></dt><dt><span class="sect1"><a href="ch07s04.html">True Local Variables</a></span></dt><dt><span class="sect1"><a href="ch07s05.html">GEL Startup Procedure</a></span></dt><dt><span class="sect1"><a href="ch07s06.html">Loading Programs</a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-error-handling"></a>Error Handling</h2></div></div></div><p>
If you detect an error in your function, you can bail out of it. For normal
errors, such as wrong types of arguments, you can fail to compute the function
by adding the statement <code class="literal">bailout</code>. If something went
really wrong and you want to completely kill the current computation, you can
use <code class="literal">exception</code>.
</p><p>
For example if you want to check for arguments in your function. You
could use the following code.
</p><pre class="programlisting">function f(M) = (
if not IsMatrix (M) then (
error ("M not a matrix!");
bailout
);
...
)
</pre><p>
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s09.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Lvalues </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Toplevel Syntax</td></tr></table></div></body></html>
|