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
David Chambers
@davidchambers
That'll be sweet!
Tobias Pflug
@gilligan
should probably be "neutral element" not "unit element"
urghs, it is probably not that hard to write the tests in most cases but I think I will need help to designate which properties should hold for which function ;--)
Tobias Pflug
@gilligan
I opened #1540 to ask for some input on what functions folks would like to see which properties tested for ;)
Scott Sauyet
@CrossEye
Don't know how much I'm going to be online in the next week. Maybe more than normal, maybe lots less. Finally taking my delayed (and reduced) trip to India. Cheers!
Tobias Pflug
@gilligan
Wow, enjoy!
Scott Sauyet
@CrossEye
Thanks. Work, not pleasure, but I'll try.
Tobias Pflug
@gilligan
hm, i am quite confused right now
R.equals(new Error('XXX'), new Error('XXX')) this evaluates to false - the tests in equals.js test for it to be true
if I run only the equals test it fails, if I run everything via npm run test it passes
?!?!
Scott Christopher
@scott-christopher
@gilligan I'm guessing you're running the individual test on v0.18, which was tagged a couple of days before this commit landed ramda/ramda@ba70cc5
Tobias Pflug
@gilligan
@scott-christopher i am on master
@scott-christopher working on a pull request
Scott Christopher
@scott-christopher
how did you run the individual test?
Tobias Pflug
@gilligan
basically just run mocha to run the individual file
@scott-christopher also just look at the output of the ramda repl
@scott-christopher it evaluates to false even though in the test it tests for equality to return true
Scott Christopher
@scott-christopher
Yeah, the repl is running v0.18
Tobias Pflug
@gilligan
ah, d'oh now i get you
Scott Christopher
@scott-christopher
try running npm run build beforehand if you're running mocha directly
or npm run pretest && mocha test/equals
Tobias Pflug
@gilligan
let me try
that works
and I don't understand why
can you enlighten me ? :)
Scott Christopher
@scott-christopher
the tests use dist/ramda.js, so you need to make sure that has the latest build from the current source
The dist/ramda.js that is commited is the build from the most recent tagged release.
so when you ran the test without running npm run build prior, it was using ramda v0.18, which didn't yet have the equals implementation for Error
running npm run test implicitly runs npm run pretest by convention of npm scripts prefixed with pre (and likewise for post).
Tobias Pflug
@gilligan
actually it all boils down to the fact that i hadn't rebased my branch for too long ;}
Scott Christopher
@scott-christopher
or that :D
Tobias Pflug
@gilligan
and at the point where the repl result did not make sense and i didn't think about it merely not being up to master
Tobias Pflug
@gilligan
@scott-christopher either way - thanks for the quick heads up ;)
Scott Christopher
@scott-christopher
no worries :)
Tobias Pflug
@gilligan
Meh, just realized again that I have no idea/intuition about transducers - i need to fix that
Aldwin Vlasblom
@Avaq

@gilligan You can view it as a way to compose a computation, where every step takes the value(s) from the previous step, and emits zero or more new values for the next step. This allows the final computation to be used in any kind of reduction (map, filter, etc) of any kind of list (array, stream, generator, etc). The internal mechanism also has a built-in way to deal with short-termination (when doing a take(), for example).

Since you're extending the "step" function you end up with a means to "stream" your input list through the entire computation value by value, rather than doing .map().filter().take() and building up intermediate lists in between steps. So once you've coded a transducer it is more efficient, and more reusable than when you code a chain of operations.

I found watching this video over and over again quite helpful in gaining an understanding: https://www.youtube.com/watch?v=6mTbuzafcII

Tobias Pflug
@gilligan
Thanks, at the surface all that does make perfect sense. I just need to find (identify appropriate) opportunities to use transducers
@Avaq i think it boils down to me having to play around with transducers ;)
Aldwin Vlasblom
@Avaq
@gilligan Just use them any time you have a sequence of steps, if only for the performance gain. Like instead of going: pipe([map(f), filter(g)], arr) go into([], compose(map(f), filter(g)), arr). I really like using them for processing object streams in Node with transduce-stream, because it allows me to work using my normal Ramda workflow on Streams:
import throughx from 'transduce-stream';
stream.pipe(throughx(compose(
  map(f),
  filter(g),
  take(5)
), {objectMode}))
Tobias Pflug
@gilligan
@Avaq currently working in a big React project with ramda. Suppose I will just have a look at the various scenarios where I apply a transformation pipeline via R.pipe
Keith Alexander
@kwijibo
@gilligan this blog post is what helped me grok transducers http://phuu.net/2014/08/31/csp-and-transducers.html
boxofrox
@boxofrox
@Avaq, your pipe and compose from :point_up: December 12, 2015 10:11 AM have the same order of operations. I take it transducers do something to reverse the order of operations?
Raine Virta
@raine
they don't exactly do anything, it's inherent to the way they compose
it took me a while to understand why it happens
boxofrox
@boxofrox
Thanks, @raine. I'll dig around and see if can figure it out, too. I vaguely recall Rich Hickey's talk covered that composition bit. Think I'll start there.
Tobias Pflug
@gilligan
Can someone merge ramda/ramda#1541 ? master is broken right now
boxofrox
@boxofrox
Note to self, don't use Ramda functions in undocumented ways. In 0.17, invoker(1, 'getResponseHeader', 'content-type') worked fine, but was documented to be used as invoker(1, 'getResponseHeader')('content-type'). I suspect the currying of pipe and compose had something to do with that. Upgrade to 0.18 and I run into errors with functions further down the pipe because 'content-type' was effectively dropped. Doh.