This file contains 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
// lambda trampoline | |
#include <stdio.h> | |
void foo(char *s) | |
{ | |
__asm("foo_label:"); | |
printf("%s\n", s); | |
} | |
This file contains 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
// lambda trampoline. crashes with gcc -O2 and -O3. | |
#include <stddef.h> | |
#include <stdio.h> | |
void | |
foo(char *s) | |
{ | |
__asm("foo_label:"); | |
printf("%s\n", s); |
This file contains 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
print "You have no mail.\n" | |
10000.times { | |
'$ '.display | |
gets.each do | e | | |
if (e == "uname\n") | |
puts "Runix 1.0" | |
elsif (e == "halt\n") | |
exit | |
else |
This file contains 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
// mutually recursive listener and broadcaster types with | |
// f-bounded polymorphism | |
class ListenerType<L extends ListenerType<L, B>, B extends BroadcasterType<L, B>> { | |
} | |
class BroadcasterType<L extends ListenerType<L, B>, B extends BroadcasterType<L, B>> { | |
} | |
class Listener extends ListenerType<Listener, Broadcaster> { | |
} | |
class Broadcaster extends BroadcasterType<Listener, Broadcaster> { | |
} |
This file contains 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> | |
#define CALL(name, ...) \ | |
{ \ | |
int the_args[] = { __VA_ARGS__ }; \ | |
name(sizeof(the_args) / sizeof(int), the_args); \ | |
} | |
void the_fun(unsigned nargs, int *args) | |
{ |
This file contains 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
(defclass (term A)) | |
(defclass literal-term ((term number)) | |
((value number)) | |
(:constructor ((value number)))) | |
(defclass is-zero-term ((term boolean)) | |
((subterm (term number))) | |
(:constructor ((subterm (term number))))) |
This file contains 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
abstract class Term<T> { | |
abstract T eval(); | |
} | |
class IntegerTerm extends Term<Integer> { | |
Integer value; | |
IntegerTerm(Integer value) { this.value = value; } | |
Integer eval() { return value; } | |
} |
This file contains 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
;;; Sample of EdgeLisp's content-based storage system | |
;;; https://github.com/manuel/edgelisp/blob/master/client/base.lisp | |
;; Create a blob containing the file's contents. | |
(defvar test-blob (base-make-blob "Hello content-centric world!")) | |
#[base-blob Hello content-centric world!] | |
;; Create a tree with a directory entry named "hello.txt" pointing to the blob's ID (hash). | |
(defvar test-tree | |
(base-make-tree (list (base-make-dentry "hello.txt" (base-object-id test-blob))))) |
This file contains 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
(run-cc | |
($lambda () | |
($let ((p (make-prompt))) | |
(+ 2 ($push-prompt p | |
($if (with-sub-cont p | |
($lambda (k) | |
(+ ($push-sub-cont k #f) | |
($push-sub-cont k #t)))) | |
3 | |
4)))))) |
This file contains 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
Welcome to Racket v5.1.1. | |
> (define-syntax bar (syntax-rules () ((_) 1))) | |
> (define (foo) (bar)) | |
> (foo) | |
1 | |
> (define-syntax bar (syntax-rules () ((_) 55555))) | |
> (foo) | |
1 ;; NOOOOOOOOOO!!! |
OlderNewer