These are chat archives for got-lambda/expression

Jan 2017
Erik Heinemark
Jan 26 2017 10:25
Hey, I will be responsible for the meetup tonight. If you are presenter or organizer feel free to come to the office at 17:30.
Jan 26 2017 10:31
@magthe This is why you use PureScript.
Marco Zocca
Jan 26 2017 12:39
oh right, it's at Football Addicts tonight
Suvash Thapaliya
Jan 26 2017 12:44

regarding the JS bit. While it's surprising how it doesn't work as per our intuition, it certainly helps to check the docs and see why it works that way.


and so on. It's the combination of map and optional radix args in parseInt that cause this mess. Docs links below.

Hope that was useful.
@Heinemark see ya later today.
Marco Zocca
Jan 26 2017 13:30
@suvash ok, ok
['10','10'].map(function(x){return parseInt(x,10)})
close enough
still though, lots to type compared to partial application
Suvash Thapaliya
Jan 26 2017 13:40
I'm just glad you aren't questioning the insecurities of a lang. runtime anymore. Reading docs. can be an eye-opener sometimes :D
See ya all later tonight at the meetup.
Erik Svedäng
Jan 26 2017 14:04
@Heinemark will do
Marco Zocca
Jan 26 2017 14:29
@suvash I.. uh. I still don't understand the NaN though
Suvash Thapaliya
Jan 26 2017 15:18
There's a separate discussion to be had on whether this is a reasonable behaviour, but according to docs for parseInt.
  • radix is a value between 2-36 ....
  • if the radix is undefined, 0, or absent, parseInt tries to be smart (hex, octal, decimal based on string prefix)
  • and if the string is not parseable (also in the case of radix 1), then the result is NaN
certainly, it's not something that makes me happy.
Suvash Thapaliya
Jan 26 2017 15:25
Here's a little dig-under-the-hood code.
['10','10','10','10','10'].map(function(){console.log(arguments); console.log("Number of arguments: " + arguments.length); console.log("parseInt("+arguments[0]+","+arguments[1]+") => " + parseInt(arguments[0], arguments[1], arguments[2])); return parseInt(arguments[0], arguments[1], arguments[2]);})