These are chat archives for ramda/ramda

17th
Sep 2015
Richard Burton
@ricburton
Sep 17 2015 00:04
Haven’t looked at that too closely so far. The search function in particular is a bit of a pipe dream.
With the experience settings, that seems more like a re-organisation of content than a new engineering challenge
my thinking was
for newbies, they need to install and justify to themselves the time
for users, they need to see functions easily
for contributors, they need to see what's new and why it matters
David Chambers
@davidchambers
Sep 17 2015 00:07
Watching the GitHub repository is likely to remain the best way for contributors to stay abreast of developments. I think the website should focus on the other two groups ("newbies" and "users").
Scott Christopher
@scott-christopher
Sep 17 2015 00:11
"lambs" and "rams"
David Chambers
@davidchambers
Sep 17 2015 00:11
Nice!
Richard Burton
@ricburton
Sep 17 2015 01:52
🐑🐏😂
Richard Burton
@ricburton
Sep 17 2015 05:10
My friend said he thinks these changelogs are great: https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md
Raine Virta
@raine
Sep 17 2015 07:28
they look nice
Raine Virta
@raine
Sep 17 2015 08:15
any ideas how we could improve indexOf docs? it doesn't mention that it works for strings or that it dispatches to .indexOf
hemanth.hm
@hemanth
Sep 17 2015 14:20
what you be the simplest example of amaybe ? maybe from ramda-fantasy
which was the web repl that had ramda + ramda-fantasy + yet another lib ?
hemanth.hm
@hemanth
Sep 17 2015 14:30
@ricburton that's cool!
hemanth @hemanth just converted the web REPL examples to ES6 ramda/ramda.github.io#30
Raine Virta
@raine
Sep 17 2015 14:45
> const R = require('ramda');
> const { Just, Nothing, maybe } = require('ramda-fantasy').Maybe;
>
> maybe('default', R.toUpper, Just('foobar'))
'FOOBAR'
> maybe('default', R.toUpper, Nothing())
'default'
David Chase
@davidchase
Sep 17 2015 15:37
@hemanth im working on one right now http://davidchase.github.io/ramtuary/ i posted it here before… its a clone of ramda repl
currently switching over to using babel and going to add version selection, update to new code mirror, etc
hemanth.hm
@hemanth
Sep 17 2015 15:43
@davidchase Yes, the same! Thanks :) you might want to check ramda-repl a node module
hemanth.hm
@hemanth
Sep 17 2015 15:45
@raine Uber cool, thanks :)
David Chase
@davidchase
Sep 17 2015 15:48
@hemanth pretty sweet :thumbsup:
hemanth.hm
@hemanth
Sep 17 2015 15:49
@davidchase Under what license if your web repl? I understand it's an extension of ramda web repl
@raine and for lenses ;) ?
David Chase
@davidchase
Sep 17 2015 15:55
@hemanth MIT, why you ask?
hemanth.hm
@hemanth
Sep 17 2015 15:56
@davidchase I am planning to use it in a talk with few modification for my need, for now i have ramda's web repl ready with me, btw my talk is tomo :D
David Chase
@davidchase
Sep 17 2015 15:58
awesome! is it being streamed or broadcasted live anywhere?
David Chase
@davidchase
Sep 17 2015 16:12
also if i may ask what modifications were made? just curious
hemanth.hm
@hemanth
Sep 17 2015 16:20
@davidchase I'm yet to use Ramtuary REPL, nothing much just on the output part for now
can't get simpler than xLens = R.lens(R.prop('x'), R.assoc('x')); ?
hemanth.hm
@hemanth
Sep 17 2015 16:29
@davidchase Talk is at https://jsfoo.in/2015/ there will be live streaming , i don't have the URL handy now, will pass it soon.
hemanth @hemanth two issues: ramda/ramda.github.io#32 and ramda/ramda.github.io#31
David Chase
@davidchase
Sep 17 2015 17:13
looks like a pretty stellar lineup at that jsfoo conf from rxjs to flying drones :D
ideally i wanted to work on ramtuary and then open a PR for the ramda repl and merge in some of my stuff it seems like some tlc is wanted on the ramda repl based on #1000
joneshf-work1
@joneshf-work1
Sep 17 2015 18:10
Is there a reason why these two are different?
R.pipe(R.add, R.flip(R.map)([1,2,3]))(12)
//=> function(n){return t.apply(this,arguments)}
R.flip(R.map)([1,2,3])(R.add(12))
//=> [13, 14, 15]
semantically they should be the same, right?
David Chambers
@davidchambers
Sep 17 2015 19:17
@hemanth, that could be written xLens = R.lensProp('x').
@joneshf-work1, the first argument to R.pipe determines the arity of the curried function returned. R.add is a binary function, so any pipeline beginning with R.add will result in a curried binary function awaiting two numbers. This is not what you want in this case, but you could use R.pipe(R.identity, R.add, …) as a workaround. This has been discussed in ramda/ramda#1318, but we can't agree on what our various composition functions should do. I'd appreciate your input!
Scott Sauyet
@CrossEye
Sep 17 2015 19:24
@joneshf at first I thought you were caught by the issues discussed in #1318, but looking at it again, it seems like you're eventually going to call add([1, 2, 3], 12). That doesn't sound like what you want. :smile:
What did change in #1260 and lead to those discussions was this, which worked in v15 but not since: R.pipe(R.add, R.map)(12)([1, 2, 3]).
Scott Sauyet
@CrossEye
Sep 17 2015 19:29
And I heartily concur. I'd love to have your input on #1318!
Scott Sauyet
@CrossEye
Sep 17 2015 20:38
@hemanth: very cool on the REPL!
joneshf-work1
@joneshf-work1
Sep 17 2015 20:53
@davidchambers this is new behavior right?
If it's not, why does pipe behave like that?
Prelude> flip map [1,2,3] . (+) $ 12
[13,14,15]
David Chambers
@davidchambers
Sep 17 2015 20:54
It's fairly new behaviour, yes (added in v0.17.0).
joneshf-work1
@joneshf-work1
Sep 17 2015 20:54
intentional?
David Chambers
@davidchambers
Sep 17 2015 20:54
The goal was to curry the function returned by compose/pipe.
joneshf-work1
@joneshf-work1
Sep 17 2015 20:55
hmm
seems complex.
David Chambers
@davidchambers
Sep 17 2015 20:56
What I would like to see is compose/pipe assume all the functions they are given to be unary (rather than assuming all but the first to be unary as they do now). I'd like a separate function for composing functions of arbitrary arity which would respect the arity of every function. Composing three binary functions would result in a curried function of length 4.
joneshf-work1
@joneshf-work1
Sep 17 2015 20:57
Also seems complex.
David Chambers
@davidchambers
Sep 17 2015 20:57
Sure, but one would use the simpler compose/pipe in 99% of cases.
Jethro Larson
@jethrolarson
Sep 17 2015 21:03
Found this http://forwardjs.com/university/a-million-ways-to-fold-in-js
was good. He's going super fast though
Raine Virta
@raine
Sep 17 2015 21:15
my evening toy project, anyone wanna give it a spin? https://github.com/raine/replem
Scott Sauyet
@CrossEye
Sep 17 2015 21:27
Sorry, I should stop trying to gitter on my phone. David is right as usual. I misread this as R.pipe (R.add, R.flip(R.map))([1, 2, 3])(12). The peels of misplaced punctuation!
This worked before #1260: http://bit.ly/1F5dZwg
joneshf-work1
@joneshf-work1
Sep 17 2015 22:25
Ah.
I only skimmed #1318
There was too much information there.
I think compose/pipe should just compose/pipe.
if they don't, some other function should.
whatever the variadic equivalent of this is:
function compose(f) {
  return function(g) {
    return function(x) {
      return f(g(x));
    };
  };
}
Jethro Larson
@jethrolarson
Sep 17 2015 22:44
in my personal stuff I have binary compose(f,g) and composeAll([f, g, h])
easier to keep track of what fixed arity stuff is doing
composeAll is just reduce(pipe, identity)
Scott Sauyet
@CrossEye
Sep 17 2015 22:55
@joneshf-work1: one question is just what the variadic equivalent is.
Jethro Larson
@jethrolarson
Sep 17 2015 23:04
function compose(f, g) {
  if(g) return compose(f)(g);
  return function(g) {
    return function(x) {
      return f(g(x));
    };
  };
}
lazy answer
makes compose either compose(f, g) or compose(f)(g)