Accepts input as a list of UTF-32 codepoints and returns a Number.
let isNewline: Number -> Boolean =
(x: Number) -> x == 10
let isDigit: Number -> Boolean =
(x: Number) -> (x >= 48) && (x < 58)| BITS 64 | |
| org 0x00010000 | |
| ehdr: | |
| db 0x7F, "ELF" | |
| db 2 ; 64 bits | |
| db 1 ; LE | |
| db 1 ; ELF v1 | |
| db 0 ; SysV |
| ???? ???? ???? 0000: | |
| [TODO: document special cases related to Xemnas] | |
| ???? ???? ??0? 0000: | |
| ???? ???? ??00 0000 iiii iiii iiii iiii iiii iiii iiii iiii: | |
| load immediate INT | |
| push to TP | |
| ???? ???? ??01 0000 ffff ffff ffff ffff ffff ffff ffff ffff: | |
| load immediate FLOAT | |
| push to TP | |
| iiii iiii ii1m 0000 oooo oooo oooo oooo: |
| // show Fluffy instances | |
| trait Fluffy[F[_]] { | |
| def furry[A, B](fa: F[A])(f: A => B): F[B] | |
| } | |
| // Exercise 1 | |
| // Relative Difficulty: 1 | |
| implicit def fluffyList: Fluffy[List] = new Fluffy[List] {} | |
| // Exercise 2 |
| // Author: Aly Cerruti | |
| // Please follow along in Scastie, so you can see the output of statements: | |
| // https://scastie.scala-lang.org/CLmK5tLuRd6rxXuEnba0rQ | |
| // A Category | |
| trait Category[ | |
| // A collection of objects | |
| Obj <: AnyKind, | |
| // A constraint on those objects (Scala lacks dependent typing, so i.e. `Val = [A] =>> Monoid[A]` makes the category of Monoids) | |
| Val[_ <: Obj], |
| import cats._, cats.data._, cats.syntax.all._ | |
| import scala.annotation.tailrec | |
| object Main2 { | |
| sealed trait Trace { | |
| def show: String | |
| } | |
| object Trace { | |
| implicit val showTrace: Show[Trace] = Show.show(_.show) |
| import cats._, cats.data._, cats.syntax.all._ | |
| import scala.annotation.tailrec | |
| object Main { | |
| case class Snapshot(comparisons: Int, exchanges: Int, tikz: String) | |
| def main(args: Array[String]): Unit = { | |
| val vector: Vector[Int] = Vector(55, 50, 10, 40, 80, 90, 60, 100, 70, 80, 20, 50, 22) | |
| val (snapshots, _, ()) = heapify[Int].runEmpty(vector).value |