on master help sign in
join
commit803fb83b16965d98c48db6cd998f1121f910d619 authoriko <mail@iko.soy> dateThu 22 Aug 2024, 01:16 (2 years ago) parent5ce9186
4 files changed+78−9
nock/flake.lock+54−1 nock/flake.nix+11−8 nock/src/jets.rs+12 nock/src/lib.rs+1
nock/flake.lock+54−1
@@ -1,5 +1,24 @@
11{
22 "nodes": {
3+ "fenix": {
4+ "inputs": {
5+ "nixpkgs": "nixpkgs",
6+ "rust-analyzer-src": "rust-analyzer-src"
7+ },
8+ "locked": {
9+ "lastModified": 1724221791,
10+ "narHash": "sha256-mKX67QPnUybOopVph/LhOV1G/H4EvPxDIfSmbufrVdA=",
11+ "owner": "nix-community",
12+ "repo": "fenix",
13+ "rev": "e88b38a5a3834e039d413a88f8150a75ef6453ef",
14+ "type": "github"
15+ },
16+ "original": {
17+ "owner": "nix-community",
18+ "repo": "fenix",
19+ "type": "github"
20+ }
21+ },
322 "flake-utils": {
423 "inputs": {
524 "systems": "systems"
@@ -18,6 +37,22 @@
1837 }
1938 },
2039 "nixpkgs": {
40+ "locked": {
41+ "lastModified": 1723991338,
42+ "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=",
43+ "owner": "nixos",
44+ "repo": "nixpkgs",
45+ "rev": "8a3354191c0d7144db9756a74755672387b702ba",
46+ "type": "github"
47+ },
48+ "original": {
49+ "owner": "nixos",
50+ "ref": "nixos-unstable",
51+ "repo": "nixpkgs",
52+ "type": "github"
53+ }
54+ },
55+ "nixpkgs_2": {
2156 "locked": {
2257 "lastModified": 1723637854,
2358 "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=",
@@ -34,8 +69,26 @@
3469 },
3570 "root": {
3671 "inputs": {
72+ "fenix": "fenix",
3773 "flake-utils": "flake-utils",
38− "nixpkgs": "nixpkgs"
74+ "nixpkgs": "nixpkgs_2"
75+ }
76+ },
77+ "rust-analyzer-src": {
78+ "flake": false,
79+ "locked": {
80+ "lastModified": 1724153119,
81+ "narHash": "sha256-WxpvDJDttkINkXmUA/W5o11lwLPYhATAgu0QUAacZ2g=",
82+ "owner": "rust-lang",
83+ "repo": "rust-analyzer",
84+ "rev": "3723e5910c14f0ffbd13de474b8a8fcc74db04ce",
85+ "type": "github"
86+ },
87+ "original": {
88+ "owner": "rust-lang",
89+ "ref": "nightly",
90+ "repo": "rust-analyzer",
91+ "type": "github"
3992 }
4093 },
4194 "systems": {
nock/flake.nix+11−8
@@ -2,23 +2,26 @@
22 inputs = {
33 nixpkgs.url = "nixpkgs/nixos-unstable";
44 flake-utils.url = "flake-utils";
5+ fenix.url = "github:nix-community/fenix";
56 };
67
7− outputs = { self, flake-utils, nixpkgs }:
8+ outputs = { self, flake-utils, nixpkgs, fenix }:
89 let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
910 in flake-utils.lib.eachSystem supportedSystems (system:
1011 let pkgs = import nixpkgs { inherit system; };
1112 in {
13+ inherit fenix;
1214 devShells.default = pkgs.mkShell {
1315 # CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER =
1416 # "lld"; # LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
15− buildInputs = with pkgs; [
16− wasm-pack
17− rustc
18− wasm-tools
19− cargo
20− llvmPackages.bintools
21− ];
17+ buildInputs = with pkgs;
18+ with fenix.packages.${system}.latest; [
19+ wasm-pack
20+ rustc
21+ wasm-tools
22+ cargo
23+ llvmPackages.bintools
24+ ];
2225 };
2326 });
2427}
nock/src/jets.rs+12
@@ -36,6 +36,7 @@ pub fn generate_jets() -> Jets {
3636 (215071416104742929357520800152622002342, FLOP),
3737 (127000845647123308421702512578230020206, GULF),
3838 (224124632134128248273067864092142254001, INTO),
39+ (22365719601138689598430859488399820563, JOIN),
3940 ])
4041}
4142
@@ -272,3 +273,14 @@ static INTO: Jet = |_ctx, n| {
272273 ),
273274 }
274275};
276+
277+static JOIN: Jet = |_ctx, n| {
278+ let (sep, list) = n.as_cell().unwrap();
279+ Noun::list_refs(
280+ list.list_iter()
281+ .intersperse(sep)
282+ .collect::<Vec<_>>()
283+ .iter()
284+ .map(|x| x.clone()),
285+ )
286+};
nock/src/lib.rs+1
@@ -1,3 +1,4 @@
1+#![feature(iter_intersperse)]
12pub mod interpreter;
23mod jets;
34pub mod noun;