Exercise 6.2

You Could Have Invented Monads! (And Maybe You Already Have.)

f :: a -> b
f' :: a -> m a
unit :: a -> m a

f' * g' = (bind f') . (bind g')

bind f xs = concat (map f xs)

bind unit xs = concat (map unit xs)

unit x = [x]

bind unit xs
= concat (map unit xs)
= concat (map unit [x1, x2, ...])
= concat [unit x1, unit x2, ...]
= concat [[x1], [x2], ...]
= [x1, x2, ...]
= xs

f' = lift f

lift f = unit . f

unit (or return) can directly act on an ordinary value only, but not on a monadic value. To act on a monadic value, you need to bind it.

How come we do not need to lift return?

f :: a -> b

liftM :: Monad m => (a -> b) -> m a -> m b

return :: a -> m a

(liftM f) :: m a -> m b

(>>=) :: Monad m => m a -> (a -> m b) -> m b

lifeM cannot be applied to return at all.

unit (or return) is neither a pure function nor a monadic function. Instead, it is an half-monadic function, meaning that while its input is an ordinary value, its output is a monadic value.

(bind return xs) -> ys

(bind return) applies to xs.

return applies to x.

liftM is merely fmap implemented with (>>=) and return

— Wikibooks on Haskell/Understanding monads

— Me@2016-01-26 03:05:50 PM

2016.01.30 Saturday (c) All rights reserved by ACHK

More College Advice – GPA

I know this has been discussed before here, but I find Joel’s comments about having a high GPA questionable. I’ve never paid much attention to GPA scores when hiring, except to wonder why some candidates with mediocre GPAs in the 3.0 – 3.3 range brag them up. If anything, I’m interested in people who have quirky grades all over the map due to taking strange, challenging, and diverse courses.

It’s hard for me to believe that people in hiring positions really care much about high GPAs, unless they themselves have high GPAs (ignoring HR drone filters). If so, that’s already a minority. Even in this group, though, especially those with very high GPAs, my experience has been that its not really a factor.

At best, it’s a slight positive in the general hiring world, and can actually count against one when seeking employment, as in Bs don’t hire As. I tend toward very high GPAs myself (3.9 in my just completed graduate work, albeit it’s business strategy).

So I’m curious, does anyone here agree with Joel on this to the extent that the GPA counts (or would count) as important if you were hiring someone? Are you a high GPA yourself? I’m curious if there’s a correlation between high GPA and this attitude.

— Mongo

— Monday, January 03, 2005

You know the old saying, “The world is run by C students”[.]

— ted knight

— Monday, January 03, 2005

From my experience from college (and this is just my experience, so don’t flame me), the people with high GPAs were generally hard working and responsible, while the people with low GPAs were either slackers, people that made excuses (“oh, I had sooo much work to do”) or just not good enough to get high grades. I wouldn’t really want to hire most of the people I knew with poor GPAs. Some were very good, but I wouldn’t trust them to do be responsible and do their job even when things got boring.

I got a 3.91 from a top 10 CS program, and that helped tremendously when I was looking for jobs and internships. Companies were contacting me and asking me to apply, I didn’t have to seek them out. A friend of mine who graduated at the same time as me, from the same program, just found a job recently almost two years after graduating. He said a lot of companies wouldn’t even look at him because of his low GPA.

Other friends decided they couldn’t find a good job, so they’re going to grad school. Well, big surprise, they can’t get into a good grad school either with their low GPAs.

So yeah, I think it matters a great deal. One thing I noticed was that the people that had to pay for college themselves and had to work through college (like me) took it more seriously and got better grades, while those whose parents paid for it oftentimes didn’t care too much, took way too long to graduate, etc.

— sloop

— Monday, January 03, 2005

— The Joel on Software Discussion Group (CLOSED)

2016.01.19 Tuesday ACHK

注定外傳 2.3

Can it be Otherwise? 2.3



對於過去的事,例如,在剛才甲和乙『這次數學考試我不合格,是不是必然』的討論中,當一方說那件事是『必然』時,另一方可以立刻,走深一個層次, 到達下一個『觀測解像度』,把同一件事,說成是『偶然』的;然後,原方又可以再走到,再下一個層次,把那事說成是『必然』的;如此類推。











— Me@2016-01-06 03:17:54 PM

2016.01.06 Wednesday (c) All rights reserved by ACHK