[Beowulf] A quick ML investigation

Jonathan Engwall engwalljonathanthereal at gmail.com
Thu May 6 02:11:02 UTC 2021


More exciting (if ML is your thing) news:
when I reinstituted the call for mem x,
let rec mem x = function
    Leaf -> false
   | Node (_, y, left, right) ->
      x = y || (x < y && mem x left) || (x > y && mem x right)
  ;;
emptied the tree, re-loaded the 5,000 or so of 10,000 unsorted numbers I
got this:
# mem 7178 s;;
- : bool = true
# mem 285 s;;
- : bool = true
# mem 6009 s;;
- : bool = true
# mem 6008 s;;
- : bool = false

6008 is in the chopped out section of the original 10,000. OCaml reads this
list of int's in the blink of an eye; the entire list!
Jonathan Engwall

On Tue, May 4, 2021 at 12:53 PM Jonathan Engwall <
engwalljonathanthereal at gmail.com> wrote:

> Hello Beowulf,
> After this brief OCaml video https://youtu.be/a3kVJKt9mq4 I created a
> larger data set one with 5,000 of 10,000 numbers sequenced randomly. It
> illuminates the workings of RED BLACK binary tree.
>
> Simply copy&paste (ctrl k ctrl v) the large set to the command line. OCaml
> immediately builds several BLACK root nodes searching for a "balance point."
> I give a link to the RED BLACK implementation and larger data set. My
> source receives credit as well.
>
> Earlier experience with simple routines like fibonacci have me worried
> that OCaml is slow, RED BLACK's all short branches look quite fast.
>
> Jonathan Engwall
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://beowulf.org/pipermail/beowulf/attachments/20210505/e8769901/attachment.htm>


More information about the Beowulf mailing list