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
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.
Ian Hofmann-Hicks
@evilsoft
Spcifically a Scheme Lisp I think, gosh darn it, it is a lot harder to find the original material then it was 4 years ago
Long Dao
@longebane
Asking because I'm about to teach a js fundamentals course and my lesson plan keeps telling me to state JS started as and is an OOP language
and unless I can argue against that myself, I'll have to say that
Brad Compton (he/him)
@Bradcomp
It is most definitely an OO language, and a Functional Language, and an Imperative language, etc. It has been multi-paradigm since the beginning.
But think about how common it is, and has been for years, to pass in callback functions
Long Dao
@longebane
then why is JS always parroted as an OOP lang?
Brad Compton (he/him)
@Bradcomp
I'd say it's one of the main things people need to learn when moving over to JS from less functionally capable languages
Because it is one, but that doesn't mean it's not functional too
Long Dao
@longebane
I agree. But the argument is that it is OOP first, with functionality for other styles
and here Ian comes and says it was a FP language first
Ian Hofmann-Hicks
@evilsoft
Well I would not say first, because it was general purpose when it was released to all of us
Long Dao
@longebane
ok, then I misunderstood you
Ian Hofmann-Hicks
@evilsoft
more that it was built on the foundation of a functional language
with the other stuff tacked in in the 11th hour
Brad Compton (he/him)
@Bradcomp
Both paradigms are built into the core of the language
It's a pretty weird OO language in a lot of ways too though
Long Dao
@longebane
then would it be safe to say, it was built on the foundation of a funtional language, and then appended by OO-heavy devs to be more OO?
Ian Hofmann-Hicks
@evilsoft
I just do not use the OO bits because of my aversion to state
Brad Compton (he/him)
@Bradcomp
Most languages don't use prototypical inheritance
The scoping is weird and it didn't get classes till 2015-ish?
Long Dao
@longebane
but isn't prototypical inheritance still a subset of OO
Brad Compton (he/him)
@Bradcomp
Then you have stuff like calland apply
It is, but if it was inspired by Java it certainly had a ... unique take
Ian Hofmann-Hicks
@evilsoft
Yes, but not the norm @longebane. what some would call Traditional OO
Brad Compton (he/him)
@Bradcomp
You can use prototypes similar to classes, but they can also be used for some rad metaprogramming, multiple inheritance, mixins, etc.
Long Dao
@longebane
Ok, then instead of "JS is an OO language", what would be better?
that's essentially what I'm getting at
Brad Compton (he/him)
@Bradcomp
JS is a multi-paradigm language supporting OO, Functional, and Imperative programming styles, as well as allowing the user to mix and match
Long Dao
@longebane
deja vu. I feel like I've seen that before
Ian Hofmann-Hicks
@evilsoft
:+1: to that @Bradcomp
Long Dao
@longebane
looks great!
Ian Hofmann-Hicks
@evilsoft
:sheep: :it:
Long Dao
@longebane
:red_circle: :eyes:
Brad Compton (he/him)
@Bradcomp
Because of this, it can support a wide variety of applications and use cases. It also provides a number of footguns for users that await the incautious developer.