« first day (1741 days earlier)      last day (3429 days later) » 

18:00
He was first a Computer Science professor and now he's the head of the Cognitive Science department.
So I'm going to get my copy of GEB signed by him. My first book signing. =)
Hey could you guys pls look at this question
3
Q: Return 2 variables using bluebird promises

user1692342I am trying to write a promise function using Bluebird library for nodejs. I want to return 2 variables from my function. I want the first function to return immediately and the second to complete its own promise chain before returning. function mainfunction() { return callHelperfunction() ...

@user1692342 I think @BenjaminGruenbaum has that covered. He's the go to guy for promises.
@AaditMShah Yeah, hes not there presently :)
He'll come around eventually. I'll take a look in the meanwhile.
Ok thanks :)
18:04
@AaditMShah that's great news, congrats!
Thank you @AwalGarg.
Hey, could I ask you guys for a favor?
Anything for you baby
I created a resume for myself. Would you please take a look at it and review it?
Thank's @NickDugger.
18:11
nice you're getting your masters?
nice bro me too
@AaditMShah nice. Although I personally won't include Stack Overflow badges in there :/ But I guess that's highly opinionated.
i'd leave em in
worst thing can happen is the employer ignores that section lol
18:14
I don't have education on my resume, and it's highly successful
(I also just don't have education...)
true education is for scrubs anyways
Also @AaditMShah either you spelled your name wrong here, or there :P
i'm working on a BS in comp sci but meh, sometimes it seems like a waste of time
Nah, education is never a waste of time
Even as much as I shit on it
you also shit on everything
18:16
@AwalGarg at least not favorited tags
Yes I do
@NickDugger man, fuck dem edumacashions. Ain't nobody needin that shit.
I don't
@ssube I am ;S
2smart4college
18:17
tru
@NickDugger was a harvard dropout
depends on the education.
If you're not really learning and just doing it for the paper its a waste of time and money.
I was a college dropout, but nothing as lucrative as Harvard :(
They told me I would need to take math courses to become a real developer. They'll be taking math forever... in hell.
Will you guys please stop calling academics "education"?
the math is what kills me
18:18
@Loktar well, now, that depends. I could easily ask for an extra 10-15k if I had a paper saying I was smart.
Maths is great fun!
@AwalGarg no.
> Education - the process of receiving or giving systematic instruction, especially at a school or university.
i just don't have the patience for calculus
Math gets easier. I used to not understand even basic algebra, but now It's pretty easy
math is fun
18:18
@nick you already know lambda calculus
@nick That's when it gets really fun, though.
@Loktar wrong definition is wrong
@AwalGarg Academic a teacher or scholar in a college or institute of higher education.
which can be plural.
18:18
Hi @user1692342 @AaditMShah
Hi @BenjaminGruenbaum
math is fun for some people, and i bet it would be for me too if i tried
@AaditMShah yeah, there was also a reading in the C++ room.
i really just don't care
18:19
I've heard some people say that calculus is easier than algebra
Id agree with that
Math is loads of fun,. once you understand it
@NickDugger Personally, I'd say that is true.
it's probably more interesting
@AaditMShah Awesome, congrats, you're going to have a blast and definitely earned it :)
18:19
@NickDugger It's great fun working out how to do stuff, though.
my algebra is pretty weak, that's probably why i have a hard time in higher math
@user1692342 so, let's talk about your question, you can then the inner promise
@nick I used to spend my free time doing maths, then I came to the Javascript Room.
@BenjaminGruenbaum you are saying use spread or no spread?
*using spread
18:21
@CallumBarclay i fill my free time with just shit
find key list in json using recursive in jQuery
@pramodniralakeri Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
!!> (x => (y * x / (y + x) - x)(47)(17)
@NickDugger "ReferenceError: y is not defined"
@nick I thought that was @NickDugger
18:21
well, shiz
@user1692342 you have return [promiseA, promiseB] right? And you want to execute stuff when promiseA is done, correct
?
@ElliotBonneville same thing
@NickDugger "SyntaxError: missing ) in parenthetical"
@user1692342 then you need return [promiseA.tap(someActions), promiseB]
Shit on an egg
18:22
¯\_(ツ)_/¯
@BenjaminGruenbaum Once promiseA is done, I would like my calling function to know that it is done, once promiseB is completed I want my calling function to know again
!!> (x => (y * x / (y + x) - x))(47)(17)
@NickDugger "ReferenceError: y is not defined"
plis cap
having a hard time, eh?
18:22
currying plis
@user1692342 oh, you want to execute the same function when either one is done?
return [promiseA, promiseB].map(fn) then, calls the same function on both and still runs the next handler when both are done
@BenjaminGruenbaum promise A always gets over first. I do not want to call the function as such.
!!> (x => (y => x * y)(5))(5)
@NickDugger "SyntaxError: missing ) in parenthetical"
@NickDugger 25
@user1692342 I don't understand
18:23
thank jeebus
1 message moved to Trash can
@user1692342 Please don't post unformatted code - hit Ctrl+K before sending, and see the faq.
eyes melt
!!> (x => (y => (x * y) / (x + y) - x)(47))(17)
@NickDugger -4.515625
maths
HAMMERTIME!
18:24
1 message moved to Trash can
@user1692342 Please don't post unformatted code - hit Ctrl+K before sending, and see the faq.
What is the ES6-appropriate way to require nodejs modules?
@RoelvanUden import {stuff} from "moduleName";
import n from './n'?
@CapricaSix I used CtrlK. Did not format :-/
No need to specify path when importing from node_modules
18:25
@user1692342 Use Hastebin, or something :P
import foo from 'foo'
CTRL-A to select all first.
var p = startThisFunction();
someOtherFunction().then(function(data){
    // send 200 ok
    return [data, p]; // now also wait for the second function
}).spread(function(data, data2){
    // @user1692342 like this?
});
import fs from 'fs';
You don't need to reply to CapricaSix, she has no soul.
18:26
@BenjaminGruenbaum Now I am not sure of what you wrote :)
Ahh. TypeScript doesn't like that notation very much, I was guessing I was doing it wrong. Seems like the TS definitions are out of date.
you can also import 'fs' as fs; to match the export syntax
A import fs from "fs" is so verbose, luckily it's a much better idea to import one by one and use destructuring.
What sort algorithm is good if you only want to get N sorted results of a list ?
@RoelvanUden TypeScript uses standard ES imports since 1.5, but yeah lots of out of date headers out there
18:27
@BenjaminGruenbaum Yeah I was doing TS1.5 with ES6 target and it suddenly started moaning.
@BenjaminGruenbaum If you seethe code in my question, I want once promiseA is completed data gets the info, once promiseB is completed data2 receives the info
I wish TypeScript worked with babel, it's so annoying flowtype doesn't compile on windows in practice.
@WillemD'haeseleer myArray.sort().splice(0, n);
@BenjaminGruenbaum they really need to fix that
@ElliotBonneville Doesn't that sort the entire list ?
18:27
@user1692342 I don't understand your notation.
I'd love to use Babel and Flow, but noooope
import fs from "fs"; is not more verbose than var fs = require('fs');
Why would typescript need to work with babel? Use the TS compiler?
@WillemD'haeseleer probably
@WillemD'haeseleer insertion sort, definitely, that way you can start piping the end result to the next stage before you're done too.
18:28
@NickDugger TS can output ES6
@BenjaminGruenbaum in the original post u mean?
Then babel the outputted ES6
@WillemD'haeseleer Heap
I'm not on the same page
In fact, having your TS output ES6 and then turning it into ES5 (or 3) when you need to, means that browsers that do support ES6 can be faster.
18:28
@NickDugger because TypeScript includes much less stuff than babel, which is much more advanced in terms of feature support.
then 5-to-3 the output from babel
Hm... how do you chain together functions generally? Eg:
@BenjaminGruenbaum awesome, thx
function1().function2()
a.b().c().d()
18:29
@WillemD'haeseleer copy's heap suggestion is also solid, it's how typically sorted sets are done, if you need to frequently get the biggest item it's the right data structure.
I glue my functions together. Chains are too heavy.
@rlemon Wasnt I already in it?
@catgocat rlemon is afk: mri
[].map(a => a * 2).reduce((p, c) => p + c, 0)
camera.
  getStream().
  streamTo($video).
  delay(5000).
  destroy().
  end();
18:30
@ssube I used to think that notation was so elegant
I prefer the period at the front, but..
@corvid poor man's DSLs are so nice.
@BenjaminGruenbaum Is it not?
@CallumBarclay not really, no
camera
    .getSteam()
    .delay(5000); //more clear that this line is a continuation of the previous because of the leading period.
18:31
foo()::bar()::pls()
Opinion, of course.
@BenjaminGruenbaum I quite like it, fairly short, scares of script kiddies.
@BenjaminGruenbaum it's ok. Not my favorite, but better than reduce(map([], x), y)
or is the . at the end somehow preventing semicolon insertion?
@ssube that's also kind of backwards, but yeah.
18:33
@ssube Best solution: Pipe operator [] |> map x |> reduce y
or :: lol
I meant like compose(reduce(add, 0), map(multiply(2)), it's what people call "elegant" these days
Proxies can solve that.
@BenjaminGruenbaum Awh hell no. That's a clusterfuck of functions,
kids these days
R.compose(R.reduce(R.add, 0), R.map(R.multiply(2)))([1,2,3,4])
Yeah well, in Haskell R.compose is ., R.add is +, R.multiply is * and currying is automatic.
18:35
Does iojs support import keyword?
It's just considered "elegant" to write "point free".
If you disagree you're not "thinking functionally".
@RoelvanUden probably not without transpilation
@AaditMShah i envy you
guess what on this side :D app gets traction ... app gets traction !
v8 has a pre-harmony era import keyword which is now being scraped
@BenjaminGruenbaum o/
You can substitute node for babel-node though, and it'll transpile your code transparently
And run it
18:38
translate V8 to php
Jeeeeezus motherfucking hell that's fun. TypeScript 1.6 preview, updated definition files, running with babel-node, just to get async/await running. But it works! haha
@AwalGarg it's not "pre harmony"
@RoelvanUden TypeScript works with async/await with babel?
TypeScript works with babel?
Wait what?
Has anyone had any luck with Ratchet? It's a WebSockets for PHP thing.
Typescript -> ES6 -> (babel) -> ES5
@BenjaminGruenbaum umm, what are we calling "previous to ES6 standardization" time now?
18:40
@BenjaminGruenbaum Compile TypeScript code with TypeScript (preview version in dev), which supports async/await, then run it with babel-node to get import working.
async function createAsync(address: string, partial: IPagePartial, previousHtml?: IHtmlDocument): Promise<IPage> {
  let document = await downloadHtml(address, previousHtml);
  let blob = await downloadImage(document);
  return ({image: blob, number: partial.number});
}
This makes me drool :P
babel supports async now?
TypeScript does.
Well, a preview version.
Experimental warnings and all.
babel does as well since a long internet time
class Foo {
    static async bar() {

    }
}
babel has an async/await but it's broken. it outputs some es6/5 hybrid junk
18:42
awesome sauce
async function downloadHtml(address: string, previousHtml?: IHtmlDocument): Promise<IHtmlDocument> {
  return previousHtml ? previousHtml : html.load(await http.getString(address));
}
@Luggage really?
or did a month or so ago when i last tested it
The TypeScript one seems to be perfectly functional
It worked fine last time I tried...
I think @MadaraUchiha used it as well in his gif app.
The TypeScript async/await just makes it a generator that pumps promises. It's really nothing fancy at all. But it works. That's enough for me. :)
it was the bluebird couroutines transform. it output generators, which are es6
@AwalGarg it was during ES6 standardization, not before.
i would have needed to run it throug babel again, but it DID transpile other parts of the code
@RoelvanUden so much cruft there :P
18:44
maybe it's fixed now but someone in the babel channel said it was intentional
so.. useless to me
@BenjaminGruenbaum The end result is beautiful though!
let createAsync = (address, partial, previousHtml) => {
    let document = downloadHtml(address, previousHtml);
    return props({image: document.then(downloadImage), number: partial.number });
};
Look ma, no async function
@BenjaminGruenbaum It's also wrong :-P
let createAsync = (address, partial, previousHtml) => {
    return props({ image: downloadHtml(address, previousHtml).then(downloadImage),
                   number: partial.number
    });
};
18:47
I have the promise-based ones, no worries, I'm just now converting to async/await
What's wrong about it? I'm all about right tool for the right job
@BenjaminGruenbaum ahh, so what is the current status in v8?
function createAsync(address: string, partial: IPagePartial, previousHtml?: IHtmlDocument): IAsync<IPage> {
  return () => downloadHtml(address, previousHtml)
    .then(document => downloadImage(document))
    .then(blob => ({image: blob, number: partial.number}));
}
That was it before :P
@RoelvanUden that's because you don't know bluebird's APIs :P Also you're returning a function there.
@BenjaminGruenbaum I am. I changed the API slightly to suit my needs.
Oh well. Doesn't matter. This is one big playground for me.
Yeah, I'm just being harsh
@BenjaminGruenbaum hmm, I don't understand anything there but looks hopeful ^^
I wouldn't need babel if v8 supported import, so yay, hopeful here too :P
(Or ES5 target for async/await in TS)
They're moving so slow
.net need to step it up
18:53
does var self = this not work the same in es6?
it does
Indeed. So slow. So very slow.
and it doesn't
it works just fine, but the arrow functions have a different context than usual functions
@RoelvanUden they used to move so fast, and then they stopped to make Roslyn, and it's been like 6 years since.
They have so many things to solve in .net (and in TypeScript)
What's the major difference between generators and async? (yield vs await)
18:56
@BenjaminGruenbaum I'm betting they are going for Roslyn to WASM instead, abandon TS. I would cry in a corner.
Roslyn and LLVM integration is pretty much done
@RoelvanUden if they could make that work I'd totally use .net on the client, unfortunately that's very unlikely to actually work without huge overhead.
So LLVM and WASM can do that soon. Yuck.
@NickDugger they do completely different things.
It's actually very feasible. Which is why I hate the idea of wasm to begin with.
@RoelvanUden yeah, but so heavy. I just want them to fix C#, it'd be great if they could come up with a new .net language that fixes C#'s perils but isn't terribly problematic like F#
18:58
Wait, how do you manage the context of this in promises anyway?
Like C# without the cruft and more expressive functions and none of the old things they regret but familiar syntax. It'd still be a .net language so it'd still work with all existing C# code.
It might just be the article that I'm reading is explaining them terribly.
@NickDugger Generators generate things when you need them. So, let's say you want to compute the primes, the generator generates one prime number and returns it, so you can ask for a next one, for infinity. But, we abuse it to generate promises, so effectively creating async/await. But that's not what generators are intended for
@BenjaminGruenbaum What's wrong with F#?
@NickDugger they're orthogonal, the only point of intersection is that generators yield sequences and when those sequences are async values (promises) you can "pump" the generator and wait for them.
18:58
@BenjaminGruenbaum That'd be great too.
@copy lots of things, although I'm optimistic about 4.0.
@BenjaminGruenbaum 4.0 was released on Monday
@RoelvanUden yeah, that's why I brought it up

« first day (1741 days earlier)      last day (3429 days later) »