This file contains 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 Factorial { | |
def fact(n: Int): Int = if(n == 0) 1 else n * fact(n - 1) | |
def main(args: Array[String]) = { | |
val n = if(args.length == 0) 1 else Integer.parseInt(args(0)) | |
1 to n foreach {i => println(i + "! = " + fact(i))} | |
} | |
} |
This file contains 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
public class Factorial { | |
static int fact(int n) { return n == 0 ? 1 : n * fact(n - 1); } | |
public static void main(String[] args) { | |
int n = args.length == 0 ? 1 : Integer.parseInt(args[0]); | |
for(int i = 1; i <= n; i++) System.out.println(i + "! = " + fact(i)); | |
} | |
} |
This file contains 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 Factorial2 { | |
def fact(n: Int): Int = (1 /: (1 to n)) (_ * _) | |
def main(args: Array[String]) = { | |
val n = if(args.length == 0) 1 else Integer.parseInt(args(0)) | |
1 to n foreach {i => println(i + "! = " + fact(i))} | |
} | |
} |
This file contains 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 java.awt.BorderLayout; | |
import javax.swing.JFrame; | |
import javax.swing.JTextArea; | |
import javax.swing.event.DocumentEvent; | |
import javax.swing.event.DocumentListener; | |
import javax.swing.text.DefaultCaret; | |
import javax.swing.SwingUtilities; | |
This file contains 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
var fs = require('fs'); | |
var sys = require('sys'); | |
var stream = fs.createReadStream('./sample.txt', { 'flags': 'r', | |
'encoding': 'UTF-8', | |
'bufferSize': 4 * 1024}); | |
var stream2 = fs.createReadStream('./sample2.txt', { 'flags': 'r', | |
'encoding': 'UTF-8', | |
'bufferSize': 4 * 1024}); |
This file contains 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
List(1,2,3,1).zip(List(1,1,1,1)).foldLeft(Map[Int,Int]()) { (x, y) => x.get(y._1) match { case Some(v) => x + Pair(y._1, (v + y._2)) case None => x + y }} |
This file contains 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
List(1,2,3,1).foldLeft(Map[Int,Int]()) { (x, y) => x.get(y) match { case Some(v) => x + Pair(y, (v + 1)) case None => x + Pair(y, 1) }} |
This file contains 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
Searching for subvertpy | |
Reading http://pypi.python.org/simple/subvertpy/ | |
Reading http://samba.org/~jelmer/subvertpy | |
Reading http://launchpad.net/subvertpy | |
Best match: subvertpy 0.8.10 | |
Downloading http://samba.org/~jelmer/subvertpy/subvertpy-0.8.10.tar.gz | |
Processing subvertpy-0.8.10.tar.gz | |
Running subvertpy-0.8.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-NDoICr/subvertpy-0.8.10/egg-dist-tmp-GLfV9D | |
Traceback (most recent call last): | |
File "/usr/bin/easy_install-2.7", line 10, in <module> |
This file contains 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
<target name="install-artifacts" depends="jars"> | |
<macrodef name="install"> | |
<attribute name="file" /> | |
<attribute name="pom" /> | |
<sequential> | |
<artifact:install file="@{file}" > | |
<pom refid="@{pom}"/> | |
</artifact:install> | |
</sequential> | |
</macrodef> |
This file contains 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
(ns mdsample.core | |
(:require [clojure.core.reducers :as r]) | |
(:import [java.security MessageDigest] | |
[javax.xml.bind DatatypeConverter] | |
[java.util Arrays])) | |
(def ^MessageDigest digester (MessageDigest/getInstance "MD5")) | |
(defn- hexdigest | |
[^String s] |
OlderNewer