eacasanovaspedre / flux.collections Goto Github PK
View Code? Open in Web Editor NEWSome functional collections and data structures
License: MIT License
Some functional collections and data structures
License: MIT License
Create a Set version of Hamt.
union
, intersect
and difference
functionsMaybe creating an Enumerator is more efficient. Benchmarking could prove it.
Sometimes it's better to see the Hamt data as a sequence of pairs instead of a sequence of KVEntries
The if conditions are wrong. children is never empty, since it's the array of children when the node is a Branch, it's never empty and I ask if it's empty.
I have to ask if the newBitmap
is empty instead.
The same happens for the elif condition. It's length is never 1. I must ask whether the newBitmap
contains only one bit on.
| Branch (bitmap, children) ->
let bitIndex = childBitIndex prefix
if containsChild bitIndex bitmap then
let childArrayIndex = childArrayIndex bitIndex bitmap
match remove eqComparer targetKey targetHash (nextLayerPrefix prefix) (Array.item childArrayIndex children)
with
| NotFound -> NotFound
| Removed child -> Removed(Branch(bitmap, Array.put child childArrayIndex children))
| NothingLeft ->
let newBitmap = Bitmap.clearBit bitIndex bitmap
if Array.isEmpty children then
NothingLeft
elif Array.length children = 1 then
Removed(Array.head children)
else
Removed(Branch(newBitmap, Array.remove childArrayIndex children))
else
NotFound
Functions to add:
Functions to optimize:
Potentially more functions
Evaluate ,using the Benchmarks, the possibility of storing a comparer, like the dotnet's Dictionary.
Sources:
https://source.dot.net/#q=System.collections.generic.Dictionary
https://youtu.be/cFrUeV9H7OM
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.