These are chat archives for ramda/ramda
const getFrameIndexFromName = (frameName) => R.findIndex(R.propEq("wallpos", frameName), FDWD.Frames); const result2 = getFrameIndexFromName("someName");
hey! I understand that there's no out-of-the-box function like
splitEvery which outputs arrays even when the input array has less element than the argument provided to
splitEvery(5, ). I need to get
Hello functional aficionados. I make regular use of the following to functions to perform insert or update operations on collections:
const ifFoundElse = (predicate, onFound, onNotFound) => R.ifElse( R.find(predicate), R.map(R.when(predicate, onFound)), onNotFound ) const mergeOrAppend = (predicate, object) => ifFoundElse(predicate, R.merge(R.__, object), R.append(object))
This works pretty well and I've naively used this maintain an ordered collection by performing a resort after every
mergeOrAppend. I can't help thinking that this approach could be vastly improved both in terms of elegance and performance by making use of the knowledge that the collection is sorted and being able to do some sort of 'insert at' rather than an append followed by a sort.
I'm struggling to find the right tools for the job in the ramda toolbox. Can someone point me in the right direction?
insertIntoSortedor something and use that instead of