Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Cmd+⇧+K | delete line |
| Cmd+↩ | insert line after |
| splitWith :: (a -> Bool) -> [a] -> [[a]] | |
| splitWith f lst = case dropWhile notF lst of | |
| [] -> [] | |
| lst' -> x : (splitWith f lst'') | |
| where (x, lst'') = break notF lst' | |
| where notF = not . f |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Cmd+⇧+K | delete line |
| Cmd+↩ | insert line after |
| $ cat ~/.sbtconfig | |
| SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -XX:MaxPermSize=256M" |
| import scala.language.experimental.macros | |
| import scala.reflect.macros.Context | |
| /** Trying out macros in Scala 2.10 */ | |
| object Macros { | |
| def compiledTime(): String = macro compiledTime_impl | |
| def compiledTime_impl(c: Context)(): c.Expr[String] = { | |
| import c.universe._ | |
| val date = c.Expr[String](Literal(Constant(new java.util.Date().toString))) |
| def drop[T](list: List[T], n: Int): List[T] = { | |
| @tailrec | |
| def loop(l: List[T], n: Int): List[T] = l match { | |
| case Nil => l | |
| case _ if n == 0 => l | |
| case x :: xs => loop(xs, n - 1) | |
| } | |
| loop(list, n) | |
| } |
| Hello Gist |
| object Hello extends App{ | |
| println "hello" | |
| } |
| // Example of computing attributes in Rats! | |
| AssignStmt assignStmt = l : expr COLONEQ r : expr { yyValue = new AssignStmt(l, r) } | |
| // class that represents an assignment statement node. | |
| class AssignStmt extends Stmt { | |
| Expression _lhs, _rhs; // children | |
| public AssignStmt(Expression l, Expression r) { | |
| _lhs = l; | |
| _rhs = l; | |
| } |
| /** | |
| * Syntax Analysis production | |
| * void means do not create AST | |
| * / means ordered alternative | |
| */ | |
| module Sample; | |
| header { import java.util.*;} | |
| body { public static final Set<String> |