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 fpmax | |
import scala.util.Try | |
import scala.io.StdIn.readLine | |
object App0 { | |
def main: Unit = { | |
println("What is your name?") | |
val name = readLine() |
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
# | |
# On macOS ARM64, compile using: | |
# | |
# $ arch -x86_64 clang main.s | |
# | |
# Run with: | |
# | |
# $ ./a.out | |
# | |
# Inspect exit code: |
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
let x = 32; in (let x = 10; in x) + x |
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
.globl main | |
main: | |
movq $10, %rax | |
addq $32, %rax | |
retq |
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 parity(p): | |
return sum( | |
1 | |
for (x, px) in enumerate(p) | |
for (y, py) in enumerate(p) | |
if x < y and px > py | |
) % 2 == 0 | |
print(parity([1,2,3])) | |
print(parity([1,2,3,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
/- | |
Following along with the Logical Foundations book, available at | |
https://softwarefoundations.cis.upenn.edu/lf-current/Basics.html | |
-/ | |
inductive Day : Type := | |
| monday | |
| tuesday | |
| wednesday | |
| thursday |
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 kotlin.sequences.* | |
fun main() { | |
val i = iterator { | |
for (i in 1..10) { | |
yield(i) | |
} | |
yield(99) | |
} | |
for (a in i) { |
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
// https://github.com/namin/unsound/blob/master/Unsound9.java | |
class Unsound9<U,T> { | |
static class Type<A> { | |
class Constraint<B extends A> extends Type<B> {} | |
<B> Constraint<? super B> bad() { return null; } | |
<B> A coerce(B b) { | |
return pair(this.<B>bad(), b).value; | |
} | |
} | |
static class DependentSum<T> { |
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
// https://github.com/namin/unsound/blob/master/unsound.scala | |
object unsound { | |
trait LowerBound[T] { | |
type M >: T; | |
} | |
trait UpperBound[U] { | |
type M <: U; | |
} | |
def coerce[T,U](t : T) : U = { | |
def upcast(ub : LowerBound[T], t : T) : ub.M = t |
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
{ pkgs ? import <nixpkgs> {} }: | |
(pkgs.buildFHSUserEnv { | |
name = "python-fhs-shell"; | |
targetPkgs = pkgs: (with pkgs; [ | |
(python3.withPackages(pp: [pp.pip])) | |
# python39Packages.pip | |
# python39Packages.virtualenv | |
#cudaPackages.cudatoolkit_11 | |
]); | |
runScript = "bash"; |
NewerOlder