- An EON
- The brains of openpilot, contains an LeEco LE Pro 3 with firmware that allows it to run openpilot and the battery removed
- Should have a heat sink and fan on the rear
- May/May not have IR LEDs and IR Filter removed from the front facing camera.
- A connector
- The connector intercepts signals on CAN and feeds it to the harness box
- Connectors vary, even among the same manufacturer
- A harness box
This file contains 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 requests | |
# max_records is there so you can get back partial result sets, if you want. Useful for testing. | |
def get_all_course_data(max_records=None): | |
page_number = 1 | |
page_size = 100 | |
more_records_exist = True | |
all_courses = [] | |
while more_records_exist: |
More fold methods: cata
, cataM
, gcata
, gcataM
, hylo
, hyloM
, ghylo
,
ghyloM
, histo
, histoM
, ghisto
, ghistoM
, and more.
Easier to maintain; adding nodes means you just have to update your algebras and your functor instance. With the hand-written ones you’d have to update each of those methods, as well as your algebras.
If you want to mix together/extend the ADT, you can do so using a simple coproduct (like Either
)
This file contains 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
trait MathProvider[A] { | |
def plus(a: A, b: A): A | |
def minus(a: A, b: A): A | |
def divide(a: A, b: A): A | |
def multiply(a: A, b: A): A | |
} |
This file contains 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
Miss Bell | |
Lars Hupel | |
John DeGoes | |
Tony Morris | |
Emily Pilmore |
Following the precedence rules given previously, a BNF grammar for Perl-style regular expressions can be constructed as follows.
<RE> ::= <union> | <simple-RE>
<union> ::= <RE> "|" <simple-RE>
<simple-RE> ::= <concatenation> | <basic-RE>
<concatenation> ::= <simple-RE> <basic-RE>
<basic-RE> ::= <star> | <plus> | <elementary-RE>
<star> ::= <elementary-RE> "*"
::= "+"
This file contains 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 cats.implicits._ | |
import cats.{FlatMap, Monad, Applicative, Apply, Functor} | |
/** | |
* A concretion/simplification of StateT for logging. | |
*/ | |
class LoggerT[F[_], Ctx, A](val run: F[(Ctx, A)]) { | |
def value(implicit: F: Functor[F]): F[A] = run.map(_._2) | |
def context(implicit: F: Functor[F]): F[A] = run.map(_._1) | |
This file contains 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 scalaxb | |
import scala.xml.{Node, NodeSeq, NamespaceBinding, Elem, UnprefixedAttribute, PrefixedAttribute} | |
import javax.xml.datatype.{XMLGregorianCalendar} | |
import javax.xml.namespace.QName | |
import javax.xml.bind.DatatypeConverter | |
import scala.language.postfixOps | |
import scala.language.implicitConversions | |
import scala.language.existentials |
This file contains 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
case class Foo(a: Int, b: String, c: Bar) | |
case class Bar(x: Int, y: Baz) | |
case class Baz(z: String) | |
// Each case class can be generalized in to a product, where that product is just the parts of the case class | |
// Foo === Int :: String :: Bar :: HNil | |
// Bar === Int :: Baz :: HNil | |
// Baz === String :: HNil |
This file contains 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
case class IO[A](unsafePerformIO: () => A) { | |
def map[B](ab: A => B): IO[B] = IO(() => ab(unsafePerformIO())) | |
def flatMap[B](afb: A => IO[B]): IO[B] =IO(() => afb(unsafePerformIO()).unsafePerformIO()) | |
def tryIO(ta: Throwable => A): IO[A] = | |
val attempt = IO(() => IO.tryIO(unsafePerformIO()) // lift IO[A] to IO[Either[Throwable,A]] | |
attempt.unsafePerformIO() match { | |
case Left(t) => ta(t) | |
case Right(a) => a | |
}) | |
} |
NewerOlder