-*- coding: utf-8 -*- BartholomewJS ​Greetings, everyone. Xah Lee ​hey B BartholomewJS ​hey X ZitronCrazy ​Hey Xah abdo esam ​hello everyone Xah Lee ​did finish funct prog yesterday Xah Lee ​gonna add a topic of continue that BartholomewJS ​Now? Xah Lee ​mabe with concrete code, e.e. ja. Xah Lee ​hi zitron Xah Lee ​hi abdo BartholomewJS ​Do you mean German "ja"? 😁 Xah Lee ​js. Xah Lee ​lol, on a tablet now, cant type BartholomewJS ​Filthy casuals only use tablets. Xah Lee ​added topic 12 Xah Lee ​😀 Xah Lee ​brb in 5 BartholomewJS ​#12 Welcome to live chat! Remember to guard your privacy and abide by our community guidelines. Web Dog ​hey Xah Web Dog ​I abandoned Emacs and am a VS Code soyboy now BartholomewJS ​Yes, good topic. ZitronCrazy ​creepy clown face Web Dog ​functional programming is for ppl who pretend to be good at math Web Dog ​legit This message is held for review. BartholomewJS ​Julia is a hot b tch Seamus Slack ​howdy Seamus Slack ​@Xah Lee functional programming JS great. I'll stick around. Aaron Hall ​Python prof reporting for duty Aaron Hall ​❤ Aaron Hall ​almost top Aaron Hall ​Douglas? Seamus Slack ​Hi @Aron Hall Web Dog ​@Aaron Hall good on you man, it's good to be a top expert at one thing. wish I did that instead of learning 100 langs. BartholomewJS ​You forgot an A there. Aaron Hall ​I diversified my approach until I got hired, but then I went deep. Aaron Hall ​Is arrow like a lambda? Seamus Slack ​@Aaron Hall sorry I don't spell Web Dog ​ya ES6 arrow functions are lambdas (anonymous functions) @Aaron Hall Aaron Hall ​nice, I had forgotten. I need to learn JS more... Xah's page might teach me. 😀 Web Dog ​FP in JavaScript: `Just(5).bind(a => Just(10).bind(b => Just(a + b)))` [Implementation of Just left as an exercise to the reader] Web Dog ​it's the Just monad Aaron Hall ​Just(15) Aaron Hall ​? Web Dog ​yea Web Dog ​Maybe monad Web Dog ​Maybe x = Just x | None abdo esam ​great!! SpinalChamp ​Comment BartholomewJS ​Comment2 This message is held for review. ZitronCrazy ​also a comment Aaron Hall ​Meta question: why not use markdown? BartholomewJS ​@Aaron Hall Don't trigger him. Aaron Hall ​I think pandoc might become standard. Seamus Slack ​Xah is very accomplished programmer, but he is a creature of his time. BartholomewJS ​I personally don't like YAML, TOML and similar ones, at all. I got used to Markdown some time ago and since then pretty much use it 95% of my time writing stuff. abdo esam ​handlebars is popular with node.js abdo esam ​const f1 = y => y(); Moonbase Snails ​like this? Moonbase Snails ​let f = (x) => (y) => { return x + y } abdo esam ​ah got it, sorry i was trying 😀 Moonbase Snails ​which type of emacs for mac do you use? Moonbase Snails ​oh nice me too! Aaron Hall ​closure: when an inner function closes over the variables in an outer function's scope and can later use those variables even when not in the outer function's scope. weeaboo champloo ​you're doing great xah. i just started watching and i thought you said "Clojure" was a programming feature and I was very confused BartholomewJS ​@weeaboo champloo The whole time I have to think about this genius marketing trick made by Clojure. BartholomewJS ​@Xah Lee What's a really common and USEFUL real world example for clojures and returning procs/funcs. BartholomewJS ​? Web Dog ​A closure is just state Web Dog ​way to encapsulate state that lasts forever and doesn't get GC'd (lol) Moonbase Snails ​good show Aaron Hall ​keep the party going! BartholomewJS ​I spelled it wrong, after all. Damn marketing geniuses. BartholomewJS ​You used a function that returns a function within a closure, so I assumed it was useful when used together. BartholomewJS ​@Xah Lee You used a function that returns a function within a closure, so I assumed it was useful when used together. Thomas Wall ​Isn't it just a function and its connection to the surrounding scope's variables? Web Dog ​yeah every class is kind of a closure Aaron Hall ​I like closures and partial functions for callbacks. BartholomewJS ​@Xah Lee Okay show me one of the most common and useful examples for returning a function with a function. Aaron Hall ​in Python, when you're returning a lambda, it's usually a closure. BartholomewJS ​I mean real world example. @Xah Lee BartholomewJS ​Not x+1 = x+1 @Xah Lee Web Dog ​In JS you can do currying a lot easier than you showed earlier: Web Dog ​const add = (a, b) => a + b; const add_5 = add.bind(null, 5); add_5(5); // 10 Web Dog ​real world example of a map? fetch customers from a database and add $5 to each of their balances. BartholomewJS ​@Web Dog That should be indeed a real world process. BartholomewJS ​Goodbye BartholomewJS ​Put money in his pocket to keep @Xah Lee alive. Xah Lee Say something... 0/200