Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:17
    CrossEye commented #2779
  • Jan 31 2019 21:04
    ArturAralin commented #2779
  • Jan 31 2019 20:08
    CrossEye commented #2779
  • Jan 31 2019 18:56
    buzzdecafe commented #2631
  • Jan 31 2019 18:09
    ArturAralin commented #2779
  • Jan 31 2019 16:18
    CrossEye commented #2779
  • Jan 31 2019 16:10
    CrossEye commented #2631
  • Jan 31 2019 16:06
    CrossEye commented #2777
  • Jan 31 2019 14:44
    ArturAralin opened #2779
  • Jan 31 2019 07:39
    inferusvv commented #2631
  • Jan 31 2019 03:07
    sespinozj commented #2771
  • Jan 31 2019 02:33
    machad0 commented #2771
  • Jan 31 2019 02:26
    JeffreyChan commented #2777
  • Jan 30 2019 14:30
    CrossEye closed #2777
  • Jan 30 2019 12:13
    vanyadymousky updated the wiki
  • Jan 30 2019 01:42
    JeffreyChan commented #2777
  • Jan 29 2019 21:06
    vanyadymousky updated the wiki
  • Jan 29 2019 16:28
    CrossEye commented #2777
  • Jan 29 2019 15:50
    mbostock commented #2772
  • Jan 29 2019 15:48
    CrossEye commented #2772
Julien Goux
@jgoux
I was able to do it using redux-loop which is more or less designed to return a pair of state+effect
But I had to implement my own composition logic
So maybe I can find a right datastructure to do it more naturally
Keith Alexander
@kwijibo
@jgoux the update functions are reducers, right? you could compose them with the transducers pattern
Julien Goux
@jgoux
yes they are reducers :D
Denys Mikhalenko
@prontiol
shouldn't key be x, y and z instead of 0, 1 and 2? anyone?
R.addIndex(R.map)((value,key,collection) => console.log(value,key,collection))({x:1, y:2, z:3})
Julien Goux
@jgoux
could you give me a link about this transducers pattern ?
@prontiol I think addIndex just add a regular integer index, so it seems good to me
Keith Alexander
@kwijibo
@jgoux http://phuu.net/2014/08/31/csp-and-transducers.html was what helped me grok it ... it's a long read I'm afraid
Julien Goux
@jgoux
I don't mind long reads, I enjoy learning :D
thank you !
Keith Alexander
@kwijibo
well, it's a really good blog post :) hope you enjoy it
Denys Mikhalenko
@prontiol
i believe it is not correct for objects :-(
who needs integer index as a key for object?
Keith Alexander
@kwijibo
basically the transducer pattern is, reducers are binary functions, and you can only really compose unary functions
This message was deleted
Matthias Seemann
@semmel
@prontiol If applied on an object R.map works just on the values, not the keys:
R.map( x => { console.log(x); }, {x:1, y:2, z:3})  // 1 2 3
Denys Mikhalenko
@prontiol
i was talking about keys added by R.addIndex
as indexes in an object are strings, key should be actually keys and not just autoincrementing integers
because these integer keys have no use actually, if iterating over an object
Keith Alexander
@kwijibo
@jgoux so you make the reducers unary by making them accept another reducer that they compose with themselves internally
Matthias Seemann
@semmel
@prontiol I don't know if the implementation of R.addIndex treats objects in the same way as arrays (just what it is supposed to work on) but with keys as indices.
kwijibo @kwijibo finds reactjs/redux#1528 in my open-but-unread tabs
Julien Goux
@jgoux
@kwijibo ok I read the article, but I don't immediately see how using a tranducer would improve my current implementation (or I don't see how to do it :D)
Matthias Seemann
@semmel

Without using Ramda the native implementation or my pickValues problem is simply

// [string] -> {k:v} -> [v]
var pickValues = keys => object => keys.map( key => object[key] );
pickValues(['x', 'y'])({x: 1, y: 2, z: 3}) // ===> [1, 2]

Perhaps that is better.

LeonineKing1199
@LeonineKing1199
Looking at gist makes me wish that JS had namespaces sooooooo badly
Brad Compton (he/him)
@Bradcomp
@semmel :+1: That's clearly readable
Denys Mikhalenko
@prontiol
@semmel this seems to be good enough
Kevin Wallace
@kedashoe
@prontiol i agree addIndex sounds like it might add object keys, maybe the docs should explicitly state that it doesn't
you can use http://ramdajs.com/docs/#mapObjIndexed if you need the object keys :)
Kevin Wallace
@kedashoe
does anyone think the "See also" annotations are too subtle? I knew ramda had what @semmel was looking for but it still took me a bit to find it even though the first place I looked was pick and there is a "see also" for props there
Matthias Seemann
@semmel
@kedashoe Yeah, right that is it! Thank you!.
It is sometimes so difficult to discover a Ramda function... pick, pluck, props all similar in behaviour but the naming... I have no clue...
Denys Mikhalenko
@prontiol
agreed
Kevin Wallace
@kedashoe
we're working on that, any ideas anyone has in that area welcome :)
@svozza just recently put together this awesome page ramda/ramda#1695
Matthias Seemann
@semmel

@kedashoe What lead me astray is the inconsistent wording, even in the type signatures. For R.prop the docu speaks about properties (hence it's name), The sig is s → {s: a} → a | Undefined and the text says

returns the indicated property

Where as for R.props the sig is [k] → {k: v} → [v] and the text is about values. It says

Returns ... corresponding values

R.pluck is about keys and values as well.
Perhaps R.prop and R.props should be called R.valuesOf or something like that... But I don't know.

Stefano Vozza
@svozza
I just realised that addIndex is not on that list of functions I compiled. I'm just about to head to bed so if anyone wants to correct my omission then go ahead:
https://github.com/ramda/ramda/wiki/What-Function-Should-I-Use%3F
LeonineKing1199
@LeonineKing1199
That list is awesome!
Scott Christopher
@scott-christopher
I can add addIndex now.
:zap:
Brad Compton (he/him)
@Bradcomp
Should we add R.props as well?
  • I want to pick an ordered list of values from an object
Lewis
@6ewis
Should we add R.when as well?
Lewis
@6ewis
How do you guys read that a → [a] → Number
Scott Christopher
@scott-christopher
@6ewis: It takes some value of type a, along with a list of values of the same type and returns a number (presumably the index of the element)
Lewis
@6ewis
where's that notation from?
LeonineKing1199
@LeonineKing1199
I think from the lands of pure functional programming