From 274cd1f74760365e26cf4c322679dd43f81f4947 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 27 Feb 2024 12:24:35 +0300 Subject: [PATCH] Some changes --- flake.nix | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index 14af6c7..d4af84a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,24 @@ { - outputs = { self }: { + outputs = { self }: let + firstChar = builtins.substring 0 1; + dropFirstChar = string: builtins.substring 1 (builtins.stringLength string) string; + + lastChar = string: builtins.substring (builtins.stringLength string - 1) 1 string; + dropLastChar = string: builtins.substring 0 (builtins.stringLength string - 1) string; + + getType = item: item._type or null; + escape = s: s; # TODO - __findFile = _: name: if builtins.substring 0 1 name == "." then { + domListToString = _: escape "TODO"; + in { + + __findFile = _: name: if firstChar name == "." then { _type = "end"; - _name = builtins.substring 1 (builtins.stringLength name) name; - } else if builtins.substring (builtins.stringLength name - 1) 1 name == "." then { + _name = dropFirstChar name; + } else if lastChar name == "." then { _type = "lone"; - _name = builtins.substring 0 (builtins.stringLength name - 1) name; + _name = dropLastChar name; } else { _type = "start"; _name = name; @@ -15,10 +26,10 @@ _accum = []; __functor = let impl = this: next: if - next._type or null == "end" && + getType next == "end" && next._name == this._name then - this._accum + domListToString this else this // { _accum = this._accum ++ [ next ]; __functor = impl;