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
Dimitri Mitropoulos
@dimitropoulos
it's basically the same thing, but allows for some recording of timestamps, and then I have a startDebug or endDebug that basically just grabs the debugTimestamps and prints the performance numbers
Hyunseok Oh
@algoshipda
how can i make this function in ramda way?
const fn = x => id => R.prop(id, x);
Ian Hofmann-Hicks
@evilsoft
Try R.flip(R.prop), that should flip the arguments to R.prop
The C combinator I believe it is called
Ian Hofmann-Hicks
@evilsoft
const fn =
  R.flip(R.prop)
flip is very useful when you have to use other libs/apis that are not set up for easy composition with the data last format (or in cases where your data is the key name). But very handy tool in your belt, none the less
Hyunseok Oh
@algoshipda
@evilsoft wow thanks
Charles Hughes
@chughes87
@algoshipda you could also use _ which i think is more readable: https://ramdajs.com/docs/#__
so const fn = R.prop(R._, x) I believe?
Ian Hofmann-Hicks
@evilsoft
Personally I find the placholders a little less readable than using combinators like flip which provide descriptive names for how the combinator acts on the functions. But I think it is really just a taste thing.
Charles Hughes
@chughes87
Yeah I could go either way in this case. I think for functions that take 3+ arguments though there is little choice
Ian Hofmann-Hicks
@evilsoft
also would that x need to be provided, like const fn = x => R.prop(R._, x). and that would loose the nice auto curry that flip would of provided. so you would probably wanna wrap that in an R.curry
Charles Hughes
@chughes87
yah good point
wangzengdi
@adispring
what's other purpose of internal api _arity, except for limiting arguments'length to less than or equals to 10
for being easy to curry the function returned by other functions ?such as compose and pipe
Long Dao
@longebane
Awww yeah
Ian Hofmann-Hicks
@evilsoft
:wave: @longebane how the heck are ya
kapilpipaliya
@kapilpipaliya
onDestroy(() => { service.send('DESTROY'); });
how can i write this in ramda?
Twizzes
@Twizzes
@kapilpipaliya what are you trying to do
ramda isn't really a language, but more of a utility belt
and in that example, I don't see anything that could take advantage of ramda without seeing more context
kapilpipaliya
@kapilpipaliya
thanks
dattran1232003
@dattran1232003
Hey, I have one idea.
What if we could do this:
const appendLeft = (arr) => {}
dattran1232003
@dattran1232003
Const appendLeft = (elm, arr) => R.append(elm, arr.reverse()).reverse()
Brad Compton (he/him)
@Bradcomp
What is the difference between appendLeft and R.prepend?
dattran1232003
@dattran1232003
Is it exists?
Oh i don't no, sorry hehe
Brad Compton (he/him)
@Bradcomp
No prob! Happy to help :smile:
Pierre-Antoine Mills
@pirix-gh

Hi all!

I come here to ask you what do you think is the best way to reduce two lists at once?

Supposing that the two lists are exactly the same length, how could I reduce over list1, access the current item (with index usually) and get the value at that same index in list2.

In plain JS, I would usually use the indexfrom the callback, but it see that ramda works differently. I'd like to What do you think?

Rob Grant
@robgrant
zip first, then reduce
mitcho
@mitchoSR_twitter

someone told me a good practice for composing sorter functions is that if they return 0 it delegates to the next function, i defined this as

const pipeCritera = (...fns) => (a, b) => (fns.find(f => f(a, b) !== 0) || (() => 0))(a, b);

essentially returning the value of the first sorting function that doesnt return 0,

now im wondering if ramda already has this covered

Pierre-Antoine Mills
@pirix-gh
@robgrant this could double the iteration time on very long lists. Wouldn't it be wiser to have the index provided by the reducer, in that case of repeated operations/long lists?
I wonder what you think about this @Bradcomp
Ben Briggs
@ben-eb
@mitchoSR_twitter @pirix-gh Probably better to do this with reduce, here's one such implementation: https://stackoverflow.com/a/55990011
mitcho
@mitchoSR_twitter
ahh cool, thats a bit cleaner
thanks ben
Brad Compton (he/him)
@Bradcomp
What about R.sortWith?
mitcho
@mitchoSR_twitter
bingo
ty ramda tour guides XD
thanks brad
Brad Compton (he/him)
@Bradcomp
:bowtie:
Long Dao
@longebane
@evilsoft when you said javascript started out as a FP language, what did you mean?
Ian Hofmann-Hicks
@evilsoft
As I understand it, when it was being created, it was intended to be a LISP dialect, but near the end of development he added features like prototypical inheritance, this and other bit to make it more Java-like. That is why, from my understanding things like closure scope and first class functions are at the core. Which are the only (2) features that are required to be a functional language
Trying to track down my sources, one was an interview with Brendan Eich and another was a book. Gonna see if I can hunt those down and post them here
Brad Compton (he/him)
@Bradcomp
I think I read the same interview
He said that it was really important that first class functions were included.