I just started to learn Haskell today and is completely overwhelmed by its syntax.
I am trying to apply math calculation to a list of items.
For example, lets say I want to square every item in the list using list comprehension.
My attempt
myfunc (n:lis) = [ k | k <-lis, k == k^k]
result_list = myfunc[1..]
take 10 result_list
My understand of my myfunc code: take a list and loop through elements that is stored in variable k and set k equals to its square.
after i execute the take command, and hit enter, apparently the process is running but does not do anything.
Note that i want to use list comprehension as a way to do it. I can use map do achieve my goal already.
k == k^kmeans "k is equal to its own kth power" (it's a boolean condition). There aren't many such numbers out there, and your function just happens to skip the first and only one, so there's no output.(n:lis)equivalent of Java's(for var in array)?[k^2|k<-lis].