I hereby claim:
- I am tkellogg on github.
- I am kellogh (https://keybase.io/kellogh) on keybase.
- I have a public key whose fingerprint is 402D 2BD0 DEF8 57ED DFAA A221 A1B1 2838 7802 BD5E
To claim this, I am signing this object:
implicit class BecauseFsharp[T](obj: T) { | |
/** | |
* This comes from OCaml/F#; very handy when used with partial function | |
* application. It's mainly useful for reducing parenthesis nesting. | |
* | |
* `foo(bar)` is same as `bar |> foo` | |
*/ | |
@inline def |>[U](function: T => U): U = function(obj) | |
} |
I hereby claim:
To claim this, I am signing this object:
module Test.Main where | |
import Debug.Trace | |
import Data.Char | |
import Data.String | |
parse [] = [] | |
-- Error: unexpected "'" | |
parse ('h':cs) = cs | |
parse (c:cs) = c:c:cs |
A couple open source .NET projects have need for a headache-free storage option. [Jump-Location][1] is a command line tool that currently uses flat files to store information about what directories a user has visited. Flat files were great at first, but we need more. Also, PSReadLine is also running into similar problems.
This will most likely wrap an existing storage engine to take care of the administrative tasks. We'll have to choose a storage engine that meets some basic requirements.
The objectives of CBOR, roughly in decreasing order of importance, are:
def mergeFields(vs1: List[JField], vs2: List[JField]): List[JField] = { | |
def mergeRec(xleft: List[JField], yleft: List[JField]): List[JField] = xleft match { | |
case Nil => yleft | |
case (xn, xv) :: xs => yleft find (_._1 == xn) match { | |
case Some(y @ (yn, yv)) => | |
JField(xn, merge(xv, yv)) :: mergeRec(xs, yleft filterNot (_ == y)) | |
case None => JField(xn, xv) :: mergeRec(xs, yleft) | |
} | |
} |
~> scala | |
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> class Foo { lazy val bar = 2 } | |
defined class Foo | |
scala> :javap Foo | |
Size 831 bytes |
#!/usr/local/bin/oil | |
# Re-create the current branch on top of "master" after pulling latest. | |
# | |
# Normal usage: | |
# git rebranch | |
# | |
# On a branch other than master: | |
# git rebranch prod-master | |
# | |
# Alternately, configure a default branch in the local repository: |
import re | |
# Remove leading and trailing text, leaving just the JSON | |
_JSON_TRIM_PATTERN = re.compile( | |
r"^" # Start of string | |
r"[^{\[]*" # Drop everything up to { or [ | |
r"([{\[].*[}\]])" # Keep the JSON | |
# Greedy match here should force it to not consume JSON | |
r"[^}\]]*" # Drop everything after } or ] | |
r"$", # End of string |