Skip to content

Instantly share code, notes, and snippets.

View banister's full-sized avatar
🇳🇱

John Mair banister

🇳🇱
View GitHub Profile
The key idea behind Smalltalk isn't Objects as everyone thinks at first glance, it's messages, at least so says Alan Kay. Now it's easy to get confused about this as everyone knows Smalltalk is all about objects, objects and more objects, objects of all sorts, ham and spam, invoice and portfolio, objects of desire, fast cars and intimate relationships, objects of this and that, numbers are objects, and all manner of things object; and ultimately, uterly, completely, and finally fully purely objects.
That's Smalltalk. Not. You missed it. It's messages! That's why the syntax is the way it is. That's why there is a correlation between message sends and methods on the object. That's why unary, binary and keywords stitch together the Smalltalk world into an integral wholistic system so well. It's the messages. In Smalltalk we don't write objects. We write messages between objects! Smalltalk is a verb focused language not a noun based system. Yes it has objects, but they play second fiddle, verbs rule, eventhoug
def myfunc(options={})
options = {
:a => 1,
:b => 2,
:c => 3
}.merge(options)
# code goes here
end
@banister
banister / val.rb
Created March 12, 2009 04:23 — forked from johnbender/val.rb
class PostQuery < Query
@@clauses = [:columns, :operations, :order]
def initialize(target_object)
super(target_object, @@clauses)
@clauses.each do |c|
class << self; self; end.define_method(c) { self[c] }
end
require 'rubygems'
require 'inline'
module Mult
VERSION = "0.1.0"
end
class Object
inline do |builder|
class Module
def +(other)
Module.new do
include self
include other
end
end
end
.file "pink.c"
.text
.globl foo
.type foo, @function
foo:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
addl $1, %eax
popl %ebp
module YCombinator
def y_comb(&generator)
proc { |x|
proc { |*args|
generator.call(x.call(x)).call(*args)
}
}.call(proc { |x|
proc { |*args|
generator.call(x.call(x)).call(*args)
}
module YCombinator
def y_comb(&generator)
->(x){
->(*args){
generator.(x.(x)).(*args)
}
}.(->(x){
->(*args){
generator.(x.(x)).(*args)
}
john@johnlinux ~ $ apt-cache search llvm
llvm - Low-Level Virtual Machine (LLVM) compiler for C/C++
llvm-cfe - C front end for LLVM C/C++ compiler
llvm-doc - documentation for LLVM (Low-Level Virtual Machine) compiler
llvm-examples - examples using LLVM (Low-Level Virtual Machine) compiler
llvm-libs - common libraries for LLVM compiler for C/C++
llvm - Low-Level Virtual Machine (LLVM) compiler for C/C++
llvm-cfe - C front end for LLVM C/C++ compiler
llvm-doc - documentation for LLVM (Low-Level Virtual Machine) compiler
llvm-examples - examples using LLVM (Low-Level Virtual Machine) compiler
llvm-libs - common libraries for LLVM compiler for C/C++