|
shrughes posted:In Coffeescript: Comprehensions in Coffeescript are also not monadic: code:
code:
code:
code:
Look Around You fucked around with this message at 01:59 on Dec 13, 2011 |
# ? Dec 13, 2011 01:53 |
|
|
# ? Apr 27, 2024 12:21 |
|
Well, the first example is more like [ [ (x, y) | x <- [ 0..3] ] | y <- [4..8] ]
|
# ? Dec 13, 2011 02:02 |
|
Vanadium posted:Well, the first example is more like [ [ (x, y) | x <- [ 0..3] ] | y <- [4..8] ] EDIT: wait no.. How so? If it were monadic it would return a [[0,5], [0,6], ...] instead of [[[0,5],[0,6]..][[1,5],...]]] E2: I see what you mean, that still doesn't make sense for coffeescript to do it that way by default... I would expect a list comp to produce a flat list of the results, which in this case is a list of two integers. How would you represent the haskell thing in coffeescript then? Look Around You fucked around with this message at 02:12 on Dec 13, 2011 |
# ? Dec 13, 2011 02:05 |
|
That's just a parsing thing, it's parsing it as ([x,y] for x in [0..3]) for y in [4..8]
|
# ? Dec 13, 2011 02:14 |
|
shrughes posted:That's just a parsing thing, it's parsing it as ([x,y] for x in [0..3]) for y in [4..8] Yeah, I see that, but if it's parsing it like that, there doesn't seem to be a way to get it to parse it the way one would expect it to parse it.
|
# ? Dec 13, 2011 02:18 |
|
I cannot for the life of me understand why it is desirable to have a special case (...) syntax for making the maximum of a range exclusive. It isn't at all clearer to read than simply saying n-1, and it sounds like a typo waiting to happen. This is the kind of thing that drives me nuts about Ruby and Perl.
|
# ? Dec 13, 2011 05:48 |
|
Internet Janitor posted:I cannot for the life of me understand why it is desirable to have a special case (...) syntax for making the maximum of a range exclusive. It isn't at all clearer to read than simply saying n-1, and it sounds like a typo waiting to happen. This is the kind of thing that drives me nuts about Ruby and Perl. While I haven't used whatever that stuff was, using exclusive upper bounds on ranges is great for things like spans of time. There would probably be an object for that which would attempt to do this for you. But anyway here's an example: you have a function that will tell you if a given date and time are considered "off peak" for the eastern us power grid. You want to know how many off peak hours are within a given week, say, the week starting 12/11/2011. Then you can call this function over the range [ 12/11/2011 .. 12/18/2011 ) and there is no ambiguity about the first hour of 12/18/2011.
|
# ? Dec 13, 2011 05:58 |
|
Bozart posted:While I haven't used whatever that stuff was, using exclusive upper bounds on ranges is great for things like spans of time. There would probably be an object for that which would attempt to do this for you. But anyway here's an example: you have a function that will tell you if a given date and time are considered "off peak" for the eastern us power grid. You want to know how many off peak hours are within a given week, say, the week starting 12/11/2011. Then you can call this function over the range [ 12/11/2011 .. 12/18/2011 ) and there is no ambiguity about the first hour of 12/18/2011. I don't want to use a language designed by you. Date literal syntax? And yes, it seems terrible that we have two range syntaxes, when we only need one. Also, somebody decided to take Sinatra, port it to Perl, and call it "RESTful". The result? Mojolicio.us
|
# ? Dec 13, 2011 06:08 |
|
fffffffffffffffffffffffffffffff rest fffffffffffffffffffuck to add: I had a recent run-in with a web2.0 gentleman who blindly asserted things are restful because they are called restful. I think I've long given up on people actually using rest to mean anything other than 'I am a total idiot and I have no idea how HTTP works'. tef fucked around with this message at 07:45 on Dec 13, 2011 |
# ? Dec 13, 2011 07:41 |
|
edit: nm
|
# ? Dec 13, 2011 09:58 |
|
Why I hate strings in c++ on win32 platform...quote:// Convert from string to ULONGLONG.
|
# ? Dec 13, 2011 19:20 |
|
Suspicious Dish posted:I don't want to use a language designed by you. Date literal syntax? I was just writing it in a readable way. Since I didn't know whatever language he was talking about I figured I would show an example where it would be helpful, other than the one you just showed. I'll be sure to keep away from designing languages too, my man.
|
# ? Dec 14, 2011 01:04 |
|
This one threw me for a couple of days code:
|
# ? Dec 17, 2011 05:25 |
|
i barely GNU her! posted:This one threw me for a couple of days Please tell me that the horror is that you didn't realize why you were getting a stack overflow, not that that actually works.
|
# ? Dec 17, 2011 09:51 |
|
yaoi prophet posted:Please tell me that the horror is that you didn't realize why you were getting a stack overflow, not that that actually works. I'm surprised it even compiles. In c++ it would throw an ambiguity error.
|
# ? Dec 17, 2011 20:17 |
|
Yep the C# compiler accepted it just fine. Initially there was only one signature, the first, so I didn't catch the mistake brewing when I refactored it to add the second form.
|
# ? Dec 18, 2011 11:39 |
|
code:
|
# ? Dec 19, 2011 03:00 |
|
npe posted:
That's all kinds of retarded.
|
# ? Dec 19, 2011 04:25 |
|
Well while I'm at it, I should post this one that's in literally every method I can see:code:
|
# ? Dec 19, 2011 06:33 |
|
npe posted:
Is this just about using Exception instead of NullPointerException, or is there an additional horror?
|
# ? Dec 19, 2011 07:14 |
|
If message is null, message.equals(null) will throw a null pointer exception.
|
# ? Dec 19, 2011 07:36 |
|
hepatizon posted:Is this just about using Exception instead of NullPointerException, or is there an additional horror? I'm not an expert but this looks like a NullPointerException to me? Unless C#'s null has an equals method. Which it should. It's almost 2012 dammit. efb of course
|
# ? Dec 19, 2011 07:39 |
|
xf86enodev posted:I'm not an expert but this looks like a NullPointerException to me? Unless C#'s null has an equals method. Which it should. It's almost 2012 dammit.
|
# ? Dec 19, 2011 08:59 |
|
Aleksei Vasiliev posted:That's not C#, if it was it would be Equals. That's not C#, if it was it would be ==.
|
# ? Dec 19, 2011 10:41 |
|
I just had the pleasure of helping someone getting Blowfish to work through PHP's crypt() function. There's just so much I love about this: - The way the documentation forgets to mention that you need to place a $ character at the end of the salted string when using Blowfish - An example of using Blowfish in the comments that uses a salt that's beyond the Blowfish password spec - The way it happily trucks on without any error messages or feedback when you send in a malformed salt ("Let's just fall back to DES, that's secure, right?") - The complete lie in the documentation about the return value ("Returns the hashed string or a string that is shorter than 13 characters and is guaranteed to differ from the salt on failure." - No it doesn't, it just returns a DES hash (Which is 13 characters in size)) I'm not sure if it's mostly the underlying crypt() function's fault, or PHP, but it's a coding horror any way.
|
# ? Dec 19, 2011 11:13 |
|
ymgve posted:I just had the pleasure of helping someone getting Blowfish to work through PHP's crypt() function. Doesn't gen_salt solve all these problems for you? Also, found this on reddit, optimisation on modern CPUs is a horror unto itself http://stackoverflow.com/questions/8547778/why-is-one-loop-so-much-slower-than-two-loops
|
# ? Dec 19, 2011 13:47 |
|
Zombywuf posted:Also, found this on reddit, optimisation on modern CPUs is a horror unto itself http://stackoverflow.com/questions/8547778/why-is-one-loop-so-much-slower-than-two-loops Reminds me of one of the first BASIC programs I wrote as a 11-year-old. I can't even remember the syntax of the language, but the gist of it was like this: code:
It should have "snowed" randomly colored pixels, but in reality the pixels developed on the screen clear, diagonal, bands of color like this: "///". It totally boggled my teacher's mind.
|
# ? Dec 19, 2011 15:19 |
|
yaoi prophet posted:If message is null, message.equals(null) will throw a null pointer exception. Oh ouch. I'll probably be doing poo poo like that if I ever go back to Java from Ruby.
|
# ? Dec 19, 2011 16:45 |
|
Zombywuf posted:Also, found this on reddit, optimisation on modern CPUs is a horror unto itself http://stackoverflow.com/questions/8547778/why-is-one-loop-so-much-slower-than-two-loops That depends on your definition of modern... you'd probably get similar behavior going back to the Pentium Pro (the first OOO superscalar x86 chip).
|
# ? Dec 19, 2011 17:23 |
|
ninjeff posted:That's not C#, if it was it would be ==. It should have been == in Java too. Or maybe it is C#, and equals is an extension method code:
|
# ? Dec 19, 2011 17:37 |
|
Zhentar posted:That depends on your definition of modern... you'd probably get similar behavior going back to the Pentium Pro (the first OOO superscalar x86 chip). CPU prediction logic has got more complex since then, which is what that problem seems to be about.
|
# ? Dec 19, 2011 17:53 |
|
Sedro posted:It should have been == in Java too. Or maybe it is C#, and equals is an extension method
|
# ? Dec 19, 2011 19:32 |
|
Dessert Rose posted:This is probably the horror. If by "horror" you mean "awesome", yes.
|
# ? Dec 19, 2011 20:34 |
|
Dessert Rose posted:If it's an extension method then it won't throw on null - you can call extension methods on null. This is probably the horror. You say this like that statement only contained one horror. The horror density of that little snippet is quite high.
|
# ? Dec 19, 2011 20:57 |
|
Zombywuf posted:CPU prediction logic has got more complex since then, which is what that problem seems to be about. No, the problem is about cache aliasing.
|
# ? Dec 19, 2011 21:39 |
|
i barely GNU her! posted:Yep the C# compiler accepted it just fine. Initially there was only one signature, the first, so I didn't catch the mistake brewing when I refactored it to add the second form. code:
|
# ? Dec 20, 2011 00:21 |
|
Scaevolus posted:No, the problem is about cache aliasing. Well, the first problem is conflict misses in the cache. The graphs they created show capacity misses, which is an unrelated problem. The real horror is microbenchmarking without taking at least one computer architecture course. quote:Every low-level performance related question on StackOverflow should be required to provide MFLOPS information for the whole range of cache relevant data sizes!
|
# ? Dec 20, 2011 01:21 |
|
Null Pointer posted:Well, the first problem is conflict misses in the cache. The graphs they created show capacity misses, which is an unrelated problem. To be fair the compiler designer is supposed to have done that for you.
|
# ? Dec 20, 2011 01:38 |
|
Dessert Rose posted:If it's an extension method then it won't throw on null - you can call extension methods on null. This is probably the horror. You guys are way overthinking this. It's java, it's broken, and this paradigm is everywhere you look in this codebase (complete with matching catch (Exception e) { throw new Exception(e); } every time).
|
# ? Dec 20, 2011 01:40 |
|
|
# ? Apr 27, 2024 12:21 |
|
catch (Exception e) { throw e; } just isn't dumb enough.
|
# ? Dec 20, 2011 01:42 |