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
macro to_string { | |
case $x => { (JSON.stringify({ $x: 0 }).slice(2, -4)) } | |
} | |
macro enum { | |
case [ $val:ident (,) ... ] => { | |
(function () { | |
var e = { | |
$( $val : (to_string $val) ) (,) ... | |
}; |
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
macro $do { | |
rule {($($x = $y) (,) ...) $body} => { | |
(function ($x (,) ...) $body)($y (,) ...) | |
} | |
rule {$name ($($x = $y) (,) ...) $body} => { | |
(function $name ($x (,) ...) $body)($y (,) ...) | |
} | |
} | |
$do (a = 1, b = 2) { |
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
macro sexp { | |
rule {()} => { | |
; | |
} | |
rule {($p)} => { | |
$p | |
} | |
rule {($x $y)} => { | |
$x($y); | |
} |
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
macro $do { | |
rule { { $y:expr } } => { | |
$y | |
} | |
rule { { $x:ident <- $y:expr $rest ... } } => { | |
λ['>=']($y, function($x) { | |
return $do { $rest ... } | |
}); | |
} | |
} |
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
==============Osu! Collection File============== | |
Edited by: Vendethiel | |
Number of collections listed: 19 | |
Collection 1: Train | |
http://osu.ppy.sh/b/185443/ nano - Omoide Kakera | |
http://osu.ppy.sh/b/202216/ HHHxMMxST - Oboro | |
http://osu.ppy.sh/b/206845/ Last Note. - Setsuna Trip (Short Ver.) | |
http://osu.ppy.sh/b/242002/ sweet ARMS - Date A Live (TV Size) | |
http://osu.ppy.sh/b/211732/ niki - WAVE | |
http://osu.ppy.sh/b/43655/ Kagamine Rin and Len - Trick and Treat |
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
ForBody: [ | |
o 'FOR Range ForExtra', -> extend {source: LOC(2) new Value($2)}, $3 | |
o 'ForStart ForSource ForExtra', -> | |
$2.own = $1.own; $2.name = $1[0]; $2.index = $1[1] | |
extend $2, $3 | |
] | |
ForStart: [ | |
o 'FOR ForVariables', -> $2 | |
o 'FOR OWN ForVariables', -> $3.own = yes; $3 |
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
package org.photon.login | |
import com.twitter.util.Future | |
import org.photon.common.Async | |
import java.sql.{PreparedStatement, Timestamp, ResultSet} | |
import org.joda.time.Instant | |
trait RepositoryComponentImpl[T, RepoT] { | |
implicit def timestamp2instant(t: java.sql.Timestamp) = new Instant(t.getTime) | |
implicit def instant2timestamp(i: org.joda.time.Instant) = new Timestamp(i.getMillis) |
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
type Transaction = mutable.Builder[Any, _] | |
def transaction[R](fn: Transaction => R): Future[NetworkSession] = { | |
val builder = List.newBuilder[Any] | |
fn(builder) | |
@tailrec | |
def rec(fut: Future[NetworkSession], buf: List[Any]): Future[NetworkSession] = buf match { | |
case head :: tail => rec(fut flatMap {_.write(head)}, tail) | |
case Nil => fut |
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
(use '[clojure.core.match :only [match]]) | |
(defn evaluate [env [sym x y]] | |
(match [sym] | |
['Number] x | |
['Add] (+ (evaluate env x) (evaluate env y)) | |
['Multiply] (* (evaluate env x) (evaluate env y)) | |
['Variable] (env x))) | |
(def environment {"a" 3, "b" 4, "c" 5}) |