These are chat archives for ramda/ramda

24th
Nov 2017
Are
@are1000
Nov 24 2017 09:36
Hi folks!
Given this object: let state = { id: 3, users: [ { id: 1 }, { id: 2 }, { id: 3 } ] }
How to extract correct user based on the id?
Of course, point-free
I have already tried compose(find(propEq('id', 3)), prop('users')) but as you can see, I'm still stuck with 3 in here
GÁBOR Áron Zsolt
@ashnur
Nov 24 2017 11:33
Stephan Meijer
@smeijer
Nov 24 2017 14:30
I have a lot of functions with a pattern like below. Is there a easy way to make them point free?
var map = (x, y) => R.map(i => R.map(j => `${i} - ${j}`), y), x);
Matías Fidemraizer
@mfidemraizer
Nov 24 2017 14:32
nvm
Bijoy Thomas
@bijoythomas
Nov 24 2017 15:10
@smeijer
const fn = x => y => x + ' - ' + y
lift(fn)(['1', '2', '3'], ['4','5','6'])
Stephan Meijer
@smeijer
Nov 24 2017 19:18
@bijoythomas , that ain't really the same thing. As that one gives back a 1 dimensional array, not a 2d array like the nested map.
Denis Stoyanov
@xgrommx
Nov 24 2017 19:19
:smile:
Stephan Meijer
@smeijer
Nov 24 2017 19:20
@ram-bot
const fn = (x, y) => R.map(i => R.map(j => `${i} - ${j}`, y), x);
fn([1,2,3], [4,5,6]);
ram-bot
@ram-bot
Nov 24 2017 19:20
[ [ '1 - 4', '1 - 5', '1 - 6' ],
  [ '2 - 4', '2 - 5', '2 - 6' ],
  [ '3 - 4', '3 - 5', '3 - 6' ] ]
Stephan Meijer
@smeijer
Nov 24 2017 19:20
@ram-bot
const fn = x => y => x + ' - ' + y
lift(fn)(['1', '2', '3'], ['4','5','6'])
ram-bot
@ram-bot
Nov 24 2017 19:20
[ '1 - 4',
  '1 - 5',
  '1 - 6',
  '2 - 4',
  '2 - 5',
  '2 - 6',
  '3 - 4',
  '3 - 5',
  '3 - 6' ]
Denis Stoyanov
@xgrommx
Nov 24 2017 19:22
think about lift like about Cartesian product
Bijoy Thomas
@bijoythomas
Nov 24 2017 19:24
@smeijer you can pass the result to splitEvery to get your desired result
Stephan Meijer
@smeijer
Nov 24 2017 19:42
Hmm, I guess I'm sticking to the nested R.map then :grin:
Bijoy Thomas
@bijoythomas
Nov 24 2017 20:01
if you are just looking for a point-free version
const fn = x => y => x + y
converge(
  splitEvery,
  [
    compose(length, nthArg(-1)),
    lift(fn)
  ]
)
Julian Coleman
@juliancoleman
Nov 24 2017 22:21
I'm trying to make a Ramda utility library and I can't come up with a good name. Can anyone tell me what language eweda originates from so that I can piggy back another pun to an already-great pun?