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
trait Convert[A, B] { | |
def convert(a : A) : B | |
} | |
object Convert { | |
implicit def convertCharInt = new Convert[Char, Int] { | |
def convert(c: Char): Int = c.toInt | |
} | |
implicit def convertIntChar = new Convert[Int, Char] { |
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
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> trait A[X, Y] { | |
| def bar(y: Y): X | |
| def baz(x: X): Y | |
| } | |
defined trait A |
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
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, UndecidableInstances, FlexibleInstances, OverlappingInstances, FunctionalDependencies #-} | |
class Cast a b | a -> b where | |
to :: a -> b | |
data Point2 = Point2 Int Int | |
deriving (Show) | |
data Point3 = Point3 Int Int Int | |
instance Cast Point3 Point2 where |
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
for eachPattern in patternAr: | |
sim1 = 100.0 - abs(percentChange(eachPattern[0], patForRec[0])) | |
sim2 = 100.0 - abs(percentChange(eachPattern[1], patForRec[1])) | |
sim3 = 100.0 - abs(percentChange(eachPattern[2], patForRec[2])) | |
sim4 = 100.0 - abs(percentChange(eachPattern[3], patForRec[3])) | |
sim5 = 100.0 - abs(percentChange(eachPattern[4], patForRec[4])) | |
sim6 = 100.0 - abs(percentChange(eachPattern[5], patForRec[5])) | |
sim7 = 100.0 - abs(percentChange(eachPattern[6], patForRec[6])) | |
sim8 = 100.0 - abs(percentChange(eachPattern[7], patForRec[7])) | |
sim9 = 100.0 - abs(percentChange(eachPattern[8], patForRec[8])) |
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
object P { | |
trait X { type A } | |
object J extends X { type A = Int } | |
def foo[Y](x: X { type A = Y }): x.A = x match { case J => 1 } | |
foo(J) | |
} |
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
struct Renamer; | |
impl ast::Folder for Renamer { | |
fn fold_generics(&mut self, generics: Generics) -> Generics { /* your code here */ } | |
} | |
// use | |
Rename.fold_item(item) |
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
struct RString { | |
struct RBasic basic; | |
long len; | |
char *ptr; | |
union { | |
long capa; | |
VALUE shared; | |
} aux; | |
}; |
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
\<x : Banana (+) Jelly> -> \<pb : PeanutButter> -> | |
case x of | |
inl<banna> -> <banna, pb>; | |
inr<jelly> -> <jelly, pb>; | |
\<p: A (x) B> -> \<f: A -o C> -> \<g: B -o D> -> | |
case p of <a, b> -> <f<a>, g<b>> | |
\<x : (A -o B) (x) A> -> | |
case x of <f, b> -> f<b> |
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
DEBUG:rustc_typeck::check::compare_method: compare_impl_method: impl_bounds=GenericBounds([[Binder(TraitPredicate(TraitRef(T, kinds::Sized))), Binder(TraitPredicate(TraitRef(T, cmp::PartialOrd)))];[];[]]) | |
DEBUG:rustc_typeck::check::compare_method: compare_impl_method: trait_bounds=GenericBounds([[Binder(TraitPredicate(TraitRef(T, kinds::Sized))), Binder(TraitPredicate(TraitRef(T, cmp::PartialOrd)))];[];[]]) | |
DEBUG:rustc_typeck::check::compare_method: compare_impl_method: impl_fty=fn(&option::Option<T>, &option::Option<T>) -> bool | |
DEBUG:rustc_typeck::check::compare_method: compare_impl_method: trait_fty=fn(&option::Option<T>, &option::Option<T>) -> bool | |
DEBUG:rustc_typeck::check::compare_method: compare_impl_method(impl_trait_ref=TraitRef(option::Option<T>, cmp::PartialOrd)) | |
DEBUG:rustc_typeck::check::compare_method: impl_trait_ref (liberated) = TraitRef(option::Option<T>, cmp::PartialOrd) | |
DEBUG:rustc_typeck::check::compare_method: compare_impl_method: trait_to_skol_substs=Substs[types=[[option::Option<T>];[opt |
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
λ 169-231-106-204 rust → λ git generalize-impl-bounds* → make | |
cfg: build triple x86_64-apple-darwin | |
cfg: host triples x86_64-apple-darwin | |
cfg: target triples x86_64-apple-darwin | |
cfg: enabling more debugging (CFG_ENABLE_DEBUG) | |
cfg: host for x86_64-apple-darwin is x86_64 | |
cfg: os for x86_64-apple-darwin is apple-darwin | |
cfg: good valgrind for x86_64-apple-darwin is | |
cfg: using CC=clang (CFG_CC) | |
cfg: using CXX=clang++ (CFG_CXX) |