Giter VIP home page Giter VIP logo

mlpractice's Introduction

MLPractice

Serious of interesting types and functions for operating on trees and lists

We have,

intPartitionSort

  • Quicksort for List of ints.

partitionSort

  • Polymorphic Quicksort (give < operator for compares of argument type) (> operator will cause this to return Decending array).

tree

  • Polymorphic Tree (leaves contain list, nodes contain list of multiple trees, so not just a binary tree with 2 leaves)

sortTree

  • Quicksort for Polymorphic Trees. Builds on items 2 and 3, and returns a tree with all the leaves lists now sorted with given < operator.

merge

  • polymorphic merge that takes 2 lists and will append both lists into one depending on your given < operator. This is much like what is happening in the last step of a mergesort

appendTree

  • Polymorphic Tree Append that takes polyTree and appends all lists from the leaves and returns a single list with all lists appended together.

mergeTree

  • Polymorphic Tree Merge takes a polyTree and sorts + merges all the the leaves lists to return one single sorted list.

To test, start sml repl and run.

--> use "MLFunctions.ml";

--> use "TestData.ml";

--> intPartitionSort TestListInt;

--> partitionSort (op <) [1, 9,3, 6, 7];

--> partitionSort (op <) TestListInt;

--> partitionSort (op <) TestListReal;

--> partitionSort (fun(a,b) => length a < length b) TestListListInt;

--> sortTree (op <) sortTreeTestTree;

--> merge (op <) MergeLessList1 MergeLessList2;

--> merge (fn (a, b) => a > b) MergeGreaterList1 MergeGreaterList2;

--> appendTree myTree;

--> mergeTree (op <) myTree;

mlpractice's People

Contributors

keeyon2 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.