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
| /** Primitive parser combinators. | |
| * Input is a stream of tokens of any kind you wish. | |
| */ | |
| trait Prim[Token] { | |
| /** A parser is a function that takes a token stream as parameter and returns some parsed result, | |
| * the number of consumed tokens and the remaining input. | |
| */ | |
| trait Parser[+T] extends (Stream[Token] => (Result[T], Int, Stream[Token])) { |
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 main | |
| func fact(i int) int { | |
| var aux func(int, int) int | |
| aux = func(k int, acc int) int { | |
| if(k == 0) { | |
| return acc | |
| } else { | |
| return aux(k - 1, k * acc) | |
| } |
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
| /** Mixin this trait if you want the following strategy for matcher: | |
| * all matching branches are executed in the order they appear in the pattern matching block */ | |
| trait AllMatcher { | |
| sealed trait Maybe[+T] { | |
| def map[U](f: T => U): Maybe[U] | |
| def flatMap[U](f: T => Maybe[U]): Maybe[U] | |
| def orElse[U >: T](u: =>Maybe[U]): Maybe[U] | |
| def getOrElse[U >: T](u: =>U): U | |
| } |
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 scala.annotation.tailrec | |
| class Patience[T] { | |
| /** An occurrence of a value associated to its index */ | |
| type Occurrence = (T, Int) | |
| /** Returns occurrences that appear only once in the list, associated with their index */ | |
| private def uniques(l: List[T]): List[Occurrence] = { | |
| @tailrec |
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
| scala> import gnieh.sohva.conflict._ | |
| import gnieh.sohva.conflict._ | |
| scala> import net.liftweb.json.{parse, render, pretty} | |
| import net.liftweb.json.{parse, render, pretty} | |
| scala> val json1 = parse("""{ | |
| | "lbl1": true, | |
| | "lbl2": [1, 2, 3], | |
| | "lbl3": {"lbl": 23} |
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
| \documentclass[a4paper]{article} | |
| \begin{document} | |
| \input{truie} % doesn't work | |
| \include{truie} % works | |
| \end{document} |
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 gnieh.tex | |
| import scala.language.higherKinds | |
| /** A generic monadic interface. By implementing this trait, one can use | |
| * this data together in for-comprehensions | |
| * | |
| * @author Lucas Satabin | |
| */ | |
| trait Monadic[+T, M[+T] <: Monadic[T, 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 gnieh.test | |
| import com.typesafe.config._ | |
| import java.io.File | |
| import java.net.{ | |
| URLClassLoader, | |
| URL | |
| } |
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 dispatcher | |
| import akka.actor._ | |
| import scala.collection.mutable.{ | |
| Map, | |
| Set | |
| } | |
| final case class Join(username: String, resourceid: String) |
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
| /* | |
| * This file is part of the \BlueLaTeX project. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
OlderNewer