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
public interface Abstraction | |
{ | |
void Proc(); | |
} | |
public class Impl1 : Abstraction | |
{ | |
public void Proc() | |
{ | |
} |
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
var worker = new Worker(); | |
var anotherClass = new AnotherClass(); | |
worker.WorkDone += anotherClass.WorkDone; | |
worker.DoWork(); | |
class Worker | |
{ | |
public event Action WorkDone; | |
public void DoWork() |
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
var anotherClass = new AnotherClass(); | |
var worker = new Worker(anotherClass); | |
worker.DoWork(); | |
class Worker | |
{ | |
private readonly WorkListener _listener; | |
public Worker(WorkListener listener) | |
{ |
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 fib n | |
if n == 0 || n == 1 | |
n | |
else | |
fib(n-1) + fib(n-2) | |
end | |
end | |
40.times do |i| | |
puts "n=#{i} => #{fib 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
def fib(n): | |
if n == 0 or n == 1: | |
return n | |
else: | |
return fib(n-1) + fib(n-2) | |
for i in range(40): | |
print ("n=%d => %d" % (i, fib(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
static void Main() | |
{ | |
foreach (var i in Enumerable.Range(0, 39)) | |
Console.WriteLine("n={0} => {1}", i, fib(i)); | |
} | |
static int fib(int n) | |
{ | |
if (n == 0 || n == 1) | |
return n; |
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
%body | |
%ul | |
%li First | |
%li Second | |
=link_to "Second", simple_second_path |
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
factorial(0) -> 1; | |
factorial(N) when N > 0 -> | |
N * factorial(N-1). |
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
fib(0) -> 0; | |
fib(1) -> 1; | |
fib(N) -> fib(N - 1) + fib(N - 2). |
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
sort([]) -> []; | |
sort([H|T]) -> | |
sort([X || X <- T, X =< H]) ++ [H] ++ sort([X || X <- T, X > H]). |
OlderNewer