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
open System.Collections.Generic | |
type StackComprehensionsBuilder() = | |
member this.Yield x = new Stack<_>([x]) | |
member this.YieldFrom (s : 'a seq) = new Stack<_>(s) | |
//s2 : unit -> Stack<_> — из-за Delay | |
member this.Combine(s1 : Stack<_>, s2 : unit -> Stack<_>) = | |
let s2' = s2().ToArray() |> Array.rev | |
for elem in s2' do |
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
open System | |
open System.Collections.Generic | |
type Light = | |
| Green | |
| Yellow | |
| Red | |
//order operations for Light | |
let dictOfOps = |
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
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.WriteLine("Hello world!"); | |
} | |
} |
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
// Кватернионы — это гиперкомплексные числа, предложенные Гамильтоном в 1843 году. | |
// Кватернионы с операциями на них образуют алгебраическую структуру, называемую "телом" или "кольцом с делением" (division ring) ℍ. | |
// Такие алгебраические структуры отличаются от привычных нам полей (например, поля действительных чисел ℝ) тем, | |
// что умножение в них некоммутативно, т.е. для кватернионов справедливо a * b =/= b * a. | |
// Кватернионы очень удобны для записи вращений в трёхмерном пространстве, поэтому они нашли широкое применение в механике, | |
// 3D-графике и компьютерном зрении. | |
// В этом упражнении вы должны будете создать тип, представляющий кватернионы. | |
// Этот тип будет размеченным объединением, т.к. мы можем по-разному определить кватернионы. |
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
scala> def implicitExists[A](implicit i: A = null) = i != null | |
implicitExists: [A](implicit i: A)Boolean | |
scala> trait Constructable[+A] { def get: A } | |
defined trait Constructable | |
scala> case class Page() | |
defined class Page | |
scala> implicitExists[Constructable[Page]] |
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
#!/bin/bash | |
sudo apt-get install build-essential automake checkinstall intltool git | |
sudo apt-get install mono-complete mono-addins-utils gtk-sharp2 gnome-sharp2 | |
git clone git://github.com/mono/monodevelop | |
cd monodevelop | |
git checkout monodevelop-4.0 | |
git submodule update --init --recursive | |
./configure |
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
let hyperfactorial k = | |
[k .. -1 .. 1] | |
|> Seq.map (fun x -> Seq.init x (fun _ -> x)) | |
|> Seq.fold (fun acc ss -> acc * (Seq.reduce (*) ss)) 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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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 PureRandomGenerator { | |
def next: (PureRandomGenerator, Int) | |
} | |
object PureRandomGenerator { | |
def init(seed: Long): PureRandomGenerator = new PureRandomGenerator { | |
def next = { | |
val (newSeed, random) = getNewSeedAndRandom(seed) // here we generate a new seed | |
(init(newSeed), random) | |
} |
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
package pages.fa_pages | |
import org.openqa.selenium.WebDriver | |
import expert_elements._ | |
import queries._ | |
import org.scalatest.selenium.WebBrowser | |
import org.scalatest._ | |
import common._ | |
import pages.ExpertPage | |
import pages.pages_constants._ |
OlderNewer