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 scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
case class fourData(a: Int, b: Int, c: Int, d: Int) | |
val computeListInputs: List[Int] = List(1,2,3,4) | |
def slowBlockingComputation(input: Int)(implicit ec: ExecutionContext): Future[Int] = { |
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 code | |
import eu.timepit.refined._ | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.auto._ | |
import eu.timepit.refined.numeric._ | |
import scala.annotation.tailrec | |
object RefinedQueens extends App { |
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 code | |
import eu.timepit.refined._ | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.auto._ | |
import eu.timepit.refined.numeric._ | |
import scala.annotation.tailrec | |
object Utils1 { |
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 code | |
import eu.timepit.refined._ | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.auto._ | |
import eu.timepit.refined.numeric._ | |
import scala.annotation.tailrec | |
object KnightTourSolver extends App { |
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
def fibi2(n: int) -> int: | |
"""Fibonacci numbers with iteration and memoization | |
>>> fibi2(20) | |
6765 | |
>>> fibi2(1) | |
1 | |
""" | |
# originally, line 109 had None (replace with Int as 0) f = [0, 1] + [None for _ in range(2, n+1)] | |
f = [0, 1] + [0 for _ in range(2, n+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
#!/bin/python3 | |
from typing import * | |
from pymonad import curry | |
class Square(NamedTuple): | |
""" | |
represents a chessboard square indexed by row and col(short column), using 0-based indexing | |
""" |
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 com.fantasy.seed | |
import cats.{Apply, Functor, FunctorFilter, Invariant, Semigroupal} | |
import cats.implicits._ | |
import monix.reactive._ | |
trait Collector[F[_]] extends Apply[F] with FunctorFilter[F] { | |
def map[A, B, Z](fa: F[A], fb: F[B], f: Function1[(A, B), Z])(implicit inv: Invariant[F], | |
semi: Semigroupal[F]): F[Z] = |