Hi. I'm Yoshihiro. I was born and raised on a small farm and am essentially a farmer by nature, though I study mathematics and algorithms as a hobby. The field I'm particularly engrossed in at present is p-adic theory. After reading this recently discussed https://arxiv.org/pdf/2504.17033, I felt it had a strong affinity with the mathematics that interests me, so I wrote a https://dev.to/p_pumulo/building-an-ultra-metric-tree-in-clojure-from-radix-filters-to-p-adic-distance-2k1e post about it.
@p-himik Thank you.
Just got to reading the article. Why are the distances in this code block different?
;; Find the 3 nearest neighbors to the key "app".
;; The search is highly optimized and prunes large parts of the tree.
(umt/um-k-nearest populated-tree "app" 3)
;; => [;; [value original-key distance]
;; [{:category "verb"} "apply" 0.0000152587890625]
;; [{:category "fruit", :color "red"} "apple" 0.0000152587890625]
;; [{:category "software"} "application" 5.9604644775390625E-8]
;; ]
I tried reproducing it and on my end the distances are all the same:
user=> (p-adic-distance "app" "application")
5.960464477539063E-8
user=> (p-adic-distance "app" "apple")
5.960464477539063E-8
user=> (p-adic-distance "app" "apply")
5.960464477539063E-8Thanks for the heads-up. That was just a simple copy-paste error. It's better to round the numbers to highlight the difference. In a non-Archimedean setting, the speed of digit propagation is key, which is why rounding plays such a vital role.
Nice! Consider also sharing it in #news-and-articles.