Skip to content

Instantly share code, notes, and snippets.

View naosense's full-sized avatar
🏠
嘟嘟嘟

哇呜哇呜呀咦耶 naosense

🏠
嘟嘟嘟
View GitHub Profile
@naosense
naosense / ParserCombinator.scala
Last active January 1, 2023 08:33
parser combinator in rust
package playground
import scala.util.{Failure, Success, Try}
object ParserCombinator {
def theLetterA(input: String): Try[(String, Unit)] = {
input.toList match {
case first :: rest if first == 'a' => Success((rest.mkString, ()))
case _ => Failure(ParseError(input))
<!DOCTYPE html>
<html lang='en-US'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' href='https://pingao777.github.io/github-gazer/assets/css/style.css?v=83f9436b2e1b1a48c5227dc3037dbc5f1a9b5db1'>
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Let the world witness the history of your repository | github-gazer</title>
<meta name='generator' content='Jekyll v3.7.3.1'/>
@naosense
naosense / Java泛型.md
Last active November 12, 2017 13:20
关于泛型的一点总结

泛型的使用主要有两种:泛型类和泛型方法

泛型类

public class GeneralClass<T> {
...
}

Substitution Principle