March 25, 2021 9:48 AM, "Alexander Burger" wrote:
> PicoLisp has a really cool new function!
Test added and tested in LLVM 7, 11-13.
(mike)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
On Thu, Mar 25, 2021 at 10:40:21AM +0100, Alexander Burger wrote:
> 3. The tree is automatically balanced, independent of the insertion order.
This is only true if there are no final gaps in the keys.
What we can say, however, is that every item is placed at a depth which is the
2-logarithm of it
On Thu, Mar 25, 2021 at 01:06:58PM +0100, Tomas Hlavaty wrote:
> > And useless for the intended purpose. At least I see no way to insert and
> > look
> > up by number (?)
>
> because you always take the position in the binary heap as the key.
OK, so this won't work
: (enum 'E 999 "Test")
On Thu 25 Mar 2021 at 12:23, Alexander Burger wrote:
> On Thu, Mar 25, 2021 at 12:11:55PM +0100, Alexander Burger wrote:
>> Binary heaps are close, but not the same.
>
> And useless for the intended purpose. At least I see no way to insert and look
> up by number (?)
because you always take the p
On Thu, Mar 25, 2021 at 12:11:55PM +0100, Alexander Burger wrote:
> Binary heaps are close, but not the same.
And useless for the intended purpose. At least I see no way to insert and look
up by number (?)
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Hi Tomas,
> binary heap
Thanks!
Binary heaps are close, but not the same.
Pil's algorithm is a lot more efficient. Just bit test and shift, as opposed to
the swapping of nodes as described in https://en.wikipedia.org/wiki/Binary_heap
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?su
On Thu 25 Mar 2021 at 10:40, Alexander Burger wrote:
> Probably this algorithm exists already, because it is so simple and obvious.
> But
> I found it by myself and did not bother to search for it (mainly because I
> don't
> know what name to search for).
binary heap
--
UNSUBSCRIBE: mailto:pi
Hi Mike,
> Test added and tested in LLVM 7, 11-13.
Ah, yes, I forgot to add to unit tests.
Will add there too.
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Hi all,
PicoLisp has a really cool new function!
It is called 'enum', because it "enumerates" arbitrary Lisp values. That is, it
associates values with numbers, by storing them in a binary tree structure.
The cool points are:
1. The numeric keys themselves are not stored. They are implicit. Thi