These are chat archives for ramda/ramda

8th
Feb 2016
Remo H. Jansen
@remojansen
Feb 08 2016 01:25
Hi guys I have noticed in the docs that the library uses Maybe() and Just() where are those declared? Thanks
Scott Christopher
@scott-christopher
Feb 08 2016 02:22
@remojansen Those are some data types that exist in https://github.com/ramda/ramda-fantasy and https://github.com/plaid/sanctuary that play nicely with ramda
I believe there are a couple of open issues for Ramda that discusses how these data types could be better documented.
Yep, see #1627 and #1628
Remo H. Jansen
@remojansen
Feb 08 2016 02:27
Thanks for that :)
David Chambers
@davidchambers
Feb 08 2016 04:52

Is there a definition anywhere of what Ramda means by List ?

Not as far as I'm aware, @kwijibo.

Keith Alexander
@kwijibo
Feb 08 2016 07:05
@davidchambers thanks. Is there one in anyone's head, do you know? Is there consistency in what all the List functions are expected to work with?
(I was starting to jot down a draft/strawman intro to the documentation, and got a bit stuck on Lists)
David Chambers
@davidchambers
Feb 08 2016 07:56
Things are a bit muddy, @kwijibo. Functions such as R.head and R.tail operate on strings in addition to array-like values, but functions such as R.map and R.filter cannot operate on strings. I suggest we use “List” when talking about the former and “ArrayLike” when talking about the latter.
Keith Alexander
@kwijibo
Feb 08 2016 08:57
@davidchambers would you say List is a superset of Array, DOMNodeList, Arguments, String? (any more?)
are Objects interpreted (by map, filter etc) as a special case Functor by ramda, rather than a list?
David Chambers
@davidchambers
Feb 08 2016 08:59
A value of type List a is a non-Function value with a length property of type Number, I would say.
Keith Alexander
@kwijibo
Feb 08 2016 09:07
cheers
@davidchambers and numeric indexes ? implementations rely on stuff like, eg: item = list[i]
Scott Sauyet
@CrossEye
Feb 08 2016 12:09
To my mind, 'List' was never meant to mean something similar to 'array-like'. It was just used to paper over the problem that JS doesn't have a proper List type. We don't want to use 'Array' both because it's too narrow -- think arguments, etc -- and because it's too broad -- think sparse arrays.
Ideally it would just mean things for which head and tail make sense, but in practice it does have to do with length and indices.
@jackjennings: we could resurrect that Random to another repo if someone wants to champion it.
Shuffling is an odd idea in a library that stresses referential transparency. This implementation did try to bridge that gap as best it could, but it was an odd fit.
Constantin Dumitrescu
@dumconstantin
Feb 08 2016 13:35
@kwijibo thanks for the answer, its not exactly what I needed but I got the ideea
Joe Grund
@jgrund
Feb 08 2016 13:43
Is there a clean way / example of working with lens compositions that return Maybe types?
Joe Grund
@jgrund
Feb 08 2016 14:25
Looks like a Prism may be what I want.
Keith Alexander
@kwijibo
Feb 08 2016 17:46
@dumconstantin yeah sorry I realised later I'd misinterpreted your intent
Thanks for the clarification @CrossEye
joneshf-work1
@joneshf-work1
Feb 08 2016 19:17
Wasn't there something like [Boolean] -> Boolean? Like or?
Raine Virta
@raine
Feb 08 2016 19:24
any(identity)
joneshf-work1
@joneshf-work1
Feb 08 2016 19:53
But nothing as part of ramda?
Raine Virta
@raine
Feb 08 2016 19:55
nope, I remember having this discussion before and you came up with R.all(R.identity) for and
joneshf-work1
@joneshf-work1
Feb 08 2016 21:14
haha
k
boxofrox
@boxofrox
Feb 08 2016 21:31

heh. another note to self. R.of is not Array.of. Took me awhile to figure out why only one of four futures were running with R.sequence.

I've got this code snippet that feeds four variations of a function queryUpdatePastSalesBy with the same input, a date range. I'm using R.converge to achieve this. is there was a better approach in the Ramda toolkit for such an operation?

R.pipe(
  queryFetchDateRange,                    //=> { start :: Date, stop :: Date }
  R.converge(
    Array.of,                             //=> [ Future Error OkPacket ]
    [ queryUpdatePastSalesBy('week'),     //=> Future Error OkPacket
      queryUpdatePastSalesBy('month'),    //=> Future Error OkPacket
      queryUpdatePastSalesBy('quarter'),  //=> Future Error OkPacket
      queryUpdatePastSalesBy('year'),     //=> Future Error OkPacket
    ]
  ),
  R.sequence(Future.of),                  //=> Future Error [OkPacket]
),
Tobias Pflug
@gilligan
Feb 08 2016 23:53
@davidchambers spent any time looking at that PR
Damn i hate the iOS gitter app
Was not done typing
@davidchambers the ramda-lens profuncor impl PR