code samples
Some code samples
by Dr. Olaf Hoffmann,
2008-11-05.
report sample
neutral
Dr. Olaf Hoffmann
Appelstraße 2
30167 Hannover
Deutschland/Germany
email:
dr.o.hoffmann@gmx.de
samples for code elements
Code elements indicate texts in specific structures or languages intended for programs or machines to be interpreted.
However if this appears in Literature Markup LanguageLML,
this is not directly interpreted by machines as machine code, it is typically used to provide samples for example for
educational purposes.
<p>
This is an example for a <el>bc</el>
element containing some
<abbr><meta><desc>Literature Markup Language</desc></meta>LML</abbr>.
Basically line breaks are preserved in a
<el>bc</el> or <el>code</el>
element.
</p>
<p>
There is not much more to say about <el>bc</el> or <el>code</el>.
Note, that the sample contains examples for the element <el>code</el> too.
</p>
One more thing to note - code inside bc or code
can be marked as CDATA
as well as in this paragraph.
In the previous paragraphs the tags are masked manually.
]]>
<p>
The following indicates CDATA
: <![CDATA[ 'CDATA content' ]]>.
</p>
Other elements from the code domain are code, var and val, these
are for general inline code, for a variable or parameter (the name) and its value. For example:
"If $divisor == 0,
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 code: "If $divisor == 0
,
then a specific rule is needed to avoid division by zero."
To indicate an object, function, procedure, module the element ob can be used. Example:
It is possible to specify functions in Hypertext PreProcessorPHP
in the following way. Here for example the function foo:
]]>
The function foo can be called in the further code, here the return value is put into the variable $fooreturn
and displayed using the predefined function echo:
]]>
Typically for markup languages are the elements el for an element and ap for an attribute or
property. The val can be used here too for the value of an attribute or property. Elements are already
indicated in this article with the element el. If a more detailed identification of the language is
required, the attribute property can be used for el, ap, var and op,
with the attributes datetype or typeof the type of a var can be specified in more detail.
Entities from mathematics and physics are typically scalars, vectors, matrices or tensors. And often units are used to
indicate some measurable quantities. LML has some elements to markup such fundamental
constructions.
The following is a list of samples:
n the letter n used as a representation of a number or scalar using the element n
v, 0 the letter v used as a representation of a vector and the zero vector representing
the origin using the element v
m, 0, 1 the letter m used as a representation of a matrix, the zero matrix and the unit matrix using the element m
tijk a tensor t with three indices indicating that it is three dimensional using the element t to indicate the tensor and sub to indicate the indices
5m indicating a length or distance of five meters using the element u 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.