Skip to content

Instantly share code, notes, and snippets.

View yanok's full-sized avatar

Ilya Yanok yanok

  • Zurich, Switzerland
View GitHub Profile
class C<T> {}
T? f<T>(C<T> c) => null;
int? g(C<int?> c) => f(c);
abstract class A {
@override
bool operator ==(Object? other);
}
class B implements A {}
void test(dynamic x, dynamic y, dynamic z) {
print(x == y || x == z);
}
@yanok
yanok / main.dart
Last active December 5, 2022 11:43
abstract class A {
@override
bool operator ==(dynamic other);
}
class B implements A {}
void test(dynamic x, dynamic y, dynamic z) {
print(x == y || x == z);
}
@yanok
yanok / main.dart
Created July 20, 2022 17:17
swift-eucalyptus-0426
class A {
int f() => 1;
}
class B extends A {
int f();
}
void main() {
print(B().f());
#include <iostream>
#include <vector>
using namespace std;
class Psycos {
public:
Psycos(const vector<int> &a) : a(a) {};
int nextPeak(int i) {
/* return next peak on the right index or -1 if there is no more peaks */
Require Import ZArith.
Require Import List.
Require Import Program.Wf.
Import ListNotations.
(** Copied from https://github.com/tchajed/strong-induction *)
(** Here we prove the principle of strong induction, induction on the natural
numbers where the inductive hypothesis includes all smaller natural numbers. *)
-- InFor n -> for (g $ InFor f) $ \y -> for (runForFor (f $ ForFor $ \_ -> y) NotInFor) $ \x ->
-- _
data ForFor r t a where
For :: r (t a) -> (r a -> r (t b)) -> ForFor r t (t b)
Other :: r a -> ForFor r t a
unForFor :: Sqlam r t => ForFor r t a -> r a
unForFor (For m n) = for m n
module Main where
import System.Environment
import System.Exit
import Text.Parsec
main :: IO ()
main = do
args <- getArgs
case args of
data Val = VNum Double | VBool Bool
toNumber :: Val -> Double
toNumber (VNum x) = x
toNumber (VBool True) = 1
toNumber (VBool False) = 0
main :: IO ()
main = print $ (* (-1)) $ toNumber (VBool False)
module TraversableVec where
id : forall {k}{X : Set k} -> X -> X
id x = x
_o_ : forall {i j k}
{A : Set i}{B : A -> Set j}{C : (a : A) -> B a -> Set k} ->
(f : {a : A}(b : B a) -> C a b) ->
(g : (a : A) -> B a) ->
(a : A) -> C a (g a)