In order for the layout structure to work better then { } I believe the compiler should enforce the tab/space required. In other case it can lead to "issues".
@l2ubio2 жыл бұрын
50:10 anyone knows which tutorial of the Prelude was he referring too?
@Sando8165 жыл бұрын
Thank you for the amazing lectures.
@fiaskolo6 жыл бұрын
Better t-shirt in this chapter.
@hos70124 жыл бұрын
hehehe
@lucagorzog24907 жыл бұрын
I can't find the triangol in my keyboard
@PlerbyMcFlerb11 жыл бұрын
I heard LINQPad's a good interactive c# environment
@amitnadkarni309010 жыл бұрын
for finding last element: lst xs = drop (length xs -1) xs is this right?
@TheTarabyte10 жыл бұрын
Not really. Library last gives you the last element. Yours - list with one or zero elements. last :: [a] -> a lst :: [a] -> [a]
@tomdahulk10 жыл бұрын
No; Your function drops all elements except the last one from the list. You end up with a singleton list if there is one or more elements in the list, and an empty list if there are 0 elements. A confusing edit to your function could get you the last element though--- lst xs = head $ drop (length xs - 1) xs, but as TheTarabyte said, you're better off just implementing it the way ghc does. last [] = error "no last element in an empty list" last [x] = x last (x:xs) = last xs Pattern matching ftw.
@omrikatz21078 жыл бұрын
wouldn't it be easier to reverse the list and get the first elm?
@QuasarRedshift11 жыл бұрын
What I especially like about Haskell is the minimum amount of 'hand-waving' that is required to write down some code; the language dispenses with symbolic noise and goes straight for the jugular! On the other side, making code too 'cute' and compressed makes it difficult to read and it starts looking like APL or J. One day I shall go to a coffee bar and ask for a 'quadruple' instead of a 'double double' and see if they figure it out (nerd joke). Do you actually program in Haskell yourself?
@hakanorskaya6 жыл бұрын
Yeah yeah, i know. Thank you.
@toxicore11908 жыл бұрын
C# now has one :)
@yankumar528010 жыл бұрын
thanks for sharing jasonofthel33t
@chris_sndw11 жыл бұрын
Give love to your code! lol
@MrJC16 жыл бұрын
I know that it would kind of break the rules, and perhaps defeat the purpose somewhere a long the line... but couldn't the functions be grouped into some kind of namespace style of thing, but not exactly... like... i don't know.... algorithms.drop 3... but then perhaps 'algorithms.' disappears when you type 'drop' leaving you with just 'drop 3'. that idea? but then you could get a list of all the algorithms in that group if you didn't know them all... i suppose this could help with the intellisense "problem". ah i dunno, maybe it could just be an optional thing for n00bs.
@metallitech8 жыл бұрын
So haskell leaves out the brackets that are used in maths. Annoying! Why not try to look like the maths that we grew up learning.
@187dv37 жыл бұрын
It's just you current sense of what parenthesis are. In haskell evaluation is right to left instead of the usual reading sense. So f(g(x)) = f g x = f (g(x)) Just do the right to left reading and it makes sense again.
@javierfernandez11266 жыл бұрын
The answer to your question is actually much more interesting. It turns out that one of the most important formalizations of computation is the lambda calculus. In it, function application is modeled not by using parenthesis, but by putting the argument to the right of the function that is going to be applied to it. This way of putting things allows to build "computer programs" out of a notation almost equal to conventional mathematics (it is truly amazing how such a notation could make every posible computer program). Probably you are not interested, but i will leave you a video where that is explained in a lot more detail: kzbin.info/www/bejne/aYe0ZGtohqxgr5Y And also a wikipedia article where all the elements of a computer programming language are constructed out of this formalization: en.wikipedia.org/wiki/Church_encoding
@TavartDukod6 жыл бұрын
@@187dv3 no, it's wrong. f g x = (f g) x, as in lambda calculus. If you want f(g(x)), you should write f (g x).