Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Comment Re:Monads! (Score 1) 536

You've got me interested... but how does it work?

I hate to be the lazy bum, but since it is your made-up notation would you mind adding in the return value checks and pseudo-code for handler calls to allow some better understanding? Feel free to add pseudo-annotations if that helps your cause 8)

Thank you for bringing this up! This topic has certainly engaged me more than any other on slashdot in a few months 8)

Here's a quick example of a monad. It's something that wraps a value where the value can be freely generic while the rest of the type is not.
So let's use the Option monad in scala. It has two important functions called map and flatMap (map and bind in Haskell). All monads have these properties.
If I have val a0 = Some(25); val a1 = None;
map has a type signature of def map[Q, B](f: A => B): Option[B]
flatMap has a type signature of def flatMap[Q, B](f: A => Option[B]): Option[B]
a0.map((b: Int) => b + 5) would become Some(30)
a0.map((b: Int) => b + 5).map((c: Int) => c - 10) would become Some(20)
a1.map((b: Int) => b + 5) would become None
a1.map((b: Int) => b + 5).map((c: Int) => c - 10) would become None
a0.flatMap((b: Int) => Some(b + 5)) would become Some(25)
a0.flatMap((b: Int) => Some(b + 5)).flatMap((c: Int) => Some(c - 10)) would become Some(20)
a0.flatMap((b: Int) => None) would become None
a0.flatMap((b: Int) => None).flatMap((c: Int) => Some(c - 10)) would become None
a1.flatMap is always None
There's other monads that also wrap a value. The Promise monad wraps the result of an asynchronous computation so that the maps and flatMaps are chained asynchronously. The Error monad is the useful monad. Instead of having a Java function return a value through the return type or an exception through the throws clause, both return and exception values could be returned through the return type. The error monad is most similar to the option monad, which is called the anonymous exception sometimes. But the error monad doesn't have a zero so it's not quite the same as the option monad with zero of None, or the List monad with the zero of empty list.
Every List is a monad as it's a structure that wraps a generic value. The value just happens to be indeterminate.
Monads are just a way to chain events sequentially without having to deal with the background implementations of the structure we're dealing with.

Comment Re:The Department of Redundancy Department (Score 1) 628

Can we study the same things in other departments without having a dedicated Computer Science niche to go with Computer Engineering, Software Engineering, etc.?

Not in sufficient depth, at least in my opinion. Complexity theory? Database theory (yes, theory, not just "here's how to write a simple SQL statement)? Compilers? These could all be in other departments, but an undergrad pursuing a degree in another field will not have enough time to study computer science in any respectable depth. Double major is not the answer if CS is spread over more than two other departments. Spreading CS across math and engineering departments deprives students of the chance to become computer scientists.

I'd like specifics. Which department should handle a compiler? Compilers bring in regular expressions for the syntax, create a parse tree for the semantics, and transform that parse tree into an intermediate pseudo assembly translation and then into the native machine code. I wouldn't trust mathematicians to understand the coding work, I wouldn't trust engineers with the coding work either. Which department should handle database courses? Entity relations, foreign key maps, many-to-many relationship tables, object relational mappers, triggers, and authorization schemas are something that most business departments don't have the technical ability to deal with. A business major acquaintance struggled to understand primary keys using MS Access. How do you plan on the business department to teach PostgreSQL, MySql when most of their students don't have the capacity to learn these DBs and aren't their for their primary purpose to learn new DBs. Which department should teach version control systems? Engineering is mostly pen and paper, mathematics is mostly pen and paper. It's only computer science where application code is built and has the foresight to provide students with version control tools so that the student can understand. Web frameworks and web languages....Once again, business departments don't have the capacity to understand the difference between a POST request and a GET request.

Comment Re:That is what you get with fanboys (Score 2) 175

Somewhere at Google is a Java fanboy, they do far to much mission critical stuff in it (while still developing their stuff) for it to be anything but a fanboy reasoning. They even generate their javascript by writing java instead. No people, javascript is NOT a bad language, it is just a different one that requires a different mindset. Writing a program to be able to generate code for one language in another SCRIPTING language... that is just insanity.

And as has been pointed out, turning Linux into a java only platform is just insane as well. One of the major strengths of Linux is it wide coding support, why on earth would you limit it to just Java a language owned by a rather dubious company before and after (Sun's handling was just as insane) over the countless truly free alternatives? By all means let developers develop in it if they want to but keep your options open.

No, a fanboy exec has declared Java to be the way and business logic be damned.

Meanwhile Apple has forced developers to learn their own language and has the more healthy market. Go figure. Where is the java advantage?

Compile time type checking helps with large applications to reduce the amount of errors. Javascript is an interpreted language with dynamic types and it takes more work to write the application libraries as the application grows. It's not really insane to use a compiler to write javascript if it helps in error reduction.

Comment Re:The problem here... (Score 2) 672

...is that the scientific allegation of spontaneous generation of life has never been proven. Do we have proof of evolution? Most definitely so. Do we have proof that mixing together chemicals creates life? Nope.

Ergo, until that is done repeatedly under laboratory conditions, atheists, your theory of the origin of life remains exactly that. A THEORY.

We have evidence of evolution and we have evidence that that mixing molecules together can create organic molecules. It wasn't long ago that chemists thought that organic molecules were somehow special and too complex to create by man. That theory turned out to be false. The evidence we have for evolution is in the fossil record. Fossils aren't continuous data collections, but snapshots left in time. Many fossils get destroyed before they get preserved. But evolution is a framework that explains common features between us and other primates, between us and cats, between cats and lions. Creationism does not explain why us and other primates look similar other than possible that God lacks an imagination. Young earth creationists also can get challenged by astrophysics and geology as there's evidence of an older planet, star, and universe than what creationists as the age of our planet.

Comment Re:Teaching kids to think requires controversy (Score 5, Insightful) 672

Try talking to a smart Catholic who can cite Aquinas at the drop of a hat: they can make scientists look like imbeciles because very, very, VERY few scientists have a shred of knowledge about how to debate.

Why should scientists be impressed by someone that can cite Aquinas? Are scientists supposed to care what St. Thomas Aquinas thought when discussing evolution?

Comment Re:end the debate (Score 1) 241

start using 366 degrees for a circle, its a lot more precise, and makes pi solvable

Degrees are an arbitrary unit to divide a circle. It has nothing to do with PI. Units of degrees break when doing calculus because the unit isn't a natural unit to put into cosines and sines. Sines and cosines (and e^ix) take as arguments units of numbers. I still don't get what you mean by making PI solvable. There's nothing to solve about PI. It just happens to be the number that relates Diameter and circumference of a circle.

Comment Re:No null pionters (Score 1) 232

I thought that null pointers are necessary in order to terminate a linked list. What you want to avoid doing is dereferencing a null pointer as this is a very bad thing. At least, this what I rememebr from Comp Sci 102. How else can one terminate a linked list other than creating a tag labeled "end" ?

You can use the Maybe monad to terminate things. case Some(x) => x case None => doNothing() The Maybe monad is type safe and forces the developer to handle nonstandard expectations. When used as a return value, it also specifies that the developer should handle when the function didn't break.

Comment Re:*Yawn* (Score 2) 157

That, and they'll be shifting back once they see what godawful disaster Scala is in terms of linguistic complexity.

Note to Lift library developers: implicits to implement CSS-style selectors and replacements in snippets is even less cool than C++ operator overrides.

The Play Scala framework provides a better web framework. It's more natural to understand. I do agree that Lift wasn't intuitive (although I may go back to it at a later point in time). I disagree with the linguistic complexity. A lot of Scala borrows from FP paradigms and FP attempts to reify programming patterns that are experienced throughout a programmer's life. I don't understand what your criticisms towards Scala are considering Scala is more than just Lift.

Comment Re:News? (Score 2) 362

This is wrong. A research article just came up on Metafilter. Apparently, in a double blind experiment where both the musicians and the listeners are listening to pieces, the newer instruments sound better. The Stradivarius sound seems to be a human perception similar to wine tasting myths. http://www.npr.org/blogs/deceptivecadence/2012/01/02/144482863/double-blind-violin-test-can-you-pick-the-strad?sc=fb&cc=fp

Comment Re:Uh oh. (Score 1) 423

Nullification is a jury ignoring the law in favor of their personal preferences. That is not what a jury is there to do. They are not charged with weighing what the law says, only whether it applies and whether the defendant is guilty of it. If nullification is used, then the defendant goes free and nothing is changed. The next guy who breaks that unjust law might not be so lucky. That's not justice. "The system" has the appellate process for determining the rightness and wrongness of laws. The only way to change a wrong law from the jury box is to vote to convict so that the case can be appealed up the chain.

You know it was used as a last resort to prevent union strikers from going to jail merely for being union strikers. During the 1930s, police would harass and beat socialist protesters for expressing the view that the government needs to intervene in the economy. It's not justice to have the government arrest you for expressing a dissenting opinion and jury nullification was used as a form of judicial protest against overbearing states.

Comment Re:I have problems with this (Score 1) 1319

How is a multiverse intuitive over probability densities? Not every event is equally likely. If there's an eighty percent chance for an electron to tunnel through a barrier, it's not very intuitive to state that there were eight universes created where the electron tunneled over the two universes where the electron did not tunnel. Some quantum mechanical probabilities involve square roots so even fractions are tossed out the window when trying to describe quantum mechanics in a multiverse model. Please correct me if I'm wrong, but a multiverse explanation of quantum mechanics seems to take away from a full understanding of quantum mechanics.

Comment Re:The real problem.... (Score 1) 463

Bear in mind that the situation is bad for only the bad programmers. When I did computer science, there were people in computer science that could not write code and had no passion for the subject. My co-intern was terminated after three months because she couldn't install an OS from disk and the only language that she had worked with previously with Visual Basic. One of my friends was my group project partner and I cringed when I saw him write for loop increment counters as class member variables. These are the people I'm competing against and I feel somewhat safe knowing that the universities are producing CS holders that are garbage in the workplace.

Slashdot Top Deals

Happiness is twin floppies.

Working...