Just to clarify. Yes, the parent/child relationships are purely based on 
the indices of the nodes. It's not a conventional vector reference based 
binary tree. I was surprised when I came up with the idea that such did not 
even exist. Just to explain, it's a non-rectilinear array mapping. There is 
rows, and a root, and each row is double the size of the one above it. The 
name BAST comes from Bifurcation Array Search Tree. As far as I know it is 
the only non-linear/non-grid based ever invented. By me of course, so of 
course I am proud of it.

The coordinates stored in Cursor do not have any meaning except in a 
specific instance of the BAST array at a specific moment. I haven't worked 
out any strategies for multiple readers of the array, but I imagine it 
would just take a blocking table based on sections of the array, such as 4k 
pages or so, while the write process is changing it. Probably even, it's 
not possible to partially block read access for concurrency at all because 
many times write operations will stomp all over the tree in a random way 
because that's how hashes tend to be... random... Besides this, the atomic 
write operations generally won't block read access for long periods of time 
anyway. 

If I have piqued your curiosity, go check out the repo 
here: https://github.com/calibrae-project/bast - To sum it up in short 
words, it aims at eliminating retrieval latency caused by nonlinear seeking 
on memory devices. It has applicability to database lookup tables and 
should perform also quite well even on spinning disk cached stores (if they 
are allocated in one giant 2-4Gb blob).

Sorry for the self-promotion but it was relevant in that I was working on 
how to tidy up the readability of my code and needed multiple returns and 
simple untyped tuples were really not nearly as convenient as using a type 
struct. After doing a bunch of work on getting parametric polymorphism 
implemented in go, which is only obliquely relevant, I wrote a Gist about 
it: https://gist.github.com/l0k1verloren/469a4e467a2789daa04de60449af11cc 
No idea why nobody has written such a simple explanation and example of how 
to do it. You will spend 2 minutes on that and understand that actually, 
yes, you can do multiple inheritance in Go quite easily once you understand 
interface{} and parametric polymorphism is the simplest case.

On Thursday, 19 April 2018 08:31:01 UTC+3, Jan Mercl wrote:
>
> On Thu, Apr 19, 2018 at 6:57 AM Louki Sumirniy <louki.sumir...@gmail.com 
> <javascript:>> wrote:
>
>>
>> func (b *Bast) Parent(c Cursor) Cursor {
>> if c.Index == 0 {
>> c.Err = errors.New("No parent from the root")
>> return c
>> }
>> c.Row--
>> c.Index = c.Index>>1 - (c.Index+1)%2
>> c.Err = nil
>> return c
>> }
>>
>
> This method looks like it should be defined be on *Cursor receiver, not 
> *Bast.
>
> -- 
>
> -j
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to