Skip to content

Instantly share code, notes, and snippets.

def fact(n : Int):Int = n match
{
case 1 => 1
case _ => n * fact(n-1)
}
def fact_tail(n:Int, holder:Int):Int = n match
{
case 1 => holder
case _ => fact_tail(n-1, n*holder)
}
def fib(n : Int):Int = n match
{
case 0 => 0
case 1 => 1
case _ => fib(n-1) + fib(n-2)
}
def fib_tail(n: Int, a: Int = 1, b: Int = 1):Int = n match
{
case 0 => 0
case 1 | 2 => b
case _ => fib_tail(n - 1, b, (a + b))
}
// Legacy
abstract class Lannister {
def payTheirDebts: Boolean
def trueLannister = payTheirDebts
}
//Father
trait Tywin extends Lannister{
override def payTheirDebts = true
}
// Legacy
abstract class Lannister {
def payTheirDebts: Boolean
def trueLannister = payTheirDebts
}
//Father
trait Tywin extends Lannister{
override def payTheirDebts = true
def debt: Int
// Legacy
abstract class Lannister {
def payTheirDebts: Boolean
def trueLannister = payTheirDebts
def debt: Int
def addToDebt(amount: Int): Int
}
//Father
trait Tywin extends Lannister{
@Saheb
Saheb / resume.json
Last active February 19, 2022 12:31
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Saheb Motiani",
"label": "loves debugging Distributed Systems; enjoys Functional Programming.",
"image": "",
"phone": "",
"url": "",
"summary": "I care about software performance, robustness, and resiliency. \n\nI crave mysteries, love investigations, and am always hunting for weird issues in systems around me. \n\nMost of my professional experience has been in developing product-based application-level software, but I am also interested in low-level system programming, networks, databases, operating-systems, and developer tools.",
"location": {