I hereby claim:
- I am changlinli on github.
- I am changlin (https://keybase.io/changlin) on keybase.
- I have a public key ASB9KiJFew02npmIG7PEjmYgrjs6sw8VjSsssVrhTL2QBQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="generator" content="pandoc"> <meta name="author" content="Changlin Li ([email protected])"> <title>Emily Dickinson: Slant Rhyme and Sound Change</title> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> <style> html, body, .reveal div, .reveal span, .reveal applet, .reveal object, .reveal iframe, .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6, .reveal p, .reveal blockquote, .reveal pre, .reveal a, .reveal abbr, .reveal acronym, .reveal address, .reveal big, .reveal cite, .reveal code, .reveal del, .reveal dfn, .reveal em, .reveal img, .reveal ins, .reveal kbd, .reveal q, .reveal s, .reveal samp, .reveal small, .reveal strike, .reveal strong, .reveal sub, .reveal sup, .reveal tt, .reveal var, .reveal b, .reveal u, .re |
/** | |
* This is a bare-bones implementation of some parser combinators to implement | |
* a simple Lisp-like parser. | |
* | |
* Note that I call it Lisp-like because I haven't yet defined any macro special | |
* forms in the AST. | |
* | |
* I also use unrestricted recursion here which will eventually blow the stack | |
* for sufficiently nested s-expressions. I could use trampolines instead to | |
* trade stack for heap and avoid a stack overflow. |
package com.changlinli | |
import cats.effect.{IO, Sync} | |
import cats.free.Free | |
import cats.implicits._ | |
import cats.~> | |
import scala.language.higherKinds | |
/* |
object Example { | |
import fs2._ | |
import fs2.async.mutable._ | |
import cats._ | |
import cats.data._ | |
import cats.implicits._ | |
/** | |
* This exists only because cats-effect keeps the trait expressing the | |
* Concurrent instance of Kleisli package private, otherwise we could just |
object StandardUnit { | |
type PersonId = Int | |
final class Person(id: PersonId, name: String) | |
object Person { | |
def lookupName(id: PersonId): Option[String] = ??? | |
def lookupBlacklistStatus(id: PersonId): Option[Unit] = ??? |
Hello |
def group_by_n(line, n): | |
if line == "": | |
return [] | |
elif line[0] == " ": | |
return [" "] + group_by_n(line[1:], n) | |
else: | |
return [line[:n]] + group_by_n(line[n:], n) | |
with open("post.txt") as fp: | |
final_string = "" |