Off Topic > Off Topic

Programming Megathread

Pages: << < (62/241) > >>

Pecon:

Haskell bothers me. I once got into a really in depth argument with another programmer who used Haskell about it. They were really trying to push a point saying that Haskell offers a syntax that is somehow so so much better than C-like syntax, and that everyone who used C-like languages were stabbing themselves in the leg.

Personally I can't make any sense of it. It's just a bit too different and I'm not willing to put the effort into trying to learn something that is different on so many different fundamental levels.

SetGaming:


--- Quote from: Pecon on January 17, 2016, 11:00:37 PM ---Haskell bothers me. I once got into a really in depth argument with another programmer who used Haskell about it. They were really trying to push a point saying that Haskell offers a syntax that is somehow so so much better than C-like syntax, and that everyone who used C-like languages were stabbing themselves in the leg.

Personally I can't make any sense of it. It's just a bit too different and I'm not willing to put the effort into trying to learn something that is different on so many different fundamental levels.

--- End quote ---

The problem I have with it is that I'm so used to computers not having an "arrow" looking syntax, where you do stuff like


--- Code: ---var foo -> 40
--- End code ---

instead of:


--- Code: ---var foo = 40
--- End code ---

if you get what I'm saying. I'm so used to working with really low leveled stuff - symbols like that don't make sense, as usually you won't want to waste time by making it read over a string of "this comes after this".

That's just my ideas - maybe I'm way off what you're saying, and I'm confusing Haskell with another language.

Scars75:


--- Quote from: Pecon on January 17, 2016, 11:00:37 PM ---Haskell bothers me. I once got into a really in depth argument with another programmer who used Haskell about it. They were really trying to push a point saying that Haskell offers a syntax that is somehow so so much better than C-like syntax, and that everyone who used C-like languages were stabbing themselves in the leg.

Personally I can't make any sense of it. It's just a bit too different and I'm not willing to put the effort into trying to learn something that is different on so many different fundamental levels.

--- End quote ---
I'm not too knowledgeable on Haskell yet since I'm still learning the basics, although I definitely wouldn't say that using C-like languages over Haskell is shooting yourself in the foot. Honestly the whole reason I'm learning Haskell is because it is so different from anything else I've done. Other than how interesting it is to me, I get to learn a whole new way of thinking about programs that I can apply to other code I write.

--- Quote from: SetGaming on January 18, 2016, 12:17:53 AM ---The problem I have with it is that I'm so used to computers not having an "arrow" looking syntax, where you do stuff like


--- Code: ---var foo -> 40
--- End code ---

instead of:


--- Code: ---var foo = 40
--- End code ---

if you get what I'm saying. I'm so used to working with really low leveled stuff - symbols like that don't make sense, as usually you won't want to waste time by making it read over a string of "this comes after this".

That's just my ideas - maybe I'm way off what you're saying, and I'm confusing Haskell with another language.

--- End quote ---
I kind of see what you're saying, although operators with multiple characters in them aren't really unique to Haskell (++, +=, ==, >=, etc in lots of languages, and even -> in C++). Arrows in Haskell aren't used like in your example (you would just type foo = 40), but when they are, it makes a whole lot of sense. For example, foo :: Int -> Int defines foo as a function that takes an Int and returns an Int.
The closest thing in Haskell to your example would be something like this, which just prompts for input then prints it out:

--- Code: (Haskell) ---main = do
    foo <- getLine
    putStrLn foo

--- End code ---
You use <- here because Haskell makes a clear distinction between pure code and code with side effects, like I/O. foo <- getLine runs the getLine IO action then binds the result to foo. If you typed foo = getLine, it would just make foo an alias for the getLine function.

Becquerel:


--- Quote from: Scars75 on January 17, 2016, 10:05:26 PM ---Currently learning haskell and it's a lot of fun. You should add this to the OP:


--- Code: (Haskell) ---main = putStrLn "Hello World!"

--- End code ---

Here's a quick implementation of quick sort just for fun:

--- Code: (Haskell) ---quickSort :: (Ord a, Eq a) => [a] -> [a]
quickSort [] = []
quickSort (x:xs) = smallerList ++ [x] ++ largerList
     where smallerList = quickSort $ filter (<=x) xs
              largerList = quickSort $ filter (>x) xs

--- End code ---

--- End quote ---
adding
please hold

--- Quote from: SetGaming on January 18, 2016, 12:17:53 AM ---The problem I have with it is that I'm so used to computers not having an "arrow" looking syntax, where you do stuff like


--- Code: ---var foo -> 40
--- End code ---

instead of:


--- Code: ---var foo = 40
--- End code ---

if you get what I'm saying. I'm so used to working with really low leveled stuff - symbols like that don't make sense, as usually you won't want to waste time by making it read over a string of "this comes after this".

That's just my ideas - maybe I'm way off what you're saying, and I'm confusing Haskell with another language.

--- End quote ---
yeah thats what i hate about PHP alongside the __construct method
I really perfer = than ->


Foxscotch:


--- Quote from: Foxscotch on January 17, 2016, 01:02:59 AM ---I have decided to create a userscript to provide functions and classes to make it easier to create other userscripts

--- End quote ---
latest cool thing it does: creates an event that is dispatched to the document when it's finished. this way, a script using this userscript can just do something like this:

document.addEventListener('utilsFinished', function () {
    console.log('Session ID: ' + window.sessionId);
});

instead of the user having to worry about load order -3-
I'm probably going to change the name of the event when I come up with a better name for the userscript. right now it's just "BLF Userscript Utils" which doesn't sound super great, nor can it be shortened to something cool

Pages: << < (62/241) > >>

Go to full version