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 Ingester { | |
/** | |
* [2011-06-09 20:19:59,288] INFO PlaylistInputStream - guillermo.mackinnon listening to "(1984) Ride The Lightning/07 - Creeping Death.mp3" | |
* [2011-06-09 20:26:35,536] INFO PlaylistInputStream - guillermo.mackinnon listening to "(1984) Ride The Lightning/08 - The Call Of Ktulu.mp3" | |
*/ | |
val regxp="""\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}\] INFO PlaylistInputStream - (\S+) listening to \"(.+).mp3"""".r | |
val sample= """[2011-06-06 12:10:45,109] INFO PlaylistInputStream - alejandro.nieto listening to "Elephant [2003]/the white stripes - elephant - 01 - seven nation army.mp3"""" |
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 webtest | |
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; | |
import java.net._ | |
import scala.xml._ | |
import javax.xml.parsers.SAXParserFactory | |
import javax.xml.parsers.ParserConfigurationException; | |
import org.xml.sax.SAXNotRecognizedException; | |
import org.xml.sax.SAXNotSupportedException; | |
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl; |
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 Functor[T[_]]{ | |
def fmap[A,B](f:A=>B)(ta:T[A]):T[B] | |
} | |
trait Applicative[T[_]] extends Functor[T]{ | |
def pure[A](a:A):T[A] | |
def <*>[A,B](tf:T[A=>B])(ta:T[A]):T[B] | |
} | |
trait Monad[M[_]] extends Applicative[M]{ |
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 demo | |
class SafeUnsafe { | |
def unsafe[T](x: =>T):Option[T]= try { | |
Option(x) | |
} catch { | |
case _ => None | |
} |
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
(define add1 (let ((f +)) (lambda (x) (f x 1)))) | |
(define sub1 (let ((f -)) (lambda (x) (f x 1)))) | |
(define atom? (let ((f1 pair?) (f2 not)) (lambda (x) (f2 (f1 x))))) | |
(define sum1 ( lambda (x) (+ 1 x))) | |
(define sub1 ( lambda (x) (- x 1))) | |
(define plus ( lambda (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
import net.liftweb._ | |
import net.liftweb.common._ | |
import common.Full | |
import http._ | |
import util._ | |
import js._ | |
import JsCmds._ | |
import xml.NodeSeq | |
import collection.immutable.Map |
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 I= left _ | |
val D= right _ |
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
Theorem AE: forall k:U,A(k)->(exists x:U,A(x)). | |
Proof. | |
intros k Ha; exists k; apply Ha. | |
Qed. |
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
def unsafeCall[T](x: =>T):Option[T]= try { | |
Option(x) | |
} catch { | |
case _ => None | |
} |
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 java.io.BufferedReader; | |
import java.io.FileReader; | |
class NaiveTail{ | |
public static void main(String[] args) throws Exception{ | |
int size=new Integer(args[0]); | |
String[] circularBuffer=new String[size]; | |
int i=0; | |
BufferedReader in=new BufferedReader(new FileReader(args[1])); | |
String line; |