Bp and rds.b are yielding 8 percent now, and they look tempting. Low oil prices have been around for more than a year now, but they don't seem to have cut dividends at all in that time.
Is there any general opinion that they will in the short term? That huge dividend yield does look very good at the moment...
Here's a video of the recent NZ meteor explosion. It flashes white and lights up the entire sky.
What is happening to cause it to momentarily glow so bright? The obvious answer is something like "the heat of reentry causes the meteor to break up and it's heated to incandescence" , but that doesn't explain why it is momentary or describe the mechanism that makes it such a bright single flash.
I've always wondered how functional languages handle DP and memoization. (I'm specifically talking about coding them recursively, not reformulating them to be "bottom-up")
In Haskell the problem is automatically taken care of :
The language's lazy eval system will remember function calls and results (because like math there is no reason two calls to the same function with the same inputs should be different).
I've looked online for how people do it in F# and all I see is exactly the same as regular imperative code : make a dictionary, and add results to it.
Is it possible to do memoization in a functional language without the compiler/runtime/machine hiding the state-tracking for you (
I read from several sources that without oceans there would be no plate tectonics. It's not intuitive that a tiny thin layer of water would affect the motion of plates driven by a gigantic 3 thousand mile thick mantle :/
I'm practicing with a problem that gives text input on stdin and wants output on stdout.
They give an integer T in the first line that I read, and then T lines follow. For the T following lines I have a function that takes an integer and returns an integer that I must print. So my output should be T lines.
I'm stuck at this point:
main = do
strcases <- getLine
map (calculate) [1..(read strcases)]
calculate _ = do
strp <- getLine
print $ addone (read strp)
addone x = x+1
Of course this doesn't work at the moment. Can you show how to print the T lines of output?
I was just curious about the type of bind composed with bind and wanted to see if I could get to it on paper as an exercise.
GHCI tells:
(>>=).(>>=)
:: Monad m => m a -> (m b1 -> (a -> m b1) -> b) -> (a -> m b1) -> b
Can you walk through how to get that?
Here is where I get stuck:
(>>=) :: m a -> ( (a -> m b) -> m b )
That means ( (a -> m b) -> m b ) is the first argument of the second >>=. But what type is the second argument of the second >>= ?