This file contains hidden or 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
async void AcquireFromCamera(object sender, RoutedEventArgs e) | |
{ | |
try | |
{ | |
var imageStream = await _cameraCapture.Shoot(); | |
var dto = new Dto(){ImageStream = imageStream}; | |
_handler.ImageCaptured(dto); | |
Frame.Navigate(typeof(EditDataPage), dto.Id); | |
} | |
catch (Exception ex) |
This file contains hidden or 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
async void AcquireFromCamera(object sender, RoutedEventArgs e) | |
{ | |
try | |
{ | |
var imageStream = await _cameraCapture.Shoot(); | |
var dto = new Dto(){ImageStream = imageStream}; | |
dto.Id = Guid.NewGuid().ToString(); | |
var file = await _fileHndlr.CreateFileAsync(dto.Id); | |
dto.ImageFilePath = file.Path; | |
_fileOperator.StoreStream(dto.ImageStream, file); |
This file contains hidden or 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.Net | |
open System.IO | |
let date = "2012-08-28" | |
let getDataAsync (url:string) = async{ | |
let r = WebRequest.Create(url) | |
let! resp = r.AsyncGetResponse() | |
use stream = resp.GetResponseStream() | |
use reader = new StreamReader(stream) | |
let data = reader.ReadToEnd() | |
return data} |
This file contains hidden or 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 mulVectors v1 v2 = List.fold2(fun s x y -> s + x * y) 0 v1 v2 | |
let mulMatr m1 m2 = | |
let rec mulMatr'' m1 m2 m3 = | |
let rec mulMatr' m1 m2 v = | |
match m1, m2 with | |
| h1::t1, h2::t2 -> mulMatr' t1 m2 ((mulVectors h1 h2)::v) | |
| [], _ -> List.rev v | |
| _ -> failwith "error in format" | |
match m1, m2 with | |
| h1::t1, h2::t2 -> let v = mulMatr' m1 m2 [] |
This file contains hidden or 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 fibonacci = | |
seq{yield 0 | |
yield 1 | |
yield 1 | |
let rec fibo a b = | |
seq{yield (a + b) | |
yield! fibo b (a+b)} | |
yield! fibo 1 1 } |
This file contains hidden or 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 rec buildAppend (lst:int list) num = | |
if lst.Length < 30000 then | |
buildAppend (lst @ [num]) num | |
else | |
lst | |
let rec buildCons (lst:int list) num = | |
if lst.Length < 30000 then | |
buildCons (num::lst) num |
This file contains hidden or 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
//Challenge https://groups.google.com/group/functional-programming-sthlm/browse_thread/thread/647165dc2d923529?hl=sv | |
// The record type Part | |
type Part = { | |
Heading : string; | |
Text : string; | |
IsColumnLayout : bool; | |
} | |
// Make some test data | |
let r = { Heading="Wide part"; Text="This is a wide part"; IsColumnLayout=false } |
This file contains hidden or 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
function A(){ | |
promises1 = new Array(); | |
promises2 = new Array(); | |
for (var i = start; i < end; i++) | |
{ | |
B(someUri); | |
} | |
await(); | |
} |
This file contains hidden or 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 rec sum list = | |
match list with | |
| [] -> 0; | |
| h::t -> h + sum t |
This file contains hidden or 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 luhn (inp:string) = | |
let algo (s:string) = | |
Regex.Replace(s, "[^0-9]", "").ToCharArray() | |
|> Array.rev | |
|> Seq.map(int << string) | |
|> Seq.fold (fun (fldr,weight) num -> fldr + (num * weight) / 10 + (num * weight) % 10, weight % 2 + 1) (0,2) | |
|> fst | |
match inp with | |
| "" -> 0 | |
| _ -> 10 - (algo inp) % 10 |