I'm trying out some code highlighting here. Pretty Print configuration thanks to Luka Marinko
Some Objective-C to try out
- (void)applicationDidFinishLaunching:(NSNotification *)notification { // load the app's main window for display myWindowController = [[MyWindowController alloc] initWithWindowNibName:@"MainWindow"]; [myWindowController showWindow:self]; }
Some straight C, with line numbers
long int some_function(); /* int */ other_function(); /* int */ calling_function() { long int test1; register /* int */ test2; test1 = some_function(); if (test1 > 0) test2 = 0; else test2 = other_function(); return test2; }
Some Scheme:
(define (sqrt x) (sqrt-iter 1.0 x)) (define (sqrt-iter guess x) (if (good-enough? guess x) guess (sqrt-iter (improve guess x) x))) (define (good-enough? guess x) (< (abs (- (square guess) x)) 0.001)) (define (improve guess x) (average guess (/ x guess))) (define (square x) (* x x)) (define (average a b) (/ (+ a b) 2.0)) ;; This is the good enough for 1.7 (define (good-enough? guess better-guess) (< (abs (- guess better-guess)) 0.000001)) (define (sqrt-iter guess x) (if (good-enough? guess (improve guess x)) guess (sqrt-iter (improve guess x) x)))
Some inline code int i = 0
Seems to work good enough. Final notes:
- I had to specify the language for the scheme code
- Obj-C doesn't seem to be explicitly supported, but it does a passable job.
- I wish the template were wider to support Objective-C