Commit 5db8c4372448689a41fbb9f6ca2d928251cc13be

Golmote 2015-03-20T07:23:46

Add quick examples for Objective C and Julia

diff --git a/examples/prism-julia.html b/examples/prism-julia.html
new file mode 100644
index 0000000..38c95f1
--- /dev/null
+++ b/examples/prism-julia.html
@@ -0,0 +1,32 @@
+<h1>Julia</h1>
+<p>To use this language, use the class "language-julia".</p>
+
+<h2>Full example</h2>
+<pre><code>function mandel(z)
+    c = z
+    maxiter = 80
+    for n = 1:maxiter
+        if abs(z) > 2
+            return n-1
+        end
+        z = z^2 + c
+    end
+    return maxiter
+end
+
+function randmatstat(t)
+    n = 5
+    v = zeros(t)
+    w = zeros(t)
+    for i = 1:t
+        a = randn(n,n)
+        b = randn(n,n)
+        c = randn(n,n)
+        d = randn(n,n)
+        P = [a b c d]
+        Q = [a b; c d]
+        v[i] = trace((P.'*P)^4)
+        w[i] = trace((Q.'*Q)^4)
+    end
+    std(v)/mean(v), std(w)/mean(w)
+end</code></pre>
\ No newline at end of file
diff --git a/examples/prism-objectivec.html b/examples/prism-objectivec.html
new file mode 100644
index 0000000..8cd0164
--- /dev/null
+++ b/examples/prism-objectivec.html
@@ -0,0 +1,47 @@
+<h1>Objective C</h1>
+<p>To use this language, use the class "language-objectivec".</p>
+
+<h2>Full example</h2>
+<pre><code>#import &lt;UIKit/UIKit.h>
+#import "Dependency.h"
+
+@protocol WorldDataSource
+@optional
+- (NSString*)worldName;
+@required
+- (BOOL)allowsToLive;
+@end
+
+@interface Test : NSObject &lt;HelloDelegate, WorldDataSource> {
+  NSString *_greeting;
+}
+
+@property (nonatomic, readonly) NSString *greeting;
+- (IBAction) show;
+@end
+
+@implementation Test
+
+@synthesize test=_test;
+
++ (id) test {
+  return [self testWithGreeting:@"Hello, world!\nFoo bar!"];
+}
+
++ (id) testWithGreeting:(NSString*)greeting {
+  return [[[self alloc] initWithGreeting:greeting] autorelease];
+}
+
+- (id) initWithGreeting:(NSString*)greeting {
+  if ( (self = [super init]) ) {
+    _greeting = [greeting retain];
+  }
+  return self;
+}
+
+- (void) dealloc {
+  [_greeting release];
+  [super dealloc];
+}
+
+@end</code></pre>
\ No newline at end of file