Using Ramda, and pointfree style, how can I copy the first item of an array to the end of it?

后端 未结 2 1503
一个人的身影
一个人的身影 2021-01-25 01:27

I want to take an array [1, 2, 3] and return [1, 2, 3, 1].

I\'m using Ramda, and I can get the desired result like this:

const          


        
2条回答
  •  耶瑟儿~
    2021-01-25 01:39

    The S combinator is useful here:

    S.S(S.C(R.append), R.head, [1, 2, 3]);
    // => [1, 2, 3, 1]
    

提交回复
热议问题