Skip to content

Instantly share code, notes, and snippets.

test gist
def encodeModified(list: List[Symbol]) : List[Any] = {
list.foldRight(List[Any]()) {
(h, l) =>
if (l.isEmpty)
List(h)
else
l.head match {
case (x: Int, y) =>
if (y == h)
(x + 1, y) :: l.tail

Keybase proof

I hereby claim:

  • I am siejkowski on github.
  • I am siejkowski (https://keybase.io/siejkowski) on keybase.
  • I have a public key whose fingerprint is 8D26 591D 3FC0 E0FB 8E69 4DD3 5290 1436 EC39 7652

To claim this, I am signing this object:

// Optionable protocol exposes the subset of functionality required for flatten definition
protocol Optionable {
typealias Wrapped
var value: Wrapped? { get }
}
// extension for Optional provides the implementations for Optional enum
extension Optional : Optionable {
var value: Wrapped? { get { return self } }
import Foundation
func ==(lhs: Cell, rhs: Cell) -> Bool {
return lhs.hashValue == rhs.hashValue
}
struct Cell: Hashable {
let a: Int
let b: Int
@siejkowski
siejkowski / vc_hierarchy.swift
Last active June 6, 2016 08:36
play with vc hierarchy
import UIKit
protocol Action {}
struct ConcreteAction1 : Action {}
struct ConcreteAction2 : Action {}
enum ActionError : ErrorType {
the.exoplanets
let us = say(
hello.world(
to: the.beam, of: light,
so: delicate,
that: i.fear(), to: blink(), while: looking().at
)
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
function makeErrorResponse(message) {
return new Response(message, {
status: 404,
statusText: 'not found',
headers: {
'content-type': 'text/plain',