These are chat archives for ramda/ramda

23rd
Jun 2016
austinfrey
@austinfrey
Jun 23 2016 00:49
I'm trying to run ramda in the browser using a CDN, i keep getting the Uncaught ReferenceError: require is not defined message. I'm using the CDN options directly from the ramda site. Does this happen to a lot of people?
Vasili Sviridov
@vsviridov
Jun 23 2016 00:49
are you loading a serverside version?
require is usually used on serverside, or with tools like webpack
can you link?
austinfrey
@austinfrey
Jun 23 2016 00:52
Well I'm trying to run it on my chrome extension background page, so not really
Vasili Sviridov
@vsviridov
Jun 23 2016 00:52
i mean, link to the CDN file of ramda
Vasili Sviridov
@vsviridov
Jun 23 2016 00:54
hmm, require call is nowhere in that file.
how are you using it in your code?
austinfrey
@austinfrey
Jun 23 2016 00:56
just a couple of map and finds.
Vasili Sviridov
@vsviridov
Jun 23 2016 00:56
do you actually do var R = require('ramda') or something?
austinfrey
@austinfrey
Jun 23 2016 00:56
yes
Vasili Sviridov
@vsviridov
Jun 23 2016 00:57
ah
is it part of your extension manifest?
i think once you have it included in your manifest properly, it should just be available in global scope
austinfrey
@austinfrey
Jun 23 2016 01:01
I have it included in the manifest yes
Vasili Sviridov
@vsviridov
Jun 23 2016 01:02
is R simply available in global scope? (i have little experience with chrome extensions)
austinfrey
@austinfrey
Jun 23 2016 01:09
I have it listed in the manifest as a background script. I've used ornery libraries the exact same way with no problem, not sure what the issue is
Other* libraries
Vasili Sviridov
@vsviridov
Jun 23 2016 01:10
is it in correct order?
can you open your extension in the dev tools and look at the global scope?
what happens if you simply remove the require('ramda') line?
austinfrey
@austinfrey
Jun 23 2016 01:10
I have ram a listed first, before background. Js
Vasili Sviridov
@vsviridov
Jun 23 2016 01:11
what other libraries do you have? I bet you didn't have to require them
austinfrey
@austinfrey
Jun 23 2016 01:13
It was prelude-ls and yes you had to require it as well
Vasili Sviridov
@vsviridov
Jun 23 2016 01:13
well, your original error said that "require is not defined", so if you use require on other libaries, i'm not sure how that's possible, unless you were using those in some sort of AMD environment
i guess it's hard to make sense of it without seeing the source
austinfrey
@austinfrey
Jun 23 2016 01:14
I can post in few minutes. Thanks
austinfrey
@austinfrey
Jun 23 2016 01:50
@vsviridov http://pastebin.com/i1Pz71B4 here is my background.js code snippet
and the snippet from my manifest.json
Vasili Sviridov
@vsviridov
Jun 23 2016 01:51
so is it loaded from CDN or from local file?
just drop the require, i'm pretty sure R should just be on global scope
austinfrey
@austinfrey
Jun 23 2016 01:52
Well that time i tried from a local file. I've tried it both ways
Vasili Sviridov
@vsviridov
Jun 23 2016 01:52
ah..
austinfrey
@austinfrey
Jun 23 2016 01:52
I'll try your way so R = 'ramda' ?
Vasili Sviridov
@vsviridov
Jun 23 2016 01:52
well, require is AMD/nodejs api, should not have to use that
no, just don't include anything
simply use R.map or whatever you need
austinfrey
@austinfrey
Jun 23 2016 01:53
ahh ok
Vasili Sviridov
@vsviridov
Jun 23 2016 01:53
R should be in global scope
austinfrey
@austinfrey
Jun 23 2016 01:54
That looks like it did it!
Thanks
Vasili Sviridov
@vsviridov
Jun 23 2016 01:59
cheers
Drew
@dtipson
Jun 23 2016 02:08
@davidchambers is there a reason why Ramda's compose instead chooses to error instead of returning x=>x?
David Chambers
@davidchambers
Jun 23 2016 02:09
I'm not sure. You could try running git blame to see how long ago the logic for handling zero arguments was added. I would guess more than two years ago. ;)
Tushar Mathur
@tusharmath
Jun 23 2016 11:55
How does one compare two arrays for equality in ramda?
Tushar Mathur
@tusharmath
Jun 23 2016 11:59
and then compose it with isEmpty ??
@xgrommx
Tushar Mathur
@tusharmath
Jun 23 2016 12:10
How do I make this function point free?
const isSimilar = meta => {
    return SimilarList(A(meta), B(meta))
  }
Looks like R.ap kind of thing, but not sure how
Stefano Vozza
@svozza
Jun 23 2016 12:24
@tusharmath just use R.equals
Tushar Mathur
@tusharmath
Jun 23 2016 12:26
Oh .... does it do deeply nested comparisions ?
Denis Stoyanov
@xgrommx
Jun 23 2016 13:27
@tusharmath small example converge(unapply(identity), [head, tail])([1,2,3])
Tushar Mathur
@tusharmath
Jun 23 2016 13:30
:+1:
Stefano Vozza
@svozza
Jun 23 2016 14:28
yeah, R.equals does value equality
Drew
@dtipson
Jun 23 2016 14:35
@davidchambers just for background, I was curious about this mostly because I'm trying to grok Monoids, and came across both React's compose() = I Combinator and Fantasy-Land's Endo Monoid (where "empty" is I and concat is "compose") around the same time. I don't directly see a connection (i.e. a standalone compose with an empty case vs a compose operation in a monoid), but maybe there is one. Neat stuff
Jethro Larson
@jethrolarson
Jun 23 2016 19:45
Used R.sequence for the first time with data.maybe. felt good
Jethro Larson
@jethrolarson
Jun 23 2016 19:54
I didn't get the point before I needed it
Brad Compton (he/him)
@Bradcomp
Jun 23 2016 19:56
When you need it, it's great!
Jethro Larson
@jethrolarson
Jun 23 2016 19:57

Found it useful for running a function on multiple maybes

sequence(Maybe.of, [maybeFoo, maybeBar, maybeBaz]).map(([foo, bar, baz]) => foo + bar + baz)

I know you could do this with lift or ap

I don't know why it's called sequence. It kind of turns a structure inside out. Guess naming is hard
James Grayling
@jamesgrayling
Jun 23 2016 21:24
Why is allUniq deprecated?
David Chambers
@davidchambers
Jun 23 2016 21:44
@jamesbrown0, see #1622.