#Mac OS X
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
val tens = Map ( | |
'2' -> "Twenty", | |
'3' -> "Thirty", | |
'4' -> "Fourty", | |
'5' -> "Fifty", | |
'6' -> "Sixty", | |
'7' -> "Seventy", | |
'8' -> "Eighty", | |
'9' -> "Ninety" | |
) withDefaultValue("") |
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
object Foo { | |
val bar = { println("bar"); 42 } | |
} | |
object Foo2 { | |
val bar = { println("bar") } | |
} | |
// scala> Foo.bar | |
// bar |
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
fun all_answers func [] = SOME [] | |
fun all_answers func xs = let | |
fun loop [] = [] | |
| loop (h::tail) = case (func h) of | |
SOME x => x :: loop tail | |
| NONE => loop tail | |
in case loop xs of | |
[] => NONE | |
| lst => SOME lst | |
end |
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
#!/usr/bin/python | |
import os | |
import sys | |
import re | |
import subprocess | |
devnull = open(os.devnull, 'w') |
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
.DS_STORE |
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
import javax.swing.*; | |
import javax.swing.event.ListSelectionEvent; | |
import javax.swing.event.ListSelectionListener; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
public class Foo { | |
static final JFrame MainWindow = new JFrame(); | |
static final JPanel content = new JPanel(new BorderLayout()); | |
static final JLabel resultFromDialog = new JLabel("SomeText"); |
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
"FooO bar baZ bow".split(" ").filter(word => word.last >= 'a').map(_.reverse) |
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
trait Base { | |
protected def contribute : List[String] = List("Beginning") | |
val list = contribute.reverse | |
} | |
trait TrA extends Base { | |
override protected def contribute = "A" :: super.contribute | |
} | |
trait TrB extends TrA { |
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
object Main extends App { | |
println(isBalanced("(.)(.)".toList)) | |
def isBalanced(list: List[Char]) = { | |
@annotation.tailrec | |
def countBracets(string: List[Char], count: Int = 0): Int = { | |
string match { | |
case '('::tail => countBracets(tail, count+1) | |
case ')'::tail => countBracets(tail, count-1) |