[svn] r5782: nemerle/trunk/doc/presentation/rotor-workshop-2005/content.tex

malekith svnadmin at nemerle.org
Sat Oct 1 11:43:19 CEST 2005


Log:
Add samples from source files.

Author: malekith
Date: Sat Oct  1 11:43:19 2005
New Revision: 5782

Modified:
   nemerle/trunk/doc/presentation/rotor-workshop-2005/content.tex

Modified: nemerle/trunk/doc/presentation/rotor-workshop-2005/content.tex
==============================================================================
--- nemerle/trunk/doc/presentation/rotor-workshop-2005/content.tex	(original)
+++ nemerle/trunk/doc/presentation/rotor-workshop-2005/content.tex	Sat Oct  1 11:43:19 2005
@@ -73,6 +73,113 @@
 \end{center}
 }
 
+\frame[containsverbatim]{
+\frametitle{Sample 1.0}
+\begin{verbatim}
+class Hello
+{
+  public static Main () : void
+  {
+    System.Console.Write ("Hello world!\n");
+  }
+}
+\end{verbatim}
+}
+
+\frame[containsverbatim]{
+\frametitle{Sample 1.1}
+\begin{verbatim}
+System.Console.Write ("Hello world!\n");
+\end{verbatim}
+}
+
+
+\frame[containsverbatim]{
+\frametitle{Sample 2.0}
+\begin{verbatim}
+class Factorial {
+  public static factorial (x : int) : int {
+    def loop (acc : int, x : int) : int {
+      if (x <= 1) acc
+      else loop (acc * x, x - 1)
+    }
+
+    loop (1, x)
+  }
+
+  public static Main () : void
+  {
+    System.Console.WriteLine (factorial (10));
+  }
+}
+\end{verbatim}
+}
+
+\frame[containsverbatim]{
+\frametitle{Sample 2.1}
+\begin{verbatim}
+class Factorial {
+  public static factorial (x : int) : int {
+    def loop (acc, x) {
+      if (x <= 1) acc
+      else loop (acc * x, x - 1)
+    }
+
+    loop (1, x)
+  }
+
+  public static Main () : void
+  {
+    System.Console.WriteLine (factorial (10));
+  }
+}
+\end{verbatim}
+}
+
+
+\frame[containsverbatim]{
+\frametitle{Sample 3.0}
+\begin{verbatim}
+[Record]
+class Foo {
+  my_value : int;
+  public Barize () : void
+  { System.Console.Write ($ "Foo ($my_value), "
+                            "times 42 = $(my_value * 42)\n");
+  }
+}
+class Qux { public Barize () : void { } }
+
+// Main starts here
+def call_barize (x) { x.Barize () }
+def our_list = [Foo (1), Foo (2), Foo (3)];
+foreach (e in our_list)
+  call_barize (e);
+\end{verbatim}
+}
+
+
+\frame[containsverbatim]{
+\frametitle{Sample 3.1}
+\begin{verbatim}
+[Record]
+class Foo {
+  my_value : int;
+  public Barize () : void
+  { System.Console.Write ($ "Foo ($my_value), "
+                            "times 42 = $(my_value * 42)\n");
+  }
+}
+class Qux { public Barize () : void { } }
+
+// Main starts here
+def call_barize (x) { x.Barize () }
+def our_list = [Foo (1), Foo (2), Foo (3)];
+// foreach (e in our_list)
+//  call_barize (e);
+\end{verbatim}
+}
+
 
 \section{Macros}
 \frame{



More information about the svn mailing list