<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="lmlmetahover.css" type="text/css" title="LML default" ?>
<?xml-stylesheet href="lmlBase.css" type="text/css" title="LML meta off" alternate="yes" ?>
<?xml-stylesheet href="lmlmetastatic.css" type="text/css" title="LML meta on" alternate="yes" ?>
<literature version="1.0"
xmlns="http://purl.oclc.org/net/hoffmann/lml/"
xmlns:xlink="http://www.w3.org/1999/xlink" 
xml:lang="en">
<meta>
<title>code samples</title>
<desc>
<p>Some code samples 
by <creator>Dr. Olaf Hoffmann</creator>,
<created>2008-11-05</created>.</p>
</desc>
<genre>report sample</genre>
<tune>neutral</tune>
<impressum>
<address>
<l>Dr. Olaf Hoffmann</l>
<l>Appelstraße 2</l>
<l>30167 Hannover</l>
<l>Deutschland/Germany</l>
<l />
<l>email:
&#100;&#114;&#46;&#111;&#46;&#104;&#111;&#102;&#102;&#109;&#97;&#110;&#110;&#64;&#103;&#109;&#120;&#46;&#100;&#101;
</l>
</address>
</impressum>
</meta>

<h>samples for code elements</h>


<p>
Code elements indicate texts in specific structures or languages intended for programs or machines to be interpreted.
However if this appears in <abbr><meta><desc>Literature Markup Language</desc></meta>LML</abbr>, 
this is not directly interpreted by machines as machine code, it is typically used to provide samples for example for 
educational purposes. 
</p>

<s>
<bc>
&lt;p&gt;
This is an example for a &lt;el&gt;bc&lt;/el&gt; 
element containing some 
&lt;abbr&gt;&lt;meta&gt;&lt;desc&gt;Literature Markup Language&lt;/desc&gt;&lt;/meta&gt;LML&lt;/abbr&gt;.
Basically line breaks are preserved in a 
&lt;el&gt;bc&lt;/el&gt; or &lt;el&gt;code&lt;/el&gt; 
element.
&lt;/p&gt;
&lt;p&gt;
There is not much more to say about &lt;el&gt;bc&lt;/el&gt; or &lt;el&gt;code&lt;/el&gt;.
Note, that the sample contains examples for the element &lt;el&gt;code&lt;/el&gt; too.
&lt;/p&gt;
<![CDATA[<p>
One more thing to note - code inside <el>bc</el> or <el>code</el></p>
can be marked as <code>CDATA</code> as well as in this paragraph. 
In the previous paragraphs the tags are masked manually.
</p>]]>
&lt;p&gt;
The following indicates <code>CDATA</code>: &lt;![CDATA[  'CDATA content'  ]]&gt;.
&lt;/p&gt;
</bc>
</s>

<s>
<p>Other elements from the code domain are <el>code</el>, <el>var</el> and <el>val</el>, these
are for general inline code, for a variable or parameter (the name) and its value. For example: 
"If <var>$divisor</var> == <val>0</val>, 
then a specific rule is needed to avoid division by zero." If one wants to pronounce the code aspect, one can 
include everything in a <el>code</el>: "If <code><var>$divisor</var> == <val>0</val></code>,
then a specific rule is needed to avoid division by zero."
</p>
<p>
To indicate an object, function, procedure, module the element <el>ob</el> can be used. Example:
</p>
<s>
<p>It is possible to specify functions in <abbr><meta><desc>Hypertext PreProcessor</desc></meta>PHP</abbr>
in the following way. Here for example the function <ob>foo</ob>:</p>
<bc>
<![CDATA[
<?php
function foo ($arg_1, $arg_2, ..., $arg_n)
{
    # do something resulting in $return ...
    return $return;
}
?>
]]>
</bc>
<p>
The function <ob>foo</ob> can be called in the further code, here the return value is put into the variable <var>$fooreturn</var>
and displayed using the predefined function <ob>echo</ob>:
</p>
<bc>
<![CDATA[
<?php
$fooreturn=foo ($arg_1, $arg_2, ..., $arg_n);
echo $fooreturn;
?>
]]>
</bc>
</s>

<p>
Typically for markup languages are the elements <el>el</el> for an element and <el>ap</el> for an attribute or
property. The <el>val</el> can be used here too for the value of an attribute or property. Elements are already
indicated in this article with the element <el>el</el>. If a more detailed identification of the language is
required, the attribute <ap>property</ap> can be used for <el>el</el>, <el>ap</el>, <el>var</el> and <el>op</el>,
with the attributes <ap>datetype</ap> or <ap>typeof</ap> the type of a <el>var</el> can be specified in more detail. 
</p>


</s>

<s>
<p>
Entities from mathematics and physics are typically scalars, vectors, matrices or tensors. And often units are used to
indicate some measurable quantities. <abbr>LML</abbr> has some elements to markup such fundamental
constructions.
</p>
<p>
The following is a list of samples:
</p>

<list>
<lt><n>n</n></lt> <li> the letter n used as a representation of a number or scalar using the element <el>n</el></li>
<lt><v>v</v>, <v>0</v></lt> <li> the letter v used as a representation of a vector and the zero vector representing 
the origin using the element <el>v</el></li>
<lt><m>m</m>, <m>0</m>, <m>1</m></lt> <li> the letter m used as a representation of a vector, the zero matrix and the unit matrix using the element <el>m</el></li>
<lt><t>t<sub>ijk</sub></t></lt> <li> a tensor t with three indices indicating that it is three dimensional using the element <el>t</el> to indicate the tensor and <el>sub</el> to indicate the indices</li>
<lt> 5<u>m</u></lt> <li> indicating a length or distance of five meters using the element <el>u</el> to indicate
the unit for meter, the 5 requires no specific markup, because it can be simply identified by the glyph, that it represents a number.</li>

</list>

</s>


</literature>
