Last updated at 2005/07/11 10:48:20 PDT by Temporal

This section contains a few real modules from Evlan so that you can easily see what Evlan code looks like. This code was written against the v0.3 prototype implementation; major changes are planned, so code may look somewhat different in the future. These are just raw code samples; they are not intended to be particularly educational.


For a shorter example, here is a definition of the classic QuickSort algorithm.

quickSort = (elements, isBefore) => result where
   result =
      if elements.size <= 1
         then elements
         else sortedElements
   sortedElements = Array.join({quickSort(parts[0], isBefore),
                       {pivot}, quickSort(parts[1], isBefore)})
   #Select a pivot, then call Array.group to group the other elements
   #around it.
   pivot = elements[0]
   rest = Array.getInterval(elements, 1, elements.size)
   parts = Array.group(rest, 2,
      i => if isBefore(rest[i], pivot) then 0 else 1)
evlan.org © Copyright 2003-2005 Kenton Varda
Powered by Io Community Manager, Evlan, and FreeBSD