This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <netdb.h> | |
#include <dispatch/dispatch.h> | |
#include <readline/readline.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% build/tranquil < calltest.tq | |
Starting parse | |
Entering state 0 | |
Reducing stack by rule 69 (line 300): | |
-> $$ = nterm empty (-1950691328.32767--1950691328.32767: ) | |
Stack now 0 | |
Entering state 2 | |
Reading a token: Next token is token tIDENTIFIER (1.1-1.1: ) | |
Reducing stack by rule 70 (line 303): | |
$1 = nterm empty (-1950691328.32767--1950691328.32767: ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
captureMePlease = "hey I was defined in the root! " | |
a = { :arg | | |
block = { :arg | | |
arg = arg stringByAppendingString:captureMePlease. | |
return arg. | |
} | |
return (block:arg.). | |
} | |
myBlock = a | |
numAsStr = a:(321 stringValue.). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state 50 | |
62 message_unterminated: message_receiver identifier . ':' opt_nl message_args | |
63 | message_receiver identifier . | |
':' shift, and go to state 72 | |
':' [reduce using rule 63 (message_unterminated)] | |
$default reduce using rule 63 (message_unterminated) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
captureMePlease = "hey I was defined in the root! " | |
a = { :arg | | |
block = {:arg | | |
arg = arg stringByAppendingString:captureMePlease | |
return arg | |
} | |
return block(arg). | |
} | |
myBlock = a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Foo < NSObject { | |
+ classMethod { | |
print("I'm a class method %@", captureMePlease) | |
} | |
- instanceMethod: iMethArg { | |
print("From: %@ To: %@", iMethArg, self) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TQRuntime.h" | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
static const NSString *_TQDynamicIvarTableKey = @"TQDynamicIvarTableKey"; | |
#pragma mark - Utilities |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ A backslash outside a string is a comment | |
¥ The Yen sign can also be used (See Japanese keyboard layouts to understand why) | |
\ Keywords | |
yes | |
no | |
nil | |
self | |
super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL TQAugmentClassWithOperators(Class klass) | |
{ | |
// Check if it already has operators | |
if(class_getInstanceMethod(Klass, sel_registerName("==:")) | |
return NO; | |
// == | |
IMP imp = imp_implementationWithBlock(^(id a, id b) { return [a isEqual:b] ? @YES : @NO; }); | |
SEL sel = sel_registerName("==:"); | |
class_addMethod(klass, sel, imp, "@@:@"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- map: lambda { | |
^self reduce: { obj accum=#[] | accum push lambda(obj) } | |
} | |
- _reduce: lambda result: result { | |
^self empty? unless: { | |
result push lambda(self next) | |
^self _map:lambda result: result | |
} else: { | |
^result | |
} |