The following is a list of programming languages and their syntax for doing metaprogramming.
Macros in C are just glorified string substitution.
import numpy | |
def hilbert(): | |
""" | |
Return NumPy array of shape (512, 3) containing successive coordinates | |
for a third-order three-dimensional Hilbert curve. | |
""" | |
a,b,c=numpy.indices((8,)*3).reshape(3,-1) | |
d=c[:8];r=abs(d-3>>1);g=(d^d>>1)*73;f=g[abs(d-1)&6] |
An example of [a space-filling curve layout](http://bl.ocks.org/nitaku/8772179) using [the Hilbert curve](http://bl.ocks.org/nitaku/6514960) to represent the *flare* software package classes. |
 |
//getters and settings done easy | |
var Circle = function(radius) { | |
this._radius = radius; | |
}; | |
Circle.prototype = { | |
set radius(radius) {this._radius = radius;}, | |
get radius() { return this._radius;}, | |
get area() { return Math.PI * (this._radius * this._radius);} | |
}; |
(ns hello-world.hello) | |
(defn- clj-map->js-map | |
"makes a javascript map from a clojure one" | |
[cljmap] | |
(let [out (js-obj)] | |
(doall (map #(aset out (name (first %)) (second %)) cljmap)) | |
out)) | |
(defn- attr [object attributes] |
//: Playground - noun: a place where people can play | |
import Foundation | |
func tablesOfTwo(x: Int) -> Int { | |
return 2 * x; | |
} | |
func tablesOfThree(x: Int) -> Int { | |
return 3 * x; |
public final static class CircBuf { | |
private ArrayList<String> circArray; | |
private int size = 6; | |
public CircBuf(final int size) { | |
this.size = size; | |
circArray = new ArrayList<String>(this.size); | |
} |
my %circ = ( | |
'(' => ')', | |
'[' => ']' | |
); | |
token circumfix_operation { (<circumfix_open>) <expression> (<circumfix_close>) <?{ %circ{$0} eq $1 }> } | |
token circumfix_open { @(%circ.keys) } | |
token circumfix_close { @(%circ.values) } |
<div class="pull-left">...</div> | |
<div class="pull-right">...</div> | |
<!-- Classes --> | |
<style type='text/css'> | |
.pull-left { | |
float: left !important; | |
} | |
.pull-right { |