Skip to content

Instantly share code, notes, and snippets.

@flashburns
flashburns / _triadicmemory.md
Last active January 16, 2025 22:36
A minimal triadicmemory example.

A minimal example of triadic memory, The original C is taken from here with minimal edits done to get it to compile.

To run this, download the 3 files and place them into the same directory. Then use chmod +x test.d to mark test.d as executable and then you can run it using the rdmd wrapper. If you don't want to use rdmd then just compile it doing something like dmd test.d triadicmemory.c

DMD version v2.109.1 was used on linux, C was compiled via "ImportC" (D's built in C compiler).


  • 2025-01-16: I did a direct one to one translation of triadicmemory.c to D, I have included it here as triadicmemory_port.d to use it over the original C implmentation replace line 6 import triadicmemory; with import triadicmemory_port; in test.d.
@flashburns
flashburns / _rwkv.cpp_D_bind.md
Last active January 15, 2025 18:49
D lang bindings for rwkv.cpp with a D native tokenizer.

The bind was written for rwkv.cpp at commit hash 96ce1d9b3cb57b9fbec071602bd603a61757d74b (2024-07-12) You can generate rwkv_vocab_tokens.json by downloading rwkv_vocab_v20230424.txt and running vocab_txt_to_json.py. If you don't want to deal with python, you can download and unpack rwkv_vocab_tokens.json.xz