Add quick examples for Objective C and Julia
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
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 <UIKit/UIKit.h>
+#import "Dependency.h"
+
+@protocol WorldDataSource
+@optional
+- (NSString*)worldName;
+@required
+- (BOOL)allowsToLive;
+@end
+
+@interface Test : NSObject <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