flake.lock: use jupyenv

This commit is contained in:
Dmitriy Pleshevskiy 2023-05-11 14:03:33 +03:00
parent 89f95d011e
commit 7bb5f5d546
Signed by: pleshevskiy
GPG Key ID: 79C4487B44403985
8 changed files with 519 additions and 130 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.jupyter

View File

@ -3,16 +3,15 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1631705391, "lastModified": 1673956053,
"narHash": "sha256-PzP6vikNJZiS7yANC6sZWQlIDf4E2MTckvAsJxwV0DQ=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "teto", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "8e15c6e3c0f15d0687a2ab6ae92cc7fab896bfed", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "teto", "owner": "edolstra",
"ref": "support-packages",
"repo": "flake-compat", "repo": "flake-compat",
"type": "github" "type": "github"
} }
@ -20,11 +19,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1627913399, "lastModified": 1673956053,
"narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -49,13 +48,32 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": { "flake-compat_4": {
"flake": false,
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1673956053,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -66,11 +84,11 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1631561581, "lastModified": 1667395993,
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -110,6 +128,28 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_2": {
"inputs": {
"nixpkgs": [
"jupyenv",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hls": { "hls": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
@ -134,43 +174,101 @@
}, },
"ihaskell": { "ihaskell": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": [
"flake-utils": "flake-utils_2", "jupyenv",
"flake-compat"
],
"flake-utils": [
"jupyenv",
"flake-utils"
],
"hls": "hls", "hls": "hls",
"nixpkgs": "nixpkgs_2" "nixpkgs": [
"jupyenv",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1661486016, "lastModified": 1671426600,
"narHash": "sha256-Ch9dQ82fLV0QuyrJ+J1tVxxrSLSA+NIdiikvV0+Hvrs=", "narHash": "sha256-MahAFyp6AxY0H61U6zqJXM1NsckNNkK6iqONEtOPSK0=",
"owner": "gibiansky", "owner": "ihaskell",
"repo": "IHaskell", "repo": "ihaskell",
"rev": "53f8e0773822ddf2cd392309ba27c8ff8e30202e", "rev": "1c22a874ac0c8ed019229f4a0cd5a0bfda017357",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "gibiansky", "owner": "ihaskell",
"repo": "IHaskell", "repo": "ihaskell",
"type": "github" "type": "github"
} }
}, },
"jupyterWith": { "jupyenv": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"ihaskell": "ihaskell", "ihaskell": "ihaskell",
"nixpkgs": "nixpkgs_3" "nix-dart": "nix-dart",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable",
"npmlock2nix": "npmlock2nix",
"opam-nix": "opam-nix",
"poetry2nix": "poetry2nix",
"pre-commit-hooks": "pre-commit-hooks_2",
"rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1661799532, "lastModified": 1679071568,
"narHash": "sha256-E2YL6Ycf59HWglKjSUV09bV8f15lEBGKLs6ahndmqaM=", "narHash": "sha256-3LAo9uXGTmfS4OsiiIuoxX9knEshziCyI1MxR40VKeU=",
"owner": "tweag", "owner": "tweag",
"repo": "jupyterWith", "repo": "jupyenv",
"rev": "0b7f2e843f023c89283daf53eabce322efc9ca7c", "rev": "3ad2c9512c9efd586cf63adde454e734a8ce049c",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "tweag", "owner": "tweag",
"repo": "jupyterWith", "repo": "jupyenv",
"type": "github"
}
},
"mirage-opam-overlays": {
"flake": false,
"locked": {
"lastModified": 1661959605,
"narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=",
"owner": "dune-universe",
"repo": "mirage-opam-overlays",
"rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b",
"type": "github"
},
"original": {
"owner": "dune-universe",
"repo": "mirage-opam-overlays",
"type": "github"
}
},
"nix-dart": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"pub2nix": "pub2nix"
},
"locked": {
"lastModified": 1673740150,
"narHash": "sha256-JiZrr75JILHW7IaNW3MwpYn+084Q6/gnXScPR7Pozhs=",
"owner": "djacu",
"repo": "nix-dart",
"rev": "8ee4e1a5ec0cc6c1e15860c4733f741485e8231e",
"type": "github"
},
"original": {
"owner": "djacu",
"repo": "nix-dart",
"type": "github" "type": "github"
} }
}, },
@ -190,17 +288,49 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1634515797, "lastModified": 1672580127,
"narHash": "sha256-elgCUC2khtBkOSpE4gDymNvthTZAI4hGI2iNu3YEUkA=", "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1673800717,
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5f0194220f2402b06f7f79bba6351895facb5acb", "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1673796341,
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -208,44 +338,160 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1659446231, "lastModified": 1683408522,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "release-21.11", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "npmlock2nix": {
"flake": false,
"locked": { "locked": {
"lastModified": 1662096612, "lastModified": 1668989938,
"narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=", "narHash": "sha256-/IxdS0AiqSN0/VEOLnnfHyi4nP17yPrkhGf6KlXVwrc=",
"owner": "NixOS", "owner": "nix-community",
"repo": "nixpkgs", "repo": "npmlock2nix",
"rev": "21de2b973f9fee595a7a1ac4693efff791245c34", "rev": "0ba0746d62974403daf717cded3f24c617622bc7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "nix-community",
"type": "indirect" "repo": "npmlock2nix",
"rev": "0ba0746d62974403daf717cded3f24c617622bc7",
"type": "github"
}
},
"opam-nix": {
"inputs": {
"flake-compat": [
"jupyenv",
"flake-compat"
],
"flake-utils": [
"jupyenv",
"flake-utils"
],
"mirage-opam-overlays": "mirage-opam-overlays",
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"opam-overlays": "opam-overlays",
"opam-repository": "opam-repository",
"opam2json": "opam2json"
},
"locked": {
"lastModified": 1669990974,
"narHash": "sha256-wHhdlDUC/tBDVFBemeJPpqdIRdehKKbxbdMP0QjOhM4=",
"owner": "tweag",
"repo": "opam-nix",
"rev": "75199758e1954f78286e7e79c0e3916e28b732b0",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "opam-nix",
"rev": "75199758e1954f78286e7e79c0e3916e28b732b0",
"type": "github"
}
},
"opam-overlays": {
"flake": false,
"locked": {
"lastModified": 1654162756,
"narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=",
"owner": "dune-universe",
"repo": "opam-overlays",
"rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4",
"type": "github"
},
"original": {
"owner": "dune-universe",
"repo": "opam-overlays",
"type": "github"
}
},
"opam-repository": {
"flake": false,
"locked": {
"lastModified": 1661161626,
"narHash": "sha256-J3P+mXLwE2oEKTlMnx8sYRxwD/uNGSKM0AkAB7BNTxA=",
"owner": "ocaml",
"repo": "opam-repository",
"rev": "54e69ff0949a3aaec0d5e3d67898bb7f279ab09f",
"type": "github"
},
"original": {
"owner": "ocaml",
"repo": "opam-repository",
"type": "github"
}
},
"opam2json": {
"inputs": {
"nixpkgs": [
"jupyenv",
"opam-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1665671715,
"narHash": "sha256-7f75C6fIkiLzfkwLpJxlQIKf+YORGsXGV8Dr2LDDi+A=",
"owner": "tweag",
"repo": "opam2json",
"rev": "32fa2dcd993a27f9e75ee46fb8b78a7cd5d05113",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "opam2json",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1673926875,
"narHash": "sha256-QOsT76Al0Igpo0u5vtQJuDSOxrocX3sTD523pLPEklc=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "a5c454a834cd290dd4d33102ab8b4aa37d850e65",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
} }
}, },
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"jupyterWith", "jupyenv",
"ihaskell", "ihaskell",
"hls", "hls",
"flake-utils" "flake-utils"
], ],
"nixpkgs": [ "nixpkgs": [
"jupyterWith", "jupyenv",
"ihaskell", "ihaskell",
"hls", "hls",
"nixpkgs" "nixpkgs"
@ -265,25 +511,95 @@
"type": "github" "type": "github"
} }
}, },
"root": { "pre-commit-hooks_2": {
"inputs": { "inputs": {
"jupyterWith": "jupyterWith", "flake-compat": "flake-compat_4",
"nixpkgs": "nixpkgs_4", "flake-utils": [
"utils": "utils" "jupyenv",
} "flake-utils"
}, ],
"utils": { "gitignore": "gitignore_2",
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1674075316,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-0uZuAcYBpNJLxr7n5O0vhwn3rSLpUTm9M5WGgmNQ+wM=",
"owner": "numtide", "owner": "cachix",
"repo": "flake-utils", "repo": "pre-commit-hooks.nix",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "3e42a77571cc0463efa470dbcffa063977a521ab",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "cachix",
"repo": "flake-utils", "repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pub2nix": {
"flake": false,
"locked": {
"lastModified": 1594192744,
"narHash": "sha256-pDvcXSG1Mh2BpwkqAcNDJzcupV3pIAAtZJLfkiHMAz4=",
"owner": "paulyoung",
"repo": "pub2nix",
"rev": "0c7ecca590fcd1616db8c6468f799ffef36c85e9",
"type": "github"
},
"original": {
"owner": "paulyoung",
"repo": "pub2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"jupyenv": "jupyenv",
"nixpkgs": "nixpkgs_3"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1674008920,
"narHash": "sha256-ugwPxKjvmJ5GpzN/MHg8tuhe8nYi3SbJm5nWNy7CB0Q=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "eecc44934a0f6c02c02856b38bd3b6af3bec0870",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github" "type": "github"
} }
} }

View File

@ -1,36 +1,40 @@
{ {
inputs = { nixConfig.extra-substituters = [
jupyterWith.url = "github:tweag/jupyterWith"; "https://tweag-jupyter.cachix.org"
utils.url = "github:numtide/flake-utils"; ];
}; nixConfig.extra-trusted-public-keys = [
"tweag-jupyter.cachix.org-1:UtNH4Zs6hVUFpFBTLaA4ejYavPo5EFFqgd7G7FxGW9g="
];
outputs = { self, nixpkgs, jupyterWith, utils }: inputs.flake-compat.url = "github:edolstra/flake-compat";
utils.lib.eachDefaultSystem (system: inputs.flake-compat.flake = false;
let inputs.flake-utils.url = "github:numtide/flake-utils";
pkgs = import nixpkgs { inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inherit system; inputs.jupyenv.url = "github:tweag/jupyenv";
overlays = builtins.attrValues jupyterWith.overlays;
};
iHaskell = pkgs.kernels.iHaskellWith { outputs =
name = "haskell"; { flake-utils
packages = p: [ ]; , jupyenv
}; , ...
} @ inputs:
iNix = pkgs.kernels.iNixKernel { flake-utils.lib.eachSystem
name = "nix"; [
}; flake-utils.lib.system.x86_64-linux
]
jupyterLab = pkgs.jupyterlabWith { (
kernels = [ iHaskell iNix ]; system:
}; let
inherit (jupyenv.lib.${system}) mkJupyterlabNew;
in jupyterlab = mkJupyterlabNew ({ ... }: {
{ nixpkgs = inputs.nixpkgs;
apps.default = { imports = [ (import ./kernels.nix) ];
type = "app"; });
program = "${jupyterLab}/bin/jupyter-lab"; in
}; {
devShell = jupyterLab.env; packages = { inherit jupyterlab; };
}); packages.default = jupyterlab;
apps.default.program = "${jupyterlab}/bin/jupyter-lab";
apps.default.type = "app";
}
);
} }

6
kernels.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs, ... }: {
kernel.haskell."Haskell".enable = true;
kernel.nix."Nix".enable = true;
kernel.rust."Rust".enable = true;
kernel.typescript."Typescript".enable = true;
}

View File

@ -1,3 +1,6 @@
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. # Problem
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get
3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000. Find the sum of all the multiples of 3 or 5 below 1000.

View File

@ -2,9 +2,11 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 9,
"id": "f6a5bb29-6834-41a0-a929-8e035675eb9d", "id": "f6a5bb29-6834-41a0-a929-8e035675eb9d",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"predict x = x `rem` 3 == 0 || x `rem` 5 == 0" "predict x = x `rem` 3 == 0 || x `rem` 5 == 0"
@ -14,7 +16,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "3ce07c68-c750-4d39-b593-dcdb6e22fade", "id": "3ce07c68-c750-4d39-b593-dcdb6e22fade",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"filtered = filter predict [1..999]" "filtered = filter predict [1..999]"
@ -24,7 +28,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "52551454-c27c-4ac7-8967-02d9f1704fc8", "id": "52551454-c27c-4ac7-8967-02d9f1704fc8",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -37,14 +43,28 @@
} }
], ],
"source": [ "source": [
"-- filtered" "filtered"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "1437aa9e-c83a-4bbb-a5c3-be4415f8b3f2", "id": "311e677a-7185-4718-a839-ace350ecb502",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [],
"source": [
"main = sum filtered"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1fa76786-d8fa-4a63-9cd6-d4b4ec50634a",
"metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -57,13 +77,13 @@
} }
], ],
"source": [ "source": [
"sum filtered" "main"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "311e677a-7185-4718-a839-ace350ecb502", "id": "938bb0bd-7227-4770-bcd5-3d595c9a8868",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -71,12 +91,12 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Haskell - haskell", "display_name": "haskell-Haskell kernel",
"language": "haskell", "language": "haskell",
"name": "ihaskell_haskell" "name": "haskell-haskell"
}, },
"language_info": { "language_info": {
"codemirror_mode": "ihaskell", "codemirror_mode": "Haskell",
"file_extension": ".hs", "file_extension": ".hs",
"mimetype": "text/x-haskell", "mimetype": "text/x-haskell",
"name": "haskell", "name": "haskell",

View File

@ -4,14 +4,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "bff727d0-70bf-42cf-a12c-ee5823037315", "id": "bff727d0-70bf-42cf-a12c-ee5823037315",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
":l <nixpkgs>\n", ":l <nixpkgs>\n",
"Added 17051 variables.\u001b[0m\n", "Added 18073 variables.\u001b[0m\n",
"\n" "\n"
] ]
} }
@ -32,7 +34,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "8773113c-494f-45d8-a8c1-4f1ac8b60266", "id": "8773113c-494f-45d8-a8c1-4f1ac8b60266",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -59,7 +63,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "25c08a9f-b2ef-451a-9791-f0fd75cf6f00", "id": "25c08a9f-b2ef-451a-9791-f0fd75cf6f00",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -76,9 +82,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 4,
"id": "754560b4-01c3-401c-a9ab-14fe56a9a80c", "id": "754560b4-01c3-401c-a9ab-14fe56a9a80c",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -95,9 +103,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 5,
"id": "1bbc464a-bedc-4742-ae1d-d06039df53f5", "id": "1bbc464a-bedc-4742-ae1d-d06039df53f5",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -114,9 +124,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 6,
"id": "5a08e129-b2fe-43b5-a22f-bb6a0e69adb6", "id": "5a08e129-b2fe-43b5-a22f-bb6a0e69adb6",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -133,30 +145,53 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 8,
"id": "1dcaf52d-5526-4755-9454-d79238b9454f", "id": "1dcaf52d-5526-4755-9454-d79238b9454f",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"sum filtered\n", "main = sum filtered\n",
"\n"
]
}
],
"source": [
"main = sum filtered"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "49a4669c-047f-4b14-9d9a-a0d9feb4bef9",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"main\n",
"\u001b[36;1m233168\u001b[0m\n", "\u001b[36;1m233168\u001b[0m\n",
"\n" "\n"
] ]
} }
], ],
"source": [ "source": [
"sum filtered" "main"
] ]
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Nix - nix", "display_name": "nix-Nix kernel",
"language": "Nix", "language": "Nix",
"name": "inix_nix" "name": "nix-nix"
}, },
"language_info": { "language_info": {
"file_extension": ".nix", "file_extension": ".nix",

View File

@ -1,5 +1,9 @@
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # Problem
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms.