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
#include <stdio.h> | |
/* | |
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th | |
* Bernoulli number. | |
*/ | |
int main(int argc, char* argv[]) | |
{ | |
// ------------------------------------------------------------------------ | |
// Data |
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
; CONNECT 4 by Darryl Sloan, 3 July 2017 | |
org 50000 | |
last_k equ 23560 | |
ld hl, udgs ; UDGs | |
ld (23675), hl ; set up UDG system variable | |
ld a, 2 ; upper screen | |
call 5633 ; open channel |
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
class NorvigSpellChecker(corpus: String, alphabet: Seq[Char] = 'a' to 'z', level: Int = 2) { | |
val words = s"[${alphabet.head}-${alphabet.last}]+".r.findAllIn(corpus.toLowerCase).toSeq | |
val count = words.groupBy(_.toSeq).mapValues(_.size) withDefaultValue 0 | |
def edit(n: Int)(word: Seq[Char]): Set[Seq[Char]] = n match { | |
case 0 => Set(word) | |
case 1 => | |
val splits = word.indices map word.splitAt | |
val deletes = splits collect {case (a, b0 +: b1) => a ++ b1} |
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
/** | |
* Created by Hugo Sereno Ferreira on 15/06/14. | |
*/ | |
import org.scalajs.dom | |
import scala.collection._ | |
import Page.renderer | |
sealed trait Opcode | |
object Mov extends Opcode { override def toString = "MOV" } |
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
/** | |
* Created by Hugo Sereno Ferreira on 15/06/14. | |
*/ | |
import org.scalajs.dom | |
import scala.collection._ | |
sealed trait Opcode | |
object Mov extends Opcode { override def toString = "MOV" } | |
object Add extends Opcode { override def toString = "ADD" } |
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.util.parsing.json.JSON | |
case class Widget(name: String, flavour: String) | |
case class Contract(vendor: String, colour: String, widgets: List[Widget]) | |
object Parser { | |
def parseContract(json: String): Option[Contract] = { | |
for { | |
AsMap(contract) <- JSON.parseFull(json) |