Add '30.nix'

This commit is contained in:
NaiJi ✨ 2022-04-25 02:04:41 +00:00
parent 0d15d19af0
commit 95260715e6
1 changed files with 10 additions and 0 deletions

10
30.nix Normal file
View File

@ -0,0 +1,10 @@
with import <nixpkgs> { };
let
listOfNumbers = [2 4 6 9 27];
myMap = f: l: lib.fold (x: y: [(f x)] ++ y) [] l;
in
rec {
#your map should create the same result as the standard map function
example = map (x: builtins.div x 2) listOfNumbers;
result = myMap (x: builtins.div x 2) listOfNumbers;
}