dsmjs / talk-proposals

Submit proposals for topics that you would like to learn about or that you would like to present about
MIT License
4 stars 3 forks source link

TOPIC: Intoduction to Transducers #3

Closed ericponto closed 6 years ago

ericponto commented 6 years ago

"Transducer" sounds like just another jargony functional programming term and, yeah, it kind of is...

Consider this example (a classic intro to FP in JS example):

[1, 2, 3, 4, 5]
  .map(x => x * x)
  .filter(x => x % 2)

Performance-minded people might point out that we are looping through the array 2 times. And while that isn't going to cause any problems with an array of this size and with these simple operations, it can become an issue when the scale is different.

Here's where transducers come in. (More FP jargon coming...) Transducers let us compose our transformation functions (the map and filter) into a single reducer, which we can use to perform the same functionality on the array, but we'll only loop over it 1 time.

This talk would go over the basics of map,filter, reduce and function composition. Then build up gradually to transducers.

travi commented 6 years ago

thanks for submitting! sounds like an awesome talk. i look forward to hearing more detail

since we havent gotten an issue template out there yet, a few questions:

ericponto commented 6 years ago

This talk is not prepared. I wouldn't need very long to prepare though. I don't plan on giving this talk anywhere else. I could stretch it to be a long talk, but really it is very specific thing that would probably be better suited for a shorter (like 20 minutes or so) talk. Tuesday nights won't work for me until July or so. If we can move the night and you can find another person to give a shorter talk, then I'm open to something earlier in the year.

crolek commented 6 years ago

I think you did a quick 20 minute-ish map, filter, reduce talk awhile ago. Would you want to add that to the front of this content? Sort of like an intro into the functions and then how they make a transducer.

ericponto commented 6 years ago

I can stretch it for sure and add the really basic stuff on to the front.