Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am jamesiry on github.
* I am jamesiry (https://keybase.io/jamesiry) on keybase.
* I have a public key ASCzYXJRrC57Eaxm3rISzYBEZr4bcZs3cJF4mDdrFAFg8Qo
To claim this, I am signing this object:
"A pointer to a structure object, suitably converted,
points to its initial member (or if that member is a
bit-field, then to the unit in which it resides),
and vice versa."
expands to
"A pointer to a structure object, suitably converted,
points to its initial member (or if that member is a
bit-field, then to the unit in which it resides), and
#include <stdio.h> /* it's just my preference */
int main(int argc, char *argv[])
{
int a, b;
scanf("%d%d", &a, &b);
int c = 0;
while(a!=0)
#include <stdio.h> /* it's just my preference */
int main(int argc, char *argv[])
{
int a, b, c, i;
scanf("%d%d", &a, &b);
c = 0;
while(a!=0)
import java.util.function.Function;
public class Sets {
public static<T> boolean contains(T elem, Function<T, Boolean> set) {
return set.apply(elem);
}
public static<T> Function<T, Boolean> emptySet() {
return (T t) -> false;

We are very happy to announce the RC1 release of Scala 2.10.2! If no serious blocking issues are found this will become the final 2.10.2 version.

The Scala team and contributors fixed 89 issues since 2.10.1!

In total, 164 RC1 pull requests were opened on GitHub, of which 134 were merged after having been tested and reviewed.

Known Issues

Before reporting a bug, please have a look at these known issues.

public abstract class Super {
public abstract String foo();
public Super() {
System.out.println(foo().length());
}
}
public class Test extends Super {
String bar = "hello";
@JamesIry
JamesIry / gist:5020779
Created February 23, 2013 18:27
Need help with an algorithm. Comments below
// see 'computeDetour' below
//
// Is it a well known algorithm? Where published? Likley to come from
// graph theory, graph data structures/algorithms, or compiler theory.
//
// Is there a better one that accomplishes the same job?
//
// If this one seems good, does it terminate for all finite inputs?
//
// Informally it seems to "accidentally" incorporate a variant of
scala> object Test {
|
| class Inv[T]
|
| def foo[S](interface: Inv[_ >: S], implementation: Inv[S]) {}
|
| def bar[R, T <: R](interface: Inv[R], impl: Inv[T]) {
| //foo[T](interface, impl)
| foo(interface, impl) // Compilation Error
| // Inv[R] <: Inv[_ >: S]
[info] Running org.example.Runner
[info] 0% Scenario{vm=java, trial=0, benchmark=currentFoldRight, length=0, threshold=3} 8.60 ns; ?=0.11 ns @ 10 trials
[info] 1% Scenario{vm=java, trial=0, benchmark=currentReverseFoldLeft, length=0, threshold=3} 11.64 ns; ?=0.02 ns @ 3 trials
[info] 1% Scenario{vm=java, trial=0, benchmark=foldRightAlternative, length=0, threshold=3} 10.59 ns; ?=0.12 ns @ 10 trials
[info] 2% Scenario{vm=java, trial=0, benchmark=currentFoldRight, length=1, threshold=3} 12.87 ns; ?=0.33 ns @ 10 trials
[info] 3% Scenario{vm=java, trial=0, benchmark=currentReverseFoldLeft, length=1, threshold=3} 19.29 ns; ?=0.07 ns @ 3 trials
[info] 3% Scenario{vm=java, trial=0, benchmark=foldRightAlternative, length=1, threshold=3} 16.51 ns; ?=0.05 ns @ 3 trials
[info] 4% Scenario{vm=java, trial=0, benchmark=currentFoldRight, length=2, threshold=3} 16.46 ns; ?=0.16 ns @ 3 trials
[info] 5% Scenario{vm=java, trial=0, benchmark=currentReverseFoldLeft, length=2, threshold=3} 27.19 ns; ?=0.02 ns @ 3 trials
[