That is, if every child getting a decent schooling is what you want.
228 karma · joined December 20, 2010
That is, if every child getting a decent schooling is what you want.
"During the past 30 years, the one-third decrease in the average salt intake has been accompanied by a more than 10-mm Hg fall in the population average of both systolic and diastolic blood pressure, and a 75% to 80% decrease in both stroke and coronary heart disease mortality in Finland."
By my observations, pedagogy is considered one of the most applied sciencies taught in university and I would say that it attracts the least academically mind of those applying in university.
There is nothing ridiculous about a hard drive breaking between backups. There are situations where loosing all data after latest backup would be, if not unrecoverable, at least extremely irritating. Having redundant drives in a laptop might not be feasible, but dedicated workstations are still used in many places.
> If you really are going to immediately purge some critical data from its source location 1.5 seconds after fsyncing to your drive, you should be sending it to multiple locations and waiting for confirmation containing a valid checksum before considering the write a success.
Which is exactly what ZFS/btrfs in a mirrored RAID configuration does.
1. Insert new User instance 2. Unique constraint violation? Tell user that the username is already registered.
class Into a b where
into :: a -> b
Note that From would be the exact same class. I guess the distinction in Rust is relevant because of ownership.That beeing said, mass teaching like we do it might not be the best thing. We have tools to facilitate teaching that for example does not require everyone to be at the same physical location. Those same tools could also be better utilized in work to enable remote work. Which would then mean one less life skill to teach at school.
Also, because function signatures are never infered in Rust, mistakenly adding or forgetting the last semicolon will always result in a type error.
getLine >>= putStrLn
case by doing greet name = putStrLn ("Hello, " ++ name)
main = getLine >>= greet
(Edited to include the definition of main)You could implement the persistent data structures even in C. Being persistent is a matter of API, not implementation. But actually, Clojure's deftype creates immutable fields by default, so you do get the Java like final semantics (that is, you can't set the fields even though they are public).
The main reason why protocols differ from interfaces in Java or type classes in Haskell is because Clojure is a dynamically typed language. Protocol inheritance would have very little value as knowing that a monad is a functor is quite useless if you don't even know if something is a monad.
Macros don't really need polymorphism. The macro can always expand to a polymorphic function call or it can pass the s-expression to a polymorphic function.
You can actually implement the sequence interface for your own types too. But it is unfortunate that it is an interface, not a protocol, and the documentation for implementing it is nowhere to be found. What is available are functor and monad abstractions, in the contrib library.
FP languages have different ways to inject new behavior. You could for example define a function a -> (a -> Int) -> Int. This function now works for any type for which you can also provide the "interface" a -> Int.
doDishes [] = done
doDishes (dish:dishes) = clean dish >> doDishes dishes
Very much a recursion in my opinion.Recursion can cause stack overflow in lazy language too. But lazy or strict, that's more of an implementation detail although a very visible one. An iteration that appends to a list will run out of memory just the same. I also don't see how a recursion that runs out of stack space is any more dangerouse than an iteration that goes to an infinite loop.
I would argue that we use recursion quite a lot. For example, here's how clean a bunch of dishes. If the bunch is no more, your done. Otherwise, take a dish and clean it. Then clean the rest of the dishes like you did with the first one. We often leave out the end condition as it is often clear from the context.
I'm not advocating a deep knowledge of math as I know from experience that it has very few applications in software development. But to me a professional is someone who is not just skilled but knows the history and fundamentals of his trade. He knows not just that for (i = 10; i > 0; i--) terminates but also has an idea why that is so (and what it means that a program terminates).
Why would recursion be any more dangerous than iteration?
Simple recursions work exactly the same as the equivalent iterations. They branch on a condition, execute a step and repeat. How state is handled is the key difference. As Haskell has no concept of a variable, the only way to rebind a name is to recall a function.
I was going to say that a professional in our field who has problems with recursion and the basics of discrete math should take a look in the mirror. But maybe we have managed to raise the abstractions high enough so that one can be productive without knowing the fundamentals of computing. I probably need to broaden my concept of a professional in our field.
compose :: (b -> c) -> (a -> b) -> a -> c
compose f g x = f (g x)
I'm not sure about the math curriculum in USA but in linear algebra you have functions that operate on functions. return call(a, r, g, s)
It is also very simple to test if the compiler does TCO. Just write def f(a):
return f(a + 1)
f(0)
and wait for a stack overflow.