11 ms·
Prime Minister of Singapore Coded Sudoku Solver in C++
- devnonymous 12y agoThe relevant excerpt from the speech: 40 years ago, after doing a math degree, I went on to study computer science, on my father’s advice. He said there is a future in that, and he was right. So for the Smart Nation Programme Office, I have put Minister Vivian Balakrishnan in charge, reporting to me. Vivian is both a hacker and a dabbler – He used to be an eye surgeon but since he does not get to operate on eyes nowadays, he dabbles in building simple robots, assembling watches, wireless devices and programming apps. His day job is to be the Minister for the Environment and Water Resources, and so when he builds apps, he uses the real time APIs generated by the Ministry. That’s called user-testing. I used to enjoy this; it is a long time since I’ve done anything. The last programme I wrote was a Sudoku solver in C++ several years ago, so I’m out of date. My children are in IT, two of them – both graduated from MIT. One of them browsed a book and said, “Here, read this”. It said “Haskell – learn you a Haskell for great good”, and one day that will be my retirement reading. What's amazing is not just the bit about having written C++ code but the fact that he used the term hacker propely and knows what Haskell is. Interesting.
- peterkelly 12y agoStarts at 8:40
- creamyhorror 12y agoAs a Singaporean, I'm pretty proud of the direction of my government, and I'm pretty surprised by the Haskell/LYAHFGG & C++ namedrops. How did Minister Balakrishnan even find the time to dabble with hardware and programming? These top civil servants are very, very busy! Great quote about Singapore citizens trusting the government to do their taxes: "...we introduced electronic tax-filing back in 1998, since ages ago, before anyone else did it, and today, 97% of tax payers file their taxes online. Because we have kept our tax code simple, you do not need to buy Quicken, Intuit or any of such things. Also, because we have automate the collection of information and populate the table for you, you do not need to work quite so hard – it is a little harder to cheat and so 3 in 5 taxpayers do not even bother about filing taxes. They just take in on trust that our Inland Revenue Authority of Singapore has done their sums right. So e-Government works in Singapore." That said, the 3 verticals of the whole Smart Nation programme (the elderly, transport & data) seem somewhat orthogonal to much of the SV-style explosive-growth consumer apps. Yet those consumer-app areas are where many SV-style fortunes are made and where young tech entrepreneurs want to go - so there's a disconnect between the two directions. For example, I don't see massive adoption of a new app/device by the elderly happening very easily - they largely (1) don't know English, (2) aren't used to relying on tech so heavily, and (3) won't be able or willing to pay much for it. It tends to be younger people who try new things - and in fact Singaporeans are relatively less adventurous than Americans or other Asian cultures in adopting new apps/services. Things might be different if Singapore were as big as the US, but it isn't. So I wonder how the Smart Nation thing will play out - maybe the biggest customer will be the Singapore government instead of end-users. (Tangentially, it's personally been a bit frustrating that the VCs that draw on government money seem to prefer e-commerce/B2C apps instead of industry-specific B2B software. The government puts its money where its mouth is, but still relies on VCs to make the picks...and those guys go for hot, mainline trends. So fundraising has been difficult.)
- visakanv 12y ago> How did Minister Balakrishnan even find the time to dabble with hardware and programming? These top civil servants are very, very busy! He blogs quite a bit about it here: http://vivian.balakrishnan.sg/ http://vivian.balakrishnan.sg/
- 2Pacalypse- 12y agoHow did he even find the time to blog quite a bit about it? That's amazing!
- Cephlin 12y agoIt's called not being over worked like a slave.
- saiya-jin 12y ago(work) life is about priorities, and if he really wants to give back in this way, he can apparently delegate enough stuff to achieve it. Probably all politicians can, if they wanted... I wish more (all!) countries would have similar people put into places of real popwer in governments.
- nitrogen 12y agoIs the blog itself also delegated? I've seen CEOs send out "personal" notes that were drafted entirely by a PR team.
- jwiley 12y agoWonder if you have FoxNews or a similar variant in Singapore? Do they characterize the Prime Minister as a professorial egg-head elitist out of touch with the common man? If not you have something to look forward to, in the early days of our republic, we generally appreciated educated statesmen. Now we prefer our elected officials to be fun-loving guys next door who see the internet as a system of tubes.
- visakanv 12y agoHis son Li Hongyi was a product manager at Google: https://www.linkedin.com/pub/hongyi-li/30/832/161 https://www.linkedin.com/pub/hongyi-li/30/832/161
- creamyhorror 12y agoWell, since you've opened the box...[edit: oops, I posted the younger son's profile instead of the elder's] his younger brother is quite prolific on Github (and seems to favour Scala): https://github.com/lihaoyi https://github.com/lihaoyi [Thanks for the correction raingrove]
- raingrove 12y agoWrong person. This is the correct profile: https://github.com/fynyky https://github.com/fynyky Nevertheless, his project "reactor.js" is impressive.
- boothead 12y agoI think Dad might be taking a bit of flack until he picks up a Haskell book with these two in the family :-)
- dheera 12y agoIt's funny you're all surprised. I know him as a fellow classmate at MIT, not as a political figure. That said I'm glad he's free to pursue his passions as a free-thinking individual and not pressured to do what his ancestors do.
- shadowsun7 12y ago14th author: http://research.google.com/archive/spanner.html http://research.google.com/archive/spanner.html
- reactor 12y agohttp://vivian.balakrishnan.sg/2015/03/13/Open-Source/ http://vivian.balakrishnan.sg/2015/03/13/Open-Source/ Interesting..
- tacostakohashi 12y agoDifficult to take seriously with so many gratuitous hashtags that aren't actually links to anything.
- ValentineC 12y agoIt seems that whoever was in charge of updating his blog (which is hosted on GitHub Pages [1]) forgot to remove the hashtags from his Facebook Page post [2]. [1] https://github.com/VivianBalakrishnan/VivianBalakrishnan.github.io/blob/master/_posts/2015-03-13-open-source.md https://github.com/VivianBalakrishnan/VivianBalakrishnan.git... [2] https://www.facebook.com/media/set/?set=a.10152609593346207.1073741922.30332546206&type=1 https://www.facebook.com/media/set/?set=a.10152609593346207....
- rustsucks 12y agoWow - this story ticks so many tick boxes for HN readers: 1. An important person who can code - for all those who moan that those in power do not understand tech at all. 2. He used C++ - for all the rust-tards and c++ haters 3. He mentions Haskell - for the fp buffs claiming it is the one true way.
- venomsnake 12y agoAnd for every one of these we have 100 Dianne Feinstein-s and Joe Bidens
- mohawk 12y agoGeneralising a bit, it seems to me that in Asia a lot of political leaders come from engineering, whereas in the US and Europe many come from the humanities, especially law.
- venomsnake 12y agoI have indeed noticed a tendency in the West lawmakers to believe that when human and nature laws collide, human laws should win ...
- deleted 12y ago[deleted]
- TheOtherHobbes 12y agoPolitically, humanity's physical environment is considered exterior and stable, but the social environment is almost infinitely plastic and easily influenced by persuasion and rhetoric. So human politics is far more obviously powerful than science. It's been a good-enough approximation for most of history, even though in practice it's completely wrong. Politics is badly in need of a Copernican revolution which puts the physical world at the centre of politics, not the periphery.
- mercurial 12y ago
- ronyeh 12y agoJump to the sudoku solver section: https://www.youtube.com/watch?v=49YeHvJ6yZg&t=9m33s https://www.youtube.com/watch?v=49YeHvJ6yZg&t=9m33s
- johnlinvc 12y agoHe got Cambridge Diploma in Computer Science. [1]http://en.wikipedia.org/wiki/Lee_Hsien_Loong#Background_and_education http://en.wikipedia.org/wiki/Lee_Hsien_Loong#Background_and_...
- sh33mp 12y agoHe also published a paper on economics quite a while back (http://www.jstor.org/discover/10.2307/1882634 http://www.jstor.org/discover/10.2307/1882634) on externalities. Not surprising, given the proactive Singapore government.
- mali_budo 12y agoMy father, a machine engineer, built a wooden chair out of oak last week
- shadowsun7 12y agoThis isn't that surprising. Lee Hsien Loong studied at Trinity College, Cambridge, where he was Senior Wrangler, and graduated with a first class honours in mathematics and a Diploma in Computer Science (with distinction). He's mentioned in the past that he briefly considered a career in academia (Mathematics). That didn't happen, of course. (source: http://www.moe.gov.sg/media/speeches/2003/sp20030603.htm http://www.moe.gov.sg/media/speeches/2003/sp20030603.htm)
- sh33mp 12y agoThat's 40 years ago. I think it is surprising that a man as busy as himself has had the time to pick up this hobby on the side.
- visakanv 12y agoHe also puts a lot of effort into the photos he posts on Facebook, which are remarkably well-composed: https://www.facebook.com/leehsienloong https://www.facebook.com/leehsienloong
- Osmium 12y ago> where he was Senior Wrangler For those unfamiliar with the term, this is a huge achievement. http://en.wikipedia.org/wiki/Senior_Wrangler_(University_of_Cambridge) http://en.wikipedia.org/wiki/Senior_Wrangler_(University_of_...
- deleted 12y ago[deleted]
- rurban 12y agoI edited the wikipedia entry to include that even a prime minister was Senior Wrangler not only leading mathematicians and physicists. Good career prospects. I can only think of recently killed Russian opposition politician Boris Nemtsov with similar mathematical achievements. Angela Merkel (Kasner) also won a mathematics price during her physics doctorate studies, before she elected to work in agitprop and most likely as master stasi spy under the codenames ANITA and Black Widow. Which brings me to the theory that being a spy will help you more getting to a prime minister job (Putin, Merkel), than being an excellent mathematician.
- kszx 12y agoCambridge professor about Lee Hsien Loong: "No, he was truly outstanding: he was head and shoulders above the rest of the students. He was not only the first, but the gap. I think that he did computer science (after mathematics) mostly because his father didn’t want him to stay in pure mathematics. Loong was not only hardworking, conscientious and professional, but he was also very inventive. All the signs indicated that he would have been a world-class research mathematician." "I’m sure his father never realized how exceptional Loong was. He thought Loong was very good. No, Loong was much better than that. When I tried to tell Lee Kuan Yew, “Look, your son is phenomenally good: you should encourage him to do mathematics,” then he implied that that was impossible, since as a top-flight professional mathematician Loong would leave Singapore for Princeton, Harvard or Cambridge, and that would send the wrong signal to the people in Singapore. And I have to agree that this was a very good point indeed." http://therealsingapore.com/content/cambridge-professor-lee-hsien-loong-could-have-been-outstanding-mathematician http://therealsingapore.com/content/cambridge-professor-lee-...
- dengnan 12y agoJust one nitpick: his family name is Lee. Loong is just a half of his given name. So calling him Loong is a bit weird.
- kszx 12y agoHis father also called him Loong (not Hsien Loong), at least sometimes: "He was still young and it was better that someone else succeed me as prime minister. Then, were Loong to make the grade later, it would be clear that he made it on his own merit." http://www.singapore-window.org/sw04/040531a1.htm http://www.singapore-window.org/sw04/040531a1.htm (They use English in the family, although Lee Hsien Loong can speak Chinese fairly well.)
- kzrdude 12y agoHis father called him by his first name, that sounds expected.
- danschuller 12y agoSingapore is a great place. Very meritocratic, high-tech, modern and forward-looking but it is a sort of benevolent dictatorship. This is Lee Hsien Loong, the son of Lee Kuan Yew who built up Singapore (obviously a brilliant leader but also, with little oversight, worryingly quick to jail his critics). The People's Action Party (PAP) has been in power since Singapore's formation and opposition party leaders have found themselves in jail or sued into bankruptcy. Benevolent dictators and dynasties work great until they don't. It will be interesting to see how Singapore fares a few leaders down the line. Hopefully pretty well and more politically tolerant; as it's a nice place with great, talented people!
- hackerboos 12y agoI was in Singapore this year and it's a fantastic place, but it is very artificial. Citizens have a hard time communicating with each other through the 4 very different official languages. People are also on edge about immigration and the peaceful multicultural facade hides a darker side of racism in Singapore.
- clebio 12y agoThis is an interesting comment, thank you for the perspective. I think you mean 'facade' where you wrote 'fasard'? I don't want to assume, though -- it might be a word I don't recognize, or transliteration -- honestly asking.
- hackerboos 12y agoYou're right. Written in haste and not proof read.
- visakanv 12y agoCould you give me examples of places where things are natural (as opposed to artificial), and where people have an easy time communicating? Just curious about the spectrum.
- 12y ago
- lordnacho 12y agoLike many people in tech, I've come to the conclusion that managers need to have done at least one component of whatever they're managing. Hopefully the critical component, if there is one. This is just as true for politicians, and I think this guy is a great example. All this talk about advancing STEM education in the West, but which country is leading? The one where the leader is a top STEM graduate. Anecdata: I've been to Singapore several times, have loads of friends there. They really are better educated than your average western adult.
- Jugurtha 12y agoThe following thought amused me: The USSR had control over everything back in the day, though the hard sciences and their people had great latitude and somehow enjoyed more freedom compared to those in other domains. They were like little precious princesses. That's because hard sciences are, well, too hard for your average Soviet dictator to understand, control, and screw up. Not hard enough, apparently, for the average Western politician in 2015.
- clebio 12y agoHubris is a powerful drug....
- varjag 12y ago> The USSR had control over everything back in the day, though the hard sciences and their people had great latitude and somehow enjoyed more freedom compared to those in other domains. This was born out of necessity: the hard sciences were the weapons program, first and foremost. Then, there's usually not much to argue in material world from Communist POV. Unlike the soft/social sciences where there's much bigger potential for subversive. That said, they never had more "latitude" than their Western colleagues. There were waves of crackdowns on supporters of relativist physics, on computer science, on genetics. Korolev, the champion behind the Soviet space programme, died from kidney condition resulting from his prison camp labor.
- puranjay 12y agoWhile I don't disagree with you, managing a 'country' like Singapore is a completely different ball game than managing a country like USA, China or India.
- naithemilkman 12y agoWoohoo Singapore represent! Ok serious question though: is he the only world leader that can code?
- deleted 12y ago[deleted]
- peteretep 12y agoMerkel was a physicist, so one would assume she has written at least some code.
- jpfr 12y agoMerkel wrote Fortran code for her PhD thesis. [1] Afaik she approximated the Schrödinger equation to compute the rate of decay of molecules with up to 6 atoms. This [2] is the last physics paper of her (from 1990). After the wall fell, her interests changed quite a bit... Only political papers from then on. [1] http://www.file-upload.net/download-9106454/AM-Diss.pdf.html http://www.file-upload.net/download-9106454/AM-Diss.pdf.html [2] http://dx.doi.org/10.1002%2Fqua.560380214 http://dx.doi.org/10.1002%2Fqua.560380214
- Coding_Cat 12y agoHave you seen the code written by physicists? Go look up the source code to CERN's ROOT package and browse it's change-log. Some of it quirks can be forgiven for it being incredibly old, but still...
- deleted 12y ago[deleted]
- mkagenius 12y agoI had heard Obama referring Bubble Sort in some TV show. Here it is: https://www.youtube.com/watch?v=k4RRi_ntQc8 https://www.youtube.com/watch?v=k4RRi_ntQc8 It may be rigged, not sure.
- SamReidHughes 12y ago
- seivan 12y agoSingapore keeps impressing me.
- iewnait 12y agoHow so?
- stared 12y agoWell, I know that this may sound unpopular, but Singapore is one of key examples why technocracy may be better than democracy. In democracy, it's popularity contest. It may be influenced by politicians' technical skills; though, much more often it's influenced by their ideologies. (If you think that popularity is the same as merit, then look at which current songs are the most popular.) And a large group of people have tendency to be biased towards short-term goals rather than long-term progress.
- devnonymous 12y agoBeing an Indian (ie: coming from the largest democracy in the world), I have formed the opinion that democracy is a form of government where in theory everybody is happy most of the time but unfortunately what it instead does is keeps everybody equally unhappy, all the time. Now, whether this is necessarily a bad thing considering the alternatives is debatable but coming to your point, yeah, something like Singapore just cannot happen in a democracy although it is not due to the short-sightedness of the 'large group of people'. In a proper democracy the minority opinion (note, I said minority opinion, not minorities' opinion) no matter how flawed and unreasonable would still have to be considered. Again, this is not necessarily a bad thing, it just slows things down (in either direction !)
- mike_hearn 12y agoI don't see any particular reason why a democracy cannot have tech-savvy leaders. As often pointed out Angela Merkel was a chemist before becoming the German Chancellor. Margaret Thatcher was also a chemist, I believe. Germany is by all accounts very well run and is indeed a very tech-savvy and productive economy. I don't know anywhere else that has a computer scientist as a leader, but then again, I suspect that's because most people who have a passion for mathematics or computer science end up going into that field. Virtually nobody it seems decides to leave the CS world for politics. This guy did only because of the whole dynastic element - his father told him what he'd do in life, so he was never able to pursue his skills in this field. Sometimes I wonder if some of the political problems we often debate here on HN and elsewhere are our own fault. So few people enter politics from the tech and science industries, it should perhaps not surprise us much when technically illiterate leaders pass nonsensical laws .
- rurban 12y agoBut he calls his sysadmins a "Cyber Security Agency". Looks like typical government overreach to me.
- cyphunk 12y agoMeanwhile, Obama has a child teach him how to open the Processing.org IDE. Meh, maybe the future is brighter though considering Hiliary knows how to setup her own mail server.
- pyrois 12y agoWhy is knowing how to open an IDE or set up a mail server a prerequisite for good governance?
- spacemanmatt 12y agoMaybe we should require the same of each congressman and senator, then come back to this question.
- richerlariviere 12y agoWhat about Stephen Harper. Haha. Computer science should be part of all prime minister's knowledge. It brings rationality and analytic thinking.
- devy 12y agoAnd please don't forget, at an annual salary of $1.7 million USD [1], Mr. Lee Hsien Loong is also the world's HIGHEST PAID prime minister. So I am not surprised that he should have some additional chops to be amongst the highest paid world political leaders. [1]: http://en.wikipedia.org/wiki/Lee_Hsien_Loong#Salary http://en.wikipedia.org/wiki/Lee_Hsien_Loong#Salary
- haosdent 12y agoLoL, amazing!
- kragen 12y agoCharlemagne didn’t know how to read for most of his life, and was studying assiduously in order to become literate at the time of his death; nowadays that would be unthinkable. But today we’re in the same situation with most of our political leaders and programming: Obama was able to remember at least that bubble sort was the wrong way to sort a million integers, but didn’t even come close to the constant-time radix sort you’d want to use (if we’re talking about fixnums, not bignums). A lot of people will use this situation to argue that dictatorship is better than democracy, since Singapore has dictatorship and smart leaders, while the democratic world generally has programming-illiterate leaders (except Merkel, apparently), but that seems to be more a coincidence than anything else — Lee’s level of competence is as much an anomaly among dictators as it would be among democratic leaders. Political leadership (whether in a democracy or in a dictatorship) is about persuading people to cooperate with each other, not about reading and writing, except perhaps as a means to that persuasion, and not about programming, either. But the extent to which you can rightly aim your cooperative efforts depends crucially on your understanding of the world in which they will play out, and when it comes to that, political leaders lacking basic informatics competence are as mentally crippled in the 21st century as an illiterate political leader like Charlemagne would have been in the 19th. Nobody really occupies the role of “history’s actors” that Karl Rove believed he was in. We are all constrained to be in the reality-based community, or fail as he did.
- Apocryphon 12y agoIt's just culture. The U.S., maybe the Anglosphere in general, lacks the same esteem for engineers and technologists that much of the rest of the world has. So you're less likely to see such people rise in American politics. I don't think it's a matter about democracy vs. technocratic dictatorships. Ahmadinejad was a civil engineer, Angela Merkel was a research scientist, and who's the only presidential candidate with a CS degree in the 2012 elections? Herman Cain.
- Yadi 12y agoThis guy is such an inspiration. Perhaps a different side of Politics. Well at least from where I come from originally. He wants to build a data marketplace, invest in tech R&D )since 2010). OH and he also programs in Haskell. I mean this is amazing how he have dedicated so much for this topic.