{"title":"在 miniKanren 中实现三除法的六种方法","authors":"Brett Schreiber, Brysen Pfingsten, Jason Hemann","doi":"arxiv-2408.16259","DOIUrl":null,"url":null,"abstract":"This paper explores options for implementing the relation $n \\equiv 0 \\\n(\\text{mod} \\ 3)$ within miniKanren using miniKanren numbers and its arithmetic\nsuite. We examine different approaches starting from straightforward\nimplementations to more optimized versions. The implementations discussed\ninclude brute-force arithmetic methods, divisibility tricks, and derivation\nfrom a finite automaton. Our contributions include an in-depth look at the\nprocess of implementing a miniKanren relation and observations on benchmarking\n\\texttt{defrel}s. This study aims to provide practical insights for miniKanren\nprogrammers on both performance and implementation techniques.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":"1 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-08-29","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Six Ways to Implement Divisibility by Three in miniKanren\",\"authors\":\"Brett Schreiber, Brysen Pfingsten, Jason Hemann\",\"doi\":\"arxiv-2408.16259\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"This paper explores options for implementing the relation $n \\\\equiv 0 \\\\\\n(\\\\text{mod} \\\\ 3)$ within miniKanren using miniKanren numbers and its arithmetic\\nsuite. We examine different approaches starting from straightforward\\nimplementations to more optimized versions. The implementations discussed\\ninclude brute-force arithmetic methods, divisibility tricks, and derivation\\nfrom a finite automaton. Our contributions include an in-depth look at the\\nprocess of implementing a miniKanren relation and observations on benchmarking\\n\\\\texttt{defrel}s. This study aims to provide practical insights for miniKanren\\nprogrammers on both performance and implementation techniques.\",\"PeriodicalId\":501197,\"journal\":{\"name\":\"arXiv - CS - Programming Languages\",\"volume\":\"1 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-08-29\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Programming Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2408.16259\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.16259","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Six Ways to Implement Divisibility by Three in miniKanren
This paper explores options for implementing the relation $n \equiv 0 \
(\text{mod} \ 3)$ within miniKanren using miniKanren numbers and its arithmetic
suite. We examine different approaches starting from straightforward
implementations to more optimized versions. The implementations discussed
include brute-force arithmetic methods, divisibility tricks, and derivation
from a finite automaton. Our contributions include an in-depth look at the
process of implementing a miniKanren relation and observations on benchmarking
\texttt{defrel}s. This study aims to provide practical insights for miniKanren
programmers on both performance and implementation techniques.