foobar, foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud
LambdaConf has multiple tracks, so no attendee can possibly attend all sessions.
Yet, we'd like to schedule the sessions to maximize attendee happiness (for some definition of "maximum" and "happiness").
Sounds like a job for functional programming!
Your mission, should you choose to accept it, is to write a small functional program to produce an "optimal" schedule (your schedule may have any number of tracks you want -- you do not have to stick with 3 or 4).
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
use std::comm::{Receiver, channel}; | |
use std::io; | |
use std::mem::replace; | |
use std::task::spawn; | |
struct Future<'a, A> { | |
state: FutureState<'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
object Test { | |
import scalaz.{Lens,State} | |
case class BlahConfig(server: Int, l: List[Int]) | |
def doStuff(i: Int) = State[BlahConfig,Int]( c => (c.copy(l = i :: c.l), c.server) ) | |
case class FooConfig(val password: String) | |
def doSomeStuff(i: Int) = State[FooConfig, String](c =>(c, c.password)) | |
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
val n = 9 | |
val s = Math.sqrt(n).toInt | |
type Board = IndexedSeq[IndexedSeq[Int]] | |
def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match { | |
case (r, `n`) => Some(board) | |
case (r, c) if board(r)(c) > 0 => solve(board, cell + 1) | |
case (r, c) => | |
def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1) | |
val used = board.indices.flatMap(i => Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s))) |
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
target |
YouTube link: https://www.youtube.com/watch?v=z1uviQbKe0U
Your hosts: Josh Suereth, Dick Wall, Daniel Spiewak, Seth Tisue
Join us during and between episodes for web-based Scalawags chat on Gitter.
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 akka.http.scaladsl.model.HttpHeader | |
import akka.http.scaladsl.model.HttpMethods._ | |
import akka.http.scaladsl.model.HttpResponse | |
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Credentials` | |
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Methods` | |
import akka.http.scaladsl.model.headers.`Access-Control-Allow-Origin` | |
import akka.http.scaladsl.model.headers.Origin | |
import akka.http.scaladsl.server.Directive0 | |
import akka.http.scaladsl.server.Directives._ | |
import akka.http.scaladsl.server.MethodRejection |
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
1. Register for Microsoft account at https://signup.live.com/signup | |
2. Email verification - click link (logs you in) | |
3. Register on Azure Data Market at https://datamarket.azure.com/register | |
4. Go to: https://datamarket.azure.com/dataset/datagovuk/metofficeweatheropendata click 'Sign up' then 'agree', then 'sign up'. | |
Use Web i/f to download CSV: | |
At: https://datamarket.azure.com/dataset/explore/0f2cba12-e5cf-4c6d-83c9-83114d44387a click 'Explore', 'Three Hourly Forecast' and 'Download Excel (CSV)' | |
or by API: | |
Go to: https://datamarket.azure.com/account for account key |