question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I was looking into an alternative for evolve that worked with arrays, but the closest thing I found was adjust. However it only works in a single element. I propose we do something similar to evolve, or a variant of adjust that could take a transform object to apply to difference indexes.

Here is currently my workaround (it won’t work as good as evolve, since it doesn’t account for nesting):

const adjustAll = R.curry((transforms, arr) => {
  
    const newArrEls = Object.keys(transforms)
        .reduce((r, i) => {
            const fn = transforms[i];
            r[i] = fn(arr[i]);
            return r;
        }, {});
  
    return Object.assign(
      [], 
      arr, 
      newArrEls
    );
});

Here is a demo: https://goo.gl/ZbcpJj

What do you guys think?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Bradcompcommented, Sep 8, 2017

I wasn’t aware we had a cookbook

This is a common statement. I think we should have a link to the cookbook (or the wiki in general) somewhere on website or in the readme…

0reactions
kurtmilamcommented, Sep 8, 2017

I just worked this up in response to a question in the Ramda Gitter:

const evolveArray =
  template =>
    addIndex( map )
            ( ( x, i ) => template[ i ]( x ) )
evolveArray( [ add( 1 ), add( 2 ), add( 3 ) ] )
           ( [ 1, 2, 3 ] )
//->[ 2, 4, 6 ]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Adjusting Multiple Series
In order to seasonally adjust all series in the data frame, you can run: ... Alternatively, X-13 can be called for each series...
Read more >
Title and subtitle in R [Set and Adjust] - R CHARTS
Add titles and a subtitle to your base R graphics. Customize the color, adjust the position, use mathematical expressions or change the font...
Read more >
adjustOHLC: Adjust Open,High,Low,Close Prices For Splits ...
View source: R/adjustOHLC.R. adjustOHLC, R Documentation ... Description. Adjust all columns of an OHLC object for split and dividend.
Read more >
Loops and Functions in R
Now let's adjust all of our weight up by 10% if the measurement was taken in 1984. The first thing we'll need to...
Read more >
Drawing beautiful maps programmatically with R, sf and ggplot2
The modular approach of ggplot2 allows to successively add ... As such, we can adjust all characteristics of points (e.g. color of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found