In Defense of Linked Lists
rfleury.com3 ポイント投稿者 sullyj30 コメント
(fn add-1 [x] (+ x 1))
(lambda add-2 [x] (+ x 2))
transpiles to the following lua: local function add_1(x)
return (x + 1)
end
local function add_2(x)
_G.assert((nil ~= x), "Missing argument x on /home/sullyj3/tmp/fn-vs-lambda/fnl/x.fnl:3")
return (x + 2)
end
return add_2 (*) <$> [1..10] <*> [2,3,5]
-- or
liftA2 (*) [1..10] [2,3,5]
Admittedly also not accessible to non-haskellers. But on the other hand, if you're going to learn a language, you ought to learn its idioms at some point. { pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# ...
You can reuse it in your flake.nix devShells.${system}.default = import ./shell.nix { inherit pkgs; };
And it will use the locked nixpkgs input defined in your flake. You can run it with the new `nix develop` command, but `nix-shell` will continue to work, giving you the previous behaviour.