These are chat archives for ramda/ramda

18th
Feb 2016
Drew
@dtipson
Feb 18 2016 02:54
you could argue that R-to-L in compose matches, rather than reverses, the intuitive order of the arguments. That is: compose(f, g)(x) = f(g(x)
to me, that always feels/reads like squashing the x in, and since it's called on the right, it squashes right
David Chase
@davidchase
Feb 18 2016 03:27
no ramtuary love on that https://github.com/ramda/ramda/wiki#tools page :(
oh well its the repl now i guess LOL
David Chambers
@davidchambers
Feb 18 2016 03:47
You should update it, @davidchase!
Tobias Pflug
@gilligan
Feb 18 2016 07:23
Geez.
what is the matter with john david dalton trolling around on twitter. Why can't people just stick to the library of their choice
John-David Dalton
@jdalton
Feb 18 2016 07:29
Sup.
@gilligan I was straightening things out. I think you arrived a little late in that thread though.
John-David Dalton
@jdalton
Feb 18 2016 07:36
:cat: got your tongue?
Scott Christopher
@scott-christopher
Feb 18 2016 07:36
What exactly were you straightening out?
John-David Dalton
@jdalton
Feb 18 2016 07:37
The perf issue.
Scott Christopher
@scott-christopher
Feb 18 2016 07:37
What was the issue?
John-David Dalton
@jdalton
Feb 18 2016 07:37
You accused me of FUD too which isn't right. I was accurate.
You were wrong.
Scott Christopher
@scott-christopher
Feb 18 2016 07:38
Hardly
John-David Dalton
@jdalton
Feb 18 2016 07:38
I was
and even know your patch is introducing more instability
but you know know that right?
you have the experience to see your issue with it right?
Scott Christopher
@scott-christopher
Feb 18 2016 07:38
And you think the best way forward for the JS community is to keep the details to yourself and gloat on twitter?
John-David Dalton
@jdalton
Feb 18 2016 07:39
Don't step to me and accuse me of FUD when you didn't bother reading the thread
Scott Christopher
@scott-christopher
Feb 18 2016 07:39
I read the entire thread.
John-David Dalton
@jdalton
Feb 18 2016 07:39
Then you don't know how to read directions
you started in on Node 5
when the tweet was Node 0.10.
So don't bother throwing shade : )
Scott Christopher
@scott-christopher
Feb 18 2016 07:40
hahaha
John-David Dalton
@jdalton
Feb 18 2016 07:40
Later I proved your perf was bad in multiple browsers too.
You latched on to the perf note, I just defended by claim.
Scott Christopher
@scott-christopher
Feb 18 2016 07:41
Screen Shot 2016-02-13 at 2.45.14 PM.png
We can all find shit like that.
Your public attitude is an embarrassment to the JS community.
John-David Dalton
@jdalton
Feb 18 2016 07:41
Oh good grief
you are one to talk
Scott Christopher
@scott-christopher
Feb 18 2016 07:42
And I'm happy staying that way
I can also edit my comments too
John-David Dalton
@jdalton
Feb 18 2016 07:42
Yep : )
The issue I was showing was on common cases (covered in Node & multiple browsers)
And on common and many uncommon cases Lodash performs better
and perf isn't the only issue it tackles.
I don't want to get into the whole Lodash thing in a Ramda room though
That's bogus.
John-David Dalton
@jdalton
Feb 18 2016 07:50
On twitter I made a claim, I backed it up. When pressed harder I backed it up again.
Some feels got hurt. That's it.
Scott Christopher
@scott-christopher
Feb 18 2016 07:52
I think people are just getting tired of seeing the same sweeping statements that Ramda is slow.
John-David Dalton
@jdalton
Feb 18 2016 07:53
Lodash doesn't have those issues and it's used by a ton more folks in a ton more scenarios.
It's even powering gitter chat right now. I had one of the gitter devs experiment with swapping it out with Ramda, after they switched from Underscore, and it killed their Node instance.
But now while trying to solve Ramda's perf issues you've introduced some consistency/correctness bugs too.
It's tricky for sure.
Scott Christopher
@scott-christopher
Feb 18 2016 07:58
If you could raise an issue with the details, we would be grateful.
John-David Dalton
@jdalton
Feb 18 2016 07:58
I do open issues from time to time.
Though in the past you all have done the R v L thing so I'm less likely to contribute in that area.
Scott Christopher
@scott-christopher
Feb 18 2016 08:00
Fair enough.
John-David Dalton
@jdalton
Feb 18 2016 08:01
I put the work in on my side and yadda yadda
Scott Christopher
@scott-christopher
Feb 18 2016 08:02
Anyway, as fun as this has been, I've gtg.
John-David Dalton
@jdalton
Feb 18 2016 08:03
No worries. Thanks for chatting it up.
Tobias Pflug
@gilligan
Feb 18 2016 09:04
good god
John-David Dalton
@jdalton
Feb 18 2016 09:05
:fire:
Tobias Pflug
@gilligan
Feb 18 2016 09:05
I don't get what you are after to be honest
John-David Dalton
@jdalton
Feb 18 2016 09:06
It's all good 😎
Tobias Pflug
@gilligan
Feb 18 2016 09:07
why don't you just stick to your lodash stuff ? I get it.
Ramda is slow and small user base etc
Not sure why you care since you are on the right side anyway
John-David Dalton
@jdalton
Feb 18 2016 09:09
The topic came up. I made a comment. Ramda folks had feels hurt. I defended by position.
You're just now finding out, getting feels hurt, and continuing it.
It was 5 days ago on twitter of all places : )
John-David Dalton
@jdalton
Feb 18 2016 09:15
@gilligan You good now?
Tobias Pflug
@gilligan
Feb 18 2016 09:19
phone battery died
i am not hurt. i am just puzzled because of so much negativity - at least that is what I perceive
John-David Dalton
@jdalton
Feb 18 2016 09:20
I threw back what I was given.
I was told I was lying, dishonest, ignorant, & didn't understand FP so I defended by comment.
So much dramz
It's getting late here 😫
Jim Argeropoulos
@ExploreMqt
Feb 18 2016 15:25
I realized this morning that I still had 0.18.* in my package.json. So I upgraded it to 0.19 and I had a test fail. Boils down to merge() no longer works if you pass undefined as the second parameter. I submitted a pull request to prevent the TypeError
Raine Virta
@raine
Feb 18 2016 15:40
@ram-bot R.merge({}, undefined)
ram-bot
@ram-bot
Feb 18 2016 15:40
{}
Jim Argeropoulos
@ExploreMqt
Feb 18 2016 15:42
@raine Are you saying there is no issue?
Keith Alexander
@kwijibo
Feb 18 2016 15:44
@ram-bot R.merge({a:42}, undefined)
ram-bot
@ram-bot
Feb 18 2016 15:44
TypeError: Cannot convert undefined or null to object
Raine Virta
@raine
Feb 18 2016 15:45
it's not obvious whether it should silently accept undefined as {} in that case or explode
Simon Thörnqvist
@drowzy
Feb 18 2016 16:01

Hello friends! I have a this messed up structure:

var structure = {
  foo: {
    '1': {
      id: 1,
      bar: {
        '1': {
          id: 1
        },
        '2': {
          id: 2
        }
      } 
    }
  }
};

What I want my functions to turn it in to:

var result = [{
  id: 1,
  bar: [
    {
      id: 1
    },
    {
      id: 2
    }
  ]
}]

so I came up with this.

var valuesFor = (str) => R.compose(R.values, R.path([str]));
var intermediateArray = valuesFor('foo')(structure);

var getResult = R.map((foo) => {
  return R.assoc('bar', R.map(R.pick(['id']), valuesFor('bar')(foo)), foo);
});

getResult(intermediateArray);

Is there a way to achieve this without using the intermediate array? General pointers and advice is very welcome

Keith Alexander
@kwijibo
Feb 18 2016 16:03
This message was deleted
Jakub Korzeniowski
@kujon
Feb 18 2016 16:09
@drowzy http://goo.gl/6jJpNJ would something like that work?
Simon Thörnqvist
@drowzy
Feb 18 2016 16:13
Yes! Alot cleaner. Thank you :)
Jakub Korzeniowski
@kujon
Feb 18 2016 16:14
you're welcome :smile:
Sebastien Daniel
@SebastienDaniel
Feb 18 2016 20:53
I want... clone()!
no... dissoc()!
no, even better, omit()!
you guys thought of everything :P
David Chambers
@davidchambers
Feb 18 2016 21:33
I'm pleased you think so, @SebastienDaniel.
Tom Duncalf
@tomduncalf
Feb 18 2016 21:34
is there a "right" way to extract a nested property?
something like R.prop('user.email') (but that doesn't work, of course)
David Chambers
@davidchambers
Feb 18 2016 21:34
@ram-bot R.path
ram-bot
@ram-bot
Feb 18 2016 21:34
[Function: f2]
Tom Duncalf
@tomduncalf
Feb 18 2016 21:34
woo
cheers @davidchambers :)
David Chambers
@davidchambers
Feb 18 2016 21:35
No problem. I know there's a way to get the bot to provide a useful link…
@ram-bot R.path
Raine Virta
@raine
Feb 18 2016 21:35
@davidchambers it might be a bit unintuitive but docs are accessed without mentioning the bot
David Chambers
@davidchambers
Feb 18 2016 21:35
R.path
David Chambers
@davidchambers
Feb 18 2016 21:35
Ah, there we go! Thanks, @raine.
Keith Alexander
@kwijibo
Feb 18 2016 21:36
ram-bot is nice work
wdav-wdav
@wdav-wdav
Feb 18 2016 22:10
is there a way to short circuit while enumerating through a list?
Brad Compton (he/him)
@Bradcomp
Feb 18 2016 22:12
This message was deleted
@wdav-wdav R.reduced can be used for a lot of cases where you want to stop iteration early
LeonineKing1199
@LeonineKing1199
Feb 18 2016 22:29
Am I alone or does anyone else care about Ramda maybe potentially including complexity analysis in their documentation?
Scott Sauyet
@CrossEye
Feb 18 2016 23:20
@LeonineKing1199: what would that entail? Are you suggesting that each function include a report of its cyclomatic complexity number and such?
LeonineKing1199
@LeonineKing1199
Feb 18 2016 23:24
@CrossEye I meant spatial and temporal complexities, specifically. Granted, JS is used on such tiny data sets that it maybe a trivial consideration. It'd be more of a "fun fact" than it would be a utility
LeonineKing1199
@LeonineKing1199
Feb 18 2016 23:29
At the same time though, Node's event loop is single-threaded... Time wasted with inefficient use of algorithms is time that could be used to process more requests! We could get an efficiency boost of 1 extra request per every 100!