diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-08-08 17:31:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 17:31:54 +0200 |
| commit | df447c718d6659e8d01603ce895296c62e1bab1d (patch) | |
| tree | aa6a89ed14383650751c70cfa487f97281b2f55d | |
| parent | 5bc15d9d25aef49bf474bd56a13746a91e2ccd34 (diff) | |
| download | perlweeklychallenge-club-df447c718d6659e8d01603ce895296c62e1bab1d.tar.gz perlweeklychallenge-club-df447c718d6659e8d01603ce895296c62e1bab1d.tar.bz2 perlweeklychallenge-club-df447c718d6659e8d01603ce895296c62e1bab1d.zip | |
Create 333_p2.fs
| -rw-r--r-- | challenge-333/hvukman/f#/333_p2.fs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-333/hvukman/f#/333_p2.fs b/challenge-333/hvukman/f#/333_p2.fs new file mode 100644 index 0000000000..1b6209313d --- /dev/null +++ b/challenge-333/hvukman/f#/333_p2.fs @@ -0,0 +1,18 @@ +// 333 part 2 + +let input_1 = [| 1;0; 2; 3; 0; 4; 5; 0 |] +let input_2 = [| 1; 2; 3 |] +let input_3 = [| 1; 2; 3; 0 |] +let input_4 = [| 0; 0; 0; 0 |] +let input_5 = [| 1; 2; 0; 3; 4 |] +let inputs_2 = [ input_1; input_2; input_3; input_4; input_5 ] + +// if 0 double else x; then truncuate to length of x +let dup (x:int array) = Array.collect (fun x -> match x with + |0 -> [|0;0|] + |_ -> [|x|] ) x |> Array.take (Array.length x) + +for i in (inputs_2) do + for j in dup(i) do + printf "%i " j + printf "%s\n" "" |
