These are chat archives for ramda/ramda

4th
Jan 2019
Daniel Lugo
@danlugo92
Jan 04 13:15
Has anyone thought of making a ramda fork with persistent data structures?
Why not make the built in functions with pds?
I once made a toy nn with ramda and the garbage trashing simply made it not viable
Lewis
@6ewis
Jan 04 13:52
hi all
["number", "name", "expiry", "cvc"].reduce((acc,next) => {acc[next] = R.pathOr("", [next], payment); return acc }, {})
can you ramdaMize it? (I just created a new word. @copyright)
Rob Yoder
@robyoder
Jan 04 16:55
@6ewis Like this?
R.reduce(
    (acc, next) => R.assoc(next, R.propOr("", next, payment), acc),
    {},
    ["number", "name", "expiry", "cvc"]
)
Rob Yoder
@robyoder
Jan 04 17:02
@danlugo92 I probably don't even know enough to ask this question, but I'm curious what you mean. Ramda preserves immutability of parameters, so I assume you mean something else.
Daniel Lugo
@danlugo92
Jan 04 17:51
Immutability with Persistent Data Structures works the same as deep-cloning at the API level, but behind the scenes it doesn't actually duplicate everything in memory, so, for example, an array with an added element instead of occupying an amount of memory given by: previous array length + 1 * size of each element it instead occupies size of new element + pointer to previous version of array + some minor implementation stuff
Basically snapshots, as in git, etc.
Brad Compton (he/him)
@Bradcomp
Jan 04 17:53
I've usually solved that by using Ramda's dispatching and using something like Immutable.js
But this is a project worth checking out: https://github.com/funkia/list
It's a persistent immutable list that's fully compatible with Ramda
Daniel Lugo
@danlugo92
Jan 04 17:56
@Bradcomp Nice! I hadn't thought of the dispatching aspect of it. Maybe someone could make adapters for immutable.js et al