Giter VIP home page Giter VIP logo

ptmap's People

Contributors

andyli avatar backtracking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ptmap's Issues

Merge implementation

Out of curiosity, is there a reason that the merge implementation is as 2 folds as as opposed to the recursive one written in the original Okasaki paper?

The running time of the papers implementation is O(n_1 + n_2) whereas I believe that your version has an extra (albeit 'constant', log_32) cost for the lookup? My knowledge of SML is only based on my OCaml, so I might be missing something from the paper.

Thank you ahead of time!

Ptmap.bindings returns unordered list

According to the doc, bindings:

Return the list of all bindings of the given map. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

The following code prints the returned list, 4 2 6 1 5 3, which is unordered:

let list_to_map lst =
  let rec loop l map = match l with
  | [] -> map
  | item :: ls -> loop ls (Ptmap.add item true map)
  in
  loop lst Ptmap.empty

let test_bindings =
  let l, _ = List.split (Ptmap.bindings (list_to_map [3; 1; 2; 4; 6; 5])) in
  List.iter (Printf.printf "%d ") l

let main () =
  test_bindings

let () = main ()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.