Skip to content

Instantly share code, notes, and snippets.

View DDR0's full-sized avatar
🦇
Making Stuff

David Roberts DDR0

🦇
Making Stuff
View GitHub Profile
@BalmungSan
BalmungSan / Polymorphism.md
Last active January 7, 2024 18:41
Polymorphism in Scala.

Polymorphism in Scala.

This document aims to show and compare three alternatives for achieving polymorphism in Scala.

  • Subtyping, common in object-oriented languages like Java.
  • Duck typing, common in dynamically typed languages like Python.
  • Typeclasses, common in functional languages like Haskell.

Additionally, when implementing the typeclass pattern in Scala,

@DDR0
DDR0 / plotsweeper.py
Created January 15, 2012 03:06
Minesweeper with the outside ring known.
#MineSweeper variant #10841
#For Python 3
import random, os
## {{{ http://code.activestate.com/recipes/134892/ (r2)
class _Getch:
"""Gets a single character from standard input. Does not echo to the
screen."""
def __init__(self):
try: