Example of how to use some with this
A Pen by Vlad Bezden on CodePen.
String.prototype.times = function(count) { | |
return count < 1 ? '' : new Array(count + 1).join(this); | |
}; |
public int FirstDivisor(int number) | |
{ | |
return Enumerable.Range(2, (int)Math.Sqrt(number)).FirstOrDefault(x => number % x == 0); | |
} |
private readonly BlockingCollection<int> _blockingQueue = new BlockingCollection<int>(); | |
void Main() | |
{ | |
var producer = Producer(); | |
var consumer = Consumer(); | |
Task.WaitAll(producer, consumer); | |
Console.WriteLine("Done"); |
private BufferBlock<int> queue = new BufferBlock<int>(); | |
void Main() | |
{ | |
var producers = Enumerable.Range(0, 10).Select(async x => | |
{ | |
await Producer(); | |
}); | |
var consumer = Consumer(); |
public int GCD(int first, int second) | |
{ | |
return second == 0 | |
? first | |
: GCD (second, first % second); | |
} |
let rec fibonacci n = | |
match n with | |
| 1 | 2 -> 1 | |
| _ -> fibonacci (n - 1) + fibonacci (n - 2) |
let factorial n = | |
[1..n] |> List.reduce (*) |
let rec factorial n = | |
match n with | |
| 0 | 1 -> 1 | |
| _ -> n * factorial(n - 1) |
Example of how to use some with this
A Pen by Vlad Bezden on CodePen.