3,009 karma · joined May 6, 2009
Email at <my user name>@gmail.com
We only had 23 years of Python interpreter development,
how would things look like when Python is 42, like C?
C, which I always think of as an ancient venerable systems language, is less than twice as old as Python, which I think of as a hot new kid on the block.In thirty years, when my career will probably be drawing to a close, Python will be 53 years old and C will be 72 years old. Barely any difference at all.
As humour goes, it's a few levels of indirection away from Seinfeld. But you're on a forum full of people who spend all day thinking of abstractions for their abstractions, so what do you expect?
Answer quickly - how much of your net worth would you risk on a bet with 1% chance of a 1000X payout? Now how much would you risk if you can hand off 90% of any loss you take to someone else?
The difference is what we call moral hazard: http://en.wikipedia.org/wiki/Moral_hazard
A great read if you're interested in learning more about the history and operating procedures of the sales & trading side of investment banking is Traders, Guns and Money by Satyajit Das. Its sections on credit default swaps and collateralized debt obligations are particularly interesting when you consider that they were written in 2006, pre-crisis (around the same time that Leveraged Sell Out was getting started, in fact).
In particular, dijit asserted that "Not ACID => Not secure" (which is debatable, but that doesn't matter here) from which you can also validly deduce the contrapositive "Secure => ACID". However, you then (sarcastically) asserted that dijit is saying "ACID => Secure", whereas in fact he said nothing like that.
Source: I used to work in high frequency trading.
The reason it works is that 9998 = 10^4 - 2. You can expand as
1 / (10^n - 2) = 1/10^n * 1/(1 - 2/10^n)
= 1/10^n * (1 + 2/10^n + 2^2 /10^2n + 2^3 /10^3n + ...)
which gives the observed pattern. It breaks down when 2^k has more than n digits, which happens approximately when 2^k > 10^n => k > n log(10) / log(2)
which comes out to 4 * log(10)/log(2) = 13.28 when n = 4.---
Another pattern can be generated from the power series expansion
x / (1 - x)^2 = x + 2x^2 + 3x^3 + 4x^4 + ...
setting x = 1/10^n gives the infinite series 1/10^n + 2/10^2n + 3/10^3n + ...
which leads to the neat fact that 1 / 998001 = 0.000 001 002 003 004 005 006 007...
---Another example is the fraction
1000 / 997002999 = 0.000 001 003 006 010 015 021 ...
which goes through the triangle numbers[0] in its expansion, or 1 / 998999 = 0.000 001 001 002 003 005 008 013 021 ...
which goes through the Fibonacci numbers[1].---
Getting the squares is harder, but you can do it with
1001000 / 997002999 = 0.001 004 009 016 025 036 049 ...
[0] http://en.wikipedia.org/wiki/Triangle_number more (portable and secure)
rather than (more portable) and secureWhich, by the way, is an excellent paper and totally worth reading.
http://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pd...
For example, say we want to write a function to compute square roots. A common approach to computing sqrt(n) is to start with a guess of x = 1.0, and keep replacing x with (0.5 * (x + n/x) until the relative difference between subsequent guesses is small enough.
sqrt n = loop x0 x1
where
loop x y = if converged x y
then y
else loop y (0.5 * (y + n/y))
converged x y = abs (x/y - 1) < 1e-10
x0 = 1.0;
x1 = 0.5 * (1.0 + 1.0/n)
That's good, but it has the test for convergence all mixed up with the logic for generating the guesses. What if we could factor out the code that generates an infinite sequence of guesses? sqrtGuesses n = go 1.0
where
go x = x : go (0.5 * (x + n/x))
Note that this works in Haskell because of laziness, but it's simple in any language that has a mechanism for delaying computations. Now we've decoupled the method for generating a sequence of guesses, we can write a function that checks for relative convergence converge (x:y:rest) = if abs (x/y - 1) < 1e-10
then y
else converge (y:rest)
and define the square root function in terms of these sqrt n = converge (sqrtGuesses n)
The logic of the program is now much cleaner, and we've got a useful function 'converge' which can be re-used in other parts of the program.This kind of 'turning inside out' is often possible in functional languages, often leads to more compact and more compositional code, and is one of the reasons that I enjoy programming functionally so much.
But I expect that in both of them, just like in real life, there is some value to having unspent liquid assets, in that they give you optionality. Unspent liquid assets can be converted at a later time into marines/computing hardware/other 'real' assets, depending on what is most needed at the time. If you turn all of your liquid assets into illiquid assets as soon as you get them, you lose that optionality.
An engineer and an accountant are on a train when they pass between two fields of sheep.
"Boy, there are a lot of sheep in those fields." says the engineer.
"There are 1,005" says the accountant.
"How do you know?"
"Well, there are about 1,000 in that field, and there are 5 in the other one."
He is the creator of 'Actor-Network Theory'. I summarize the introductory paragraphs from Wikipedia, to give you a flavor.
Actor–network theory is an approach to social theory and
research, originating in the field of science studies, which treats
objects as part of social networks. It can technically be described
as a "material-semiotic" method. This means that it maps relations
that are simultaneously material (between things) and semiotic
(between concepts). It assumes that many relations are both
material and semiotic.
Broadly speaking, ANT is a constructivist approach in that it
avoids essentialist explanations of events or innovations (e.g.
explaining a successful theory by understanding the combinations
and interactions of elements that make it successful, rather than
saying it is “true” and the others are “false”). However, it is
distinguished from many other STS and sociological network theories
for its distinct material-semiotic approach.https://github.com/chris-taylor/hs-probability
The code that solves this problem is:
solve = do
coin <- choose (999/1000) fair biased
tosses <- replicateM 10 coin
condition (tosses == replicate 10 Head)
nextToss <- coin
return nextToss
where
fair = choose (1/2) Head Tail
biased = certainly HeadYou'd be surprised at how many people can't answer instantly. Or how many people can't give a convincing description of what a share is, and what rights it gives you.
These are all easy questions, which to my mind is the point. The fact that someone can answer them doesn't tell you much, but if someone can't answer them then you need to think very hard about whether to hire them.
The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is
P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair)
= 0.75
The long answer -Yo want to figure out P(biased | 10H). Using Bayes rule this is
P(biased | 10H) = P(10H | biased) * P(biased) / P(10H)
= P(10H | biased) * P(biased) / (P(10H|biased) * P(biased) + P(10H|fair) * P(fair))
= 1 * (1/1000) / (1 * 1/1000 + 1/1024 * 999/1000)
~ 0.5
and you now compute the probability of the next toss being a head as above.But I can't think of a similarly low-level proof of Fermat's Little Theorem. Is there an obvious one I'm missing?
A jar has 1000 coins, of which 999 are fair and 1 is double
headed. Pick a coin at random, and toss it 10 times. Given
that you see 10 heads, what is the probability that the next
toss of that coin is also a head?
That tests their ability to turn a problem into mathematics, and some very basic conditional probability. Another common question (that I don't use myself) is to ask what happens to bond prices if interest rates go up. "I saw a simple Java question, hit Google, read briefly, then
synthesized an original answer."
Why bother? Instead, I use Stack Overflow predominantly for three reasons --1. To ask interesting questions that I think will get a better answer there than anywhere else (eg [0,1,2]).
2. To help educate other programmers about languages that I like very much, and would like to see in wider use. I endeavour not to just give a "how to do X" answer, but instead explain what the different approaches are, and why some approaches are better than others (eg [3,4,5])
3. To stay in touch and build a reputation among the wider community of Haskell programmers - not by amassing internet points, but by asking interesting questions and giving interesting, thoughtful answers.
If you just game Stack Overflow for imaginary internet points, it's no wonder you don't find it very fulfilling.
[0] http://stackoverflow.com/questions/9190352/abusing-the-algeb...
[1] http://stackoverflow.com/questions/10753073/whats-the-theore...
[2] http://stackoverflow.com/questions/19177125/sets-functors-an...
[3] http://stackoverflow.com/questions/11684321/how-to-play-with...
[4] http://stackoverflow.com/questions/12968351/monad-transforme...
[5] http://stackoverflow.com/questions/20857165/move-or-copy-in-...
(car
(append
'(a b c)
'(d e f)))
Would originally have been written in M-expression form as car[append[(a b c); (d e f)]]
Programming in Lisp might be a very different experience if M-expressions had caught on!