Sequenced Thoughts from C/Shttps://elangocheran.com
Elango's blogMon, 18 Feb 2019 21:38:11 +0000en
hourly
1 http://wordpress.com/https://s0.wp.com/i/buttonw-com.pngSequenced Thoughts from C/Shttps://elangocheran.com
How we write down languageshttps://elangocheran.com/2018/11/13/how-we-write-down-languages/
https://elangocheran.com/2018/11/13/how-we-write-down-languages/#respondTue, 13 Nov 2018 08:58:06 +0000http://elangocheran.com/?p=754Continue reading How we write down languages]]>Writing systems — the ways in which we write down a language — are fascinating. They may not be as diverse and surprising as all the animals and plants of the world, but you likely may be surprised to learn just how differently we have found ways to write down information, each with strengths and weaknesses. And if you don’t get all the details right, then what you end up telling the world is not “follow your heart” but “coward”. Oops. (Countless examples exist that could fill up several blogs — it turns out failures in cross-cultural appreciation & appropriation go both ways.)

People believe that, in the timeline in human evolution, language evolves first as speech, and only later does writing evolve to record it down. For example, when new words (ex: slang) or spoken forms derived from spreading process (ex: “gonna”, “hafta”) get coined, if they persist long enough, they will become normalized and enter the vocabulary. Whether these new words are defined as “official words” depends on if you have a prescriptivist or descriptivist view of the situation, but that is a small example in our own experiences where we see writing changing according to speech. (Btw, Shakespeare was a master of introducing crazy, made-up words into a language.)

What is fascinating are some of the more apparent examples in recent history in which we make choices on how to write, or change how we write, a language, and the implications those choices have. Or in one case, it’s the other way around — it’s the act of recategorizing dialects as separate languages through how we write.

Kazakhstan’s was recently considering a new Latin script alphabet a few months ago to write the Kazakh language, which would replace the Kazakh version of Cyrillic that was pushed during early Soviet times. The decisions over details was unwittingly going to make the proposed script much more difficult than it needed to be, and potentially problematic for encoding data in computers by overloading the semantics of the plain apostrophe. The plan to replace Cyrillic with Latin was political — to remove the legacy of colonialism (Russian Soviets) from the country. According to the article, the introduction of Cyrillic in the first place was itself a deliberate, political decision:

For centuries, it was written using the script of Arabic, the language of Islam, which most Kazakhs have long at least nominally practiced.

Kazakhstan switched briefly to the Latin alphabet at the start of the last century, and Russia’s Communist leaders after the 1917 revolution initially supported the use of a Latin script.

Later, growing fearful of pan-Turkic sentiment among Kazakhs, Uzbeks and other Turkic peoples in the Soviet Union, Moscow between 1938 and 1940 ordered that Kazakh and other Turkic languages be written in modified Cyrillic as part of a push to promote Russian culture. To try to ensure that different Turkic peoples could not read one another’s writings and develop a shared non-Soviet sense of common identity, it introduced nearly 20 versions of Cyrillic, Mr. Kocaoglu said.

Computers may the last thing that people are thinking when these are the considerations factoring into their decision, but encoding such a scheme into computers can end up being a good litmus test of simplicity (or, at least, lack of incidental complexity).

This BBC article on the proposed change explains the economics, some of the linguistics, and the possible political effects. The diagram in the article illustrates how tricky the switch is (but it doesn’t show how the sounds compare to the Turkish language alphabet, for example).

The article succinctly explains the importance of language to economics and political relationships:

Currently, up to 10% of the current trade flow between Russia, Kazakhstan and Ukraine can be explained by the convenience of a shared language, which in some ways translates to a shared culture and mentality, says Madumarov. This also means that Russian-speaking Kazakhs have more economic mobility between countries. Meanwhile, Azerbaijan and Georgia, nations that are not as fluent in Russian, have weaker trade links.

Inversely, he says that the benefits to having a Latin-script alphabet means being better integrated with most of the Western world. As an example, Turkey, which switched to a Latin-based alphabet from its former Arabic script in 1928, has managed to form alliances with the European Union and was in negotiations – up until recently, when the government moved towards a more autocratic direction – to be a member.

In all this, we’re not even talking about the abrupt change of the Turkish alphabet from Arabic to Latin. Despite (or because of) Turkey’s top-down shift to the West politically in the early 1900s, the quick adoption of a Latin was not painless, and we still deal today with the “Turkish Iproblem” in computers. Also note that English and Dutch use the 26 letter “unadorned” Latin alphabet (no diacritics around letters). Most of the relatively recent West-oriented alphabet changes for various languages are based on the English alphabet, and English has an extra strange relationship between letters and sounds because of changes like the Great Vowel Shift.

(If the standard Latin alphabet in standard ASCII has 26 letters, why does Italian, the most direct descendent of Latin, have only 21 letters? It turns out that the old Latin alphabet evolved over time, once in ancient times 2000 years ago after conquering Greece and expanding to include Y and Z to represent Greek loanwords, and again in the Medieval times (500-700 years ago?) to distinguish I from J, V from U, and include W for Germanic languages. Italian today doesn’t use J, K, W, X, and Y.)

The most surprising fact in all this is that the brief time in which Kazakh was written in Latin script in the early 1900s before its current Cyrillic form was due to the USSR promoting its Latinization project for language writing systems. Those early Soviet days were heady times, and other languages were a part of that project, until the project was abandoned after a few years in favor of Cyrillic for less idealistic reasons. And that attempt to Latinize some of the languages overlapped with and was helped by Turkey’s adoption of the Latin script.

What’s fascinating about the recent history of South Asia is that the 2 main languages of the Gangetic Plain spreading across Pakistan and northern India — Urdu and Hindi — is that they are pretty much the same language, or at least, dialects of the same language. The language was once called Hindustani in the 1800s — a language with word roots in Sanskrit (via Prakrit), Arabic, and Persian — for which Hindi and Urdu were considered dialects of Hindustani, and as such, the names were considered synonyms for the language. But before the arrival of the British, who coined the name Hindustani as a synonym for Urdu and Hindi, it was just called Urdu. (The influences of Persian and Arabic were brought about during the time of the Mughal Empire, which traced its lineage to the Mongols of Genghis Khan fame a few centuries prior, where the surname “Khan” is a remaining vestige. The spread of Genghis Khan is the reason why Turkic languages are spoken from Turkey to Central Asia including to Mongolia, but the Mughals maintained no Turkic language influences in India.)

But there, the divergence occurring since independence in 1947 is one that was & is accelerated by deliberate actions by governments both in lexicon and writing system. Since independence and the Partition of India and Pakistan were only 1 day apart, the resulting 2 countries and respective religious and ethnic identities pushed the relevant dialects apart by introducing more of either Sanskrit or Arabic vocabulary, and Urdu using the Nastaʿlīq script and India standardized Hindi around the Devanagari script, passing over the Kaithi script that was neutral in that it was used by both Muslims and Hindus alike. Where there was once very recently one language with two major dialects is now two languages (other regional dialects exist as before).

So what about Vietnamese, which is another language that switched over to a Latin-based alphabet (although less by choice and more because of the French)? All the sounds can be represented in the alphabet, but it doesn’t mean that everything is not so straightforward for people familiar with the Latin alphabet. D sounds like “z” or “j” depending on the dialect, while Đ sounds like “d”, and it looks trickier from there. Issues like this or the “Turkish I” may not be problems for native speakers of those languages, so are they just problems of the non-native speakers, then?

I continue to find some inspiration the story of Adlam, a language made up from scratch by a couple of brothers for their native Fulani (aka Pular) on the challenge from their father to help preserve their language. Access to education for a traditionally nomadic people is scarce, and learning to write the language, which is either in Arabic of French script, effectively meant learning those languages when going to the schools that taught the associated script. The spontaneous changes that result when a script fits its language and region is fascinating. The sheer belief required in inventing a script by yourself for millions of people in dozens of countries, the amount of effort required to promote the language, and the ongoing work necessary to make and keep the language relevant in the digital age is a story full of lessons for those who observe.

]]>https://elangocheran.com/2018/11/13/how-we-write-down-languages/feed/0echeranp0656d2jInterviewing for a tech jobhttps://elangocheran.com/2018/08/06/interviewing-for-a-tech-job/
https://elangocheran.com/2018/08/06/interviewing-for-a-tech-job/#respondMon, 06 Aug 2018 15:25:04 +0000http://elangocheran.com/?p=745Continue reading Interviewing for a tech job]]>When I interviewed for my current job, I didn’t pass the interviews on the first time that I tried. When I applied again 1 year later, I passed, but I had changed my strategy in preparing for the 2nd time to correct all the mistakes I made during the 1st time.

There were other factors of my growth as a programmer beyond the whiteboard problem practice that helped equally as much, if not more so, in my success in the 2nd round of interviews. But the whiteboard programming aspect is more immediate and usually more stressful.

To help others who may need the help in the way I did, the following is a summary of how I prepared the second time:

Also bought Cracking the Code Interview and studied from it, but only to round out topics that EPI didn’t cover, ex: DBs. Everyone seems to use CCI, but I liked EPI because it was harder and had more problems

Tried to do >= 1 problem a day

Practiced for a month before submitting any applications / sending resumes, kept studying while waiting for responses from recruiters

Simulated as much pressure on myself as I could at home

Bought a whiteboard, put it up on the wall in my apt, did most of my problems there

As a backup option, also had a paper notebook to do problems when I could find a seat to sit down on BART while commuting

Timed myself to simulate the urgency & passing of time – wrote down the start & stop times, and turned on the stopwatch on my phone

Took a picture of every whiteboard problem I did – the point was to simulate feeling scrutinized (just like when the interviewer takes a picture of the board at the end during an interview)

Developed a process for systematically approaching problems

Evolved organically as I went along through practice problems, started it out of frustration that each practice problem felt as nerve-racking as the next

Before writing out any code, I list out these categories in order and fill in whatever is appropriate to the problem:

GIVEN – problem statement

RETURN – problem statement

INPUT – code inputs & variable names

OUTPUT – code outputs & return types

GENERAL IDEAS – anything & everything you think is relevant; start with data structures; definitely include pictures, examples of corner cases & test cases. make a “TODO” comment if you get stuck on a low-level detail

ASSUME – assumptions that you can / need to make with the confirmation of the interviewer

(recursion) RECURSIVE STEP – work to be recursive. sometimes need to carry state in recursive step, in which case, need one recursive function and one function to kick it off with initial values

CLASSES – any classes / data structures to create. Often, for the purposes of interviews, classes are glorified “structs”. (Only if you need to create a Comparator do you try to mention implementing hashCode() and equals().)

VARS/FNS – any variable names / function names that need to be created, or that I want to create

]]>https://elangocheran.com/2018/08/06/interviewing-for-a-tech-job/feed/0echeranHow the Basque Language Has Survivedhttps://elangocheran.com/2018/07/11/how-the-basque-language-has-survived/
https://elangocheran.com/2018/07/11/how-the-basque-language-has-survived/#respondWed, 11 Jul 2018 03:00:15 +0000http://elangocheran.com/?p=743Continue reading How the Basque Language Has Survived]]>Another wonderful episode from the World in Words podcast is “How the Basque language has survived”. There are many interesting points in the episode, making the whole thing worth listening. Below, I’ve picked out one small section from the podcast that is interesting and inspiring.

Here’s the blurb from the World in Words’ webpage about the Basque language:

Spoken in a region that spans northern Spain and across the border into southern France, it is not part of the Indo-European language family. It’s not related to Spanish or French or German or Greek or any known language. The origins of the language are a bit of mystery. In fact, you can almost hear the history of the European continent in the language according to Basque language scholar Xabier Irujo.

And here’s a small excerpt, regarding the efforts in the Basque community in the mid-1900s to standardize their language for the purposes of preserving it under the oppressive Franco regime. At the time, there was a dispute on which of the dialects (or which linguistic features from which dialects) to choose as the “standard”, especially whether or not to pronounce certain words with an “h” sound or not, which happened in one dialect (Batua) from the northern areas of Basque Country, but not in the others spoken by a majority of speakers:

Alan King: So this was coming on during the [19]60’s, and it finally came to a head at this famous meeting at Arantzazu.

Nina Porzucki (host): October 1968, all of the greatest Basque thinkers and linguists met at a monestary in Basque Country to vote on whether to make Batua the official standard.

Alan King: There was a motion on the table whether to adopt Batua as the official way of writing Basque from then on. There were a lot of people who very angrily spoke against it, and it actually looked as though the motion was not going to be adopted.

Nina Porzucki (host): And then, in an infamous moment at the meeting, a linguist by the name of Pierre Lafitte stood up.

Alan King: Not a very imposing man, you know, physically imposing. But a humble, frail man.

Nina Porzucki (host): And he gave a speech, as a Northerner.

Alan King: [paraphrasing Lefitte’s speech] “As a member of the northern Basque Country, seeing as things have come to a head, the correct way to move forward is to stop writing ‘h'”.

Patrick Cox (host): What? Stop writing “h”?

Nina Porzucki (host): Yeah. He went on to explain that it was more important for the speakers from the south, where there were and are still many, many more people, that they continue to speak the language, and

Alan King: “…our northern Basque may perhaps die out, but you must keep it alive. If you don’t see fit to spell with the ‘h’, then we should not stand in the way.”

Nina Porzucki (host): Imagine the room after that speech, Patrick.

Patrick Cox (host): Wait a minute, he fell on his own sword, right?

Nina Porzucki (host): He did. He said, you know what, it’s more important that the language survive. Our dialect will die, but… yeah.

Patrick Cox (host): So how did they react, what did they do?

Alan King: He sat down. And apparently, that’s when they decided to say yes to the “h”.

…

Nina Porzucki (host): … What happened was that everyone realized that, “We all are trying to save this language, so if we spell something with an ‘h’ or without an ‘h’, that’s besides the point.” The point is to continue Basque.

]]>https://elangocheran.com/2018/07/11/how-the-basque-language-has-survived/feed/0echeranHalf Gods by Akil Kumarasamy available on pre-orderhttps://elangocheran.com/2018/05/23/half-gods-by-akil-kumarasamy-available-on-pre-order/
https://elangocheran.com/2018/05/23/half-gods-by-akil-kumarasamy-available-on-pre-order/#respondWed, 23 May 2018 16:49:09 +0000http://elangocheran.com/?p=734Continue reading Half Gods by Akil Kumarasamy available on pre-order]]>A friend of mine has just finished a novel / book of interlinked stories in which the Tamil experience is an important factor. It begins with an Eelam Tamil family grieving about the end of the war in Jersey and connects stories across time/place. There’s also a chapter/story called “The Office of Missing Persons,” which directly deals with disappearances. The book has gotten really positive reviews from some well-known writers in the literary world. It’s coming out in a month, available on pre-order (links below).

]]>https://elangocheran.com/2018/05/23/half-gods-by-akil-kumarasamy-available-on-pre-order/feed/0echeranFavorite Tamil & South Indian restaurants of the SF Bay Areahttps://elangocheran.com/2018/05/23/favorite-tamil-south-indian-restaurants-of-the-sf-bay-area/
https://elangocheran.com/2018/05/23/favorite-tamil-south-indian-restaurants-of-the-sf-bay-area/#respondWed, 23 May 2018 16:46:34 +0000http://elangocheran.com/?p=732Continue reading Favorite Tamil & South Indian restaurants of the SF Bay Area]]>By now, I have visited enough Tamil & other South Indian restaurants in the San Francisco Bay Area to have some favorites (and not-so-favorites). Here are my favorites, “honorable mentions”, footnotes, and disclaimers. Enjoy!

Favorites

Most of these top restaurants are in the South Bay area (Moutain View / Sunnyvale / Milpitas) unless otherwise specified.

Annachikadai (அண்ணாச்சிக்கடை) – I think this is not only the best Tamil restaurant in the Bay Area, but I’m going to call it and say it’s the best in the US. Best in the US & Canada, ha! When you up to the front door, you are greeted first by the smell of a kitchen or restaurant in Tamil Nadu. The authenticity is evident in the food (quality and taste), intention (offer authentic menu items beyond the overplayed standard Tamil restaurant fare), and ambience (modest digs, and servers racing to handle customer demands). The restaurant only opened 3 months ago, and it was a soft launch (no announcements or advertising whatsoever), and even 1.5 months afterwards — when I found it — the place is always packed. It was hard to find a table during off-hours (4pm in the afternoon) on a Saturday. They offer veg & non-veg food, and have an unlimited saapppaadu option for $13/$14. Every item on the menu is done well, without being too spicy or too greasy. Ex: they make paniyaaram (குழிப் பனியாரம்) and do so just right without making it greasy / overly oily. They reflect their Southern Tamil Nadu background by offering items saalnaa (சால்னா), but YMMV. The only thing I want out of this place is to have it bigger — bigger menu, more seating, more servers, more traditional grains (சிறுதானியம்) more deserved acclaim.

Madras Cafe – This place is the go-to Tamil restaurant in the Bay Area. It’s probably where everyone else would tell you to go first. It’s so busy that their counter-serve style is more like a necessity to get the turnover to keep up with the crowds. And the crowds during normal meals crowd the little lobby area and spill outside the front door like a TN bus. The chutneys are all top-notch — they’re the only place that makes couriander/cilantro chutney well enough to make me forget that I don’t naturally like the taste of couriander. They make the best vadai I’ve had outside of Tamil Nadu, by far. All of their food is vegetarian, but they excel in idli (இட்லி), thosai (தோசை) and vadai (வடை) less so on pongal (வெண் பொங்கல் / kothu parotta (கொத்து பரோட்டா) They open at 8:30am. For the longest time, this place has been my favorite, and is still pretty close in quality. Only in the last year have I noticed some slight drop in sambar (சாம்பார்) quality (more watery/oily than I remember) and eating an onion oothappam (வெங்காயம் ஊத்தப்பம்) made my stomach not feel so good afterwards. Prices used to be the lowest here, but they only recently went up ever so slightly. I still highly recommend, but if you go during normal hours and dislike waiting in lines as much as I do, there are other options that you can find.

Madurai Modern Cafe – I think this place is new, perhaps opened in the past few months, too. From the name, it seems to be emulating Madras Cafe, and because it’s newer and not in a typical commercial area, the prices are lower, the wait is much shorter, but the food is just as good. They are also open 7 days a week, including Mondays. It’s run by a husband-wife couple with the kids hanging around in the evenings, and if you’re a willing participant, the little one’s mischief is entertaining. All of their food is solid, although perhaps the kuruma is a little bit oily. Nothing is bad. Also note that they don’t serve parotta, in case you see it on a menu or in the pictures in the storefront window.

Tirupathi Bhimas – This is a nice go-to place. They really treat this restaurant like a transplant of a typical restaurant (aka “hotel”) in Tamil Nadu. No frills, plenty of seating with fast service and fast turnaround. It’s all about the food here. Everything is vegetarian and good. The saappaadu meal (சோறு சாப்பாடு aka “thali”) is $10 but not unlimited, unlike the $13-16 unlimited options in other places, but you’ll probably be full if you clean your plate here. One thing that they do here better than most is their thayir vadai (தயிர் வடை – vadai dipped in yogurt) because they put extra stuff in the thayir to make it interesting, like ginger (இஞ்சி). By comparison, Madras Cafe’s vadai would have the ginger in the vadai, and other places don’t attempt ginger in vadai or yogurt, probably because it’s hard to pull off.

Amaravathi – this is a Telugu (Andhra/Telangana) restaurant, and I found it because it is close to Madras Cafe, with similar menu items, a not-too-high level of chili spice, and has plenty of seating whenever I go there. All of the food is vegetarian. The thosai, idli, sambar, pongal, chutneys, etc. should be pretty much the same as the Tamil style (except their idli, which isn’t as soft, but oh well). The reason is that one of their chefs is from Tamil Nadu. Only their kuruma and parotta are markedly different than the Tamil style (and so-so for me). Getting the unlimited rice meal (“thali”) is way too much food to finish even before refills, unless you plan to go there after a crazy 30 mile bike ride or intense weight lifting. Their prices are fairly low, and in terms of value, it’s probably the best. You get very full off $10 of food. Up until now, breakfast was tricky because all items start around $5.50-6, so how do you not overeat? Last weekend, I noticed that they recently introduced an $8 all you can eat breakfast buffet – idli, vadai, pongal, sambar, chutneys (coconut, tomato, peanut, ginger), made-to-order plain thosai, and kesari (கேசரி) sweet. That’s the sweet spot missing in breakfast — I can make my own “combo” order in ways that the menu would not easily allow w/o over-ordering, so this might be the new go-to for breakfast. They close on Tuesdays instead of Mondays, and only open for breakfast on Saturdays and Sundays.

Didigul Thalaipakatti – This is the latest popular Tamil Nadu restaurant chain to open a branch in the Bay Area. Like the other chains, they seem to go for the “Chettinadu” style of food – lots of non-veg offerings, and spicier than average for Tamil Nadu. The food here is spicier than the other Tamil restaurants above in my list, but not as spicy as a typical Telugu restaurant (in which category I put Mangoes as well as the recent offerings from the local Ananda Bhavan and Saravana Bhavan branches). This place specializes in biriyani (பிரியாணி), which they do well, and they also do kothu parotta really well. Their vegetarian offerings are good but limited in seletion. For a modestly priced Tamil restaurant, the decor is really modern and the bathrooms are relatively clean, especially compared to most other comparable restaurants. This place can get busy, and is open 7 days a week.

RASA – The chef who created the menu for the SF trendy thosai-themed restaurant called Dosa — left Dosa in SF to start his own swanky restaurant in Burlingame. The menu is similar in terms of “fusion thosai” and other Tamil fusion items, the location is compact and super-clean. All of the food is of high quality. The restaurant earned 1 star from the Michelin guide, so you can imagine that it’s on the slightly expensive side. If you like a fine-dining experience, interesting combinations like truffle oil thosai, and/or reliably clean, well-maintained bathrooms, there’s no competition here.

Honorable Mentions

Bezawada – This Telugu restaurant, in terms of food, is actually quite amazing. Which explains why they have 3 locations already. The fish was amazing. My initial draw here is their unlimited thali, which is really similar to a Tamil Nadu soru saappaadu thali meal in terms of taste. It’s $16 and it’s way too much food. But it’s nice when you come with a group because they just leave the buckets of sambar and rasam on your table. (The buckets are smaller and cleaner than what you get in a modest restaurant or special occasion meal line (பந்தி) in Tamil Nadu.) The spice level is elevated compared to Tamil Nadu, as is to be expected. My Yelp-level nit-picky gripe is that the service was bafflingly negligent or strange. Only the discovery of Annachikadai’s version of unlimited rice meals supplanted the spot that Bezawada had for me in the list of top places.

Arusuvai – (Note: not related to the Arusuvai restaurants on the East Coast, apparently, fwiw) This is an independent (non-franchise) restaurant fitting into the category of Chettinadu-style non-veg & veg. I really liked this place when it opened a few months ago, and the non-veg is still fairly good, but some parts of veg food have become suspect. I still like the place, and I should probably leave them a note on Yelp so that they step up their level of quality back to what it used to be.

the vegetable dosai at Vik’s Chaat Cafe – if you’re closer to Berkeley than any of the other places, and you need idli / thosai and not much else, then go here. Otherwise, you’ll find simple food with a North Indian flare, as “chaat” implies. The one thing that this place does well is that the vegetables that they put into the vegetable thosai are cooked like a Tamil Nadu-style “poriyal” (பொரியல்) satuee before being put inside, and there are no starchy potatoes, etc. used as filler.

Footnotes

I don’t understand all the 4/5 reviews on Yelp for the good Tamil restaurants, but half of them sound like they don’t know what to expect (like they’ve never eaten in Tamil Nadu before) or they’re just overly fussy. Who’s more particular about food than SF hipsters writing Yelp reviews? Just about any South Indian adult I’ve met who talks about South Indian food. Except they’re focus is all about the food, not about BS demerits for ambience and service.

Many restaurants are closed on Mondays

Many restaurants close between lunch and dinner hours. Many restaurants aren’t open for breakfast.

Disclaimers

I no longer enjoy trying to eat the spiciest food possible. My level of spice tolerance is perhaps average for Tamil Nadu, and certainly low by Telugu / Tamil Eelam / Korean standards.

There isn’t much of a eating-out culture in India — that may be a reflection of economics — but either way, there currently isn’t a culture around customer service, let alone hygiene, let alone bathroom cleanliness. I wish all of these restaurants emphasized that more

I like it when restaurants in the Bay Area put a sink for washing hands outside of the bathroom. It makes it easier for people who eat with their hands, and this is standard in homes and many public eating places that I’ve seen in Tamil Nadu.

]]>https://elangocheran.com/2018/05/23/favorite-tamil-south-indian-restaurants-of-the-sf-bay-area/feed/0echeranHelper code to mimic Clojure fns in Scalahttps://elangocheran.com/2018/03/23/helper-code-to-mimic-clojure-fns-in-scala/
https://elangocheran.com/2018/03/23/helper-code-to-mimic-clojure-fns-in-scala/#commentsFri, 23 Mar 2018 16:28:33 +0000http://www.elangocheran.com/blog/?p=719Continue reading Helper code to mimic Clojure fns in Scala]]>I’ve finished my 3.5 year stint writing Scala, and I haven’t stopped missing writing Clojure. The knowledge of Clojure continues to heighten and inform my programmer sensibilities. One thing that I appreciated about Scala is that it was as good of a medium as you might practically find to allow writing Clojure without writing Clojure. I liked to think of Scala as the canvas on which I painted my Clojure ideas. Because Scala makes itself amenable to many styles of programming at once (at least, FP and OOP), it was possible to write code by imagining what the Clojure code would look like, and then writing that in Scala syntax. Interestingly, the more I did this, and the more faithfully I did so, the more people implicitly (no pun intended!) acknowledged the code as “good Scala code”. Because, you know, most Scala programmers agree that good Scala code puts “val”s at the top of a function body, uses immutable collections exclusively, prefers functions over (object) methods, and makes functions small, stateless, and composable. More on that later. Here, I want to simply release some of the code that I wrote in Scala to fill in a few perceived gaps in Scala’s Seq abstraction, where the perception is based on what I was accustomed to using in Clojure.

Code snippets for implementing Clojure fns / functionality in Scala

Note: the following code snippets are Apache 2 licensed, so go ahead and use them wherever you would like as you see fit!

The first code snippet is perhaps the more interesting of the two. I provide my implementations in Scala of Clojure’s merge-with and partition-by:

The code originated in the fact that something as simple as partition-by didn’t exist in Scala, and there was really no way to cleanly finish the task I was working on without going off and implementing it. Soon after, merge-with followed, and then “mergeLeftWith” was created to offer a version that starts with an initial value. The analogy is if merge-with is like reduce with no initial value argument, then “mergeLeftWith” is like using Clojure’s reduce with an initial value argument (aka Scala’s foldLeft).

The second code snippet was useful for reducing all the boilerplate that inevitably surrounds the use of Options in Scala. I also added some pretty-printing functions that I used in testing:

On the topic of whether all the ceremonial code required for Scala’s liberal use of Option (now partially present in Java 8+ due to Java’s careful embrace of FP), you should really see Effective Programs – 10 Years of Clojure by Rich Hickey. It articulates well the inherent tradeoffs that we make in our choice of programming languages, which are merely tools to a means. But it brilliantly articulates an opinion/perspective that is practical and speaks to my sensibilities of why I found the boilerplate code in Scala slowing me down more than I would like for the amount of perceived benefit I got in return (not much). Most of the benefit in terms of confidence in my code came from my various unit and integration tests.

And speaking of tests, don’t underestimate the utility of the pretty-printing functions. The reason why I created them was because I had to convert Clojure code that I wrote that used the expectations testing library. That library is amazing, especially when your logic requires data structures. The library isn’t radically different to other “fluent” testing libraries, nor is that where most of the benefit lies. The real benefit occurs when you spend the most time using it — when your tests fail! And you don’t necessarily look back at your test code, but rather, you look at the test output to gather clues of what failed and how. Expectations does the following in its error output:

re-prints the test code causing the failure, with the provided values plugged into the code if necessary

instead of printing “actual value [A] is not equal to expected value [E]”, it neatly prints (using line breaks and horizontal spacing) the values so that they line up. (I can’t tell you how many times I’ve seen the test error output that reproduces default Java object printing of 2 large, detailed objects side by side without even line breaking

and in a terminal with colors, you get different colors for the re-printing of the original test code, the expected value, and the actual value

I wasn’t about to do all that because I couldn’t possibly do so. I don’t think Scala has data structure diff’ing libraries because it doesn’t share Clojure’s proud focus on data-oriented programming. So the best I could do to recreate expectations in Scala was create helper test functions, one for comparing sets, one for comparing maps, one for comparing seqs, etc. where the differing values would be print on separate lines so that they would line up and you could more easily see where they diverge. For seqs, my testing fns would additionally iterate through the seqs and print the indices of the last congruent & first divergent elements in the seqs. Ultimately, the less time you spend sifting through the error messages, the faster your unit/integration tests are, and the faster you get back to doing the interesting, productive work that you intended to.

Parting thoughts about Scala

I found it strange that when I stepped in my previous role, which used Scala heavily, I basically just started writing my Scala code as if it were Clojure and didn’t really punished for it. I created a couple of semi-stateful OOP-y classes in my very first Scala program just to make it not look obvious that I was doing so, but then I got critiqued for how it made my code confusing. After that, I decided to just write Clojure code in Scala syntax from then on. As a result, at a high-level, my code:

used Scala object classes in lieu of Clojure namespaces

wrote functions statelessly, with all the vals and block-local function definitions occurring before any other code in the function

With all that, and combined with my helper fns/code in main code and test code, I felt pretty comfortable in Scala. And arguably, I may have had a quicker pace in getting code written than many Scala programmers around me who inevitably got caught in some compiler error or type representation riddle because they felt they were trying to do Scala the “right way” (for whatever value of “right way” they imbibed).

“Hey, (at least) it’s better than Java!” — that’s the most popular selling point that I’ve heard for Scala through the years. And I agree. There’s nothing more that I wish to say further on the topic that Rich doesn’t say much more insightfully in his his talk Effective Programs – 10 Years of Clojure. I don’t know what the future holds for programming languages. But I’m still optimistic in declaring that Clojure is a language for the ages.

]]>https://elangocheran.com/2018/03/23/helper-code-to-mimic-clojure-fns-in-scala/feed/2echeranRevitalizing the Hawaiian languagehttps://elangocheran.com/2018/03/19/revitalizing-the-hawaiian-language/
https://elangocheran.com/2018/03/19/revitalizing-the-hawaiian-language/#respondMon, 19 Mar 2018 17:37:00 +0000http://www.elangocheran.com/blog/?p=715Continue reading Revitalizing the Hawaiian language]]>The podcast story “Meet the last native speakers of Hawaiian” is a fascinating story about how to revitalize a language that almost (but not quite) went out of existence. The story of Hawaii and the Hawaiian language probably shares some elements in common with the story of many Native American languages and nations/cultures/tribes. The story of Hawaii is interesting because, despite the efforts to squelch the language from existence, there still remain pockets where the language is still spoken. Similar to the story of Myaamia, a concerted effort by community-based linguists and collective support from the community was crucial. The efforts are successful in that many kids grow up knowing how to speak Hawaiian because they go to Hawaiian-language primary schools. With the basic step solved, the next-step problems take their place.
The tricky aspect, now, is that many of the language revitalization efforts are aimed at kids on the larger islands, where the language was eliminated. The island with the last remaining native speakers is smaller, remote, less technologically advanced, and thus there is no connection with the speakers of the larger islands, who also are much more numerous. So the new speakers have an accent influenced by American-English sounds, and they are coining new words for old concepts based on English words. The disconnect between the two groups of speakers is a hindrance to reconciling the problem, although the remoteness of the native speakers is also what has kept the language alive all this time.

One way to preserve the rustic way of life of the native speakers, which is probably an asset in the long-term, while still introducing the linguistic examples of their speech to the new learners, is to create native speaker-staffed language immersion schools on the bigger islands. Maybe the schools could be planned out by the language researchers and activists, but the presence of native speakers alone is enough to be the example needed for new students. And it would be important to preserve quality, even if it means fewer students at a time can attend. The point is to let new learners know that there is a level of language proficiency above what they already get by default from school, and to make such opportunities more easily attainable while still maintaining an authoritative stance of what better proficiency looks like. Making the program immersive would be important, too. Just an idea.

]]>https://elangocheran.com/2018/03/19/revitalizing-the-hawaiian-language/feed/0echeranReviving the Miami language from the deadhttps://elangocheran.com/2018/03/19/reviving-the-miami-language-from-the-dead/
https://elangocheran.com/2018/03/19/reviving-the-miami-language-from-the-dead/#commentsMon, 19 Mar 2018 17:21:30 +0000http://www.elangocheran.com/blog/?p=713Continue reading Reviving the Miami language from the dead]]>The podcast story “How the Miami Tribe got its language back” is really fascinating. The Myammia (“Miami”) tribe and language lost its last speaker decades ago. The story of how and why the language went out of usage is not pleasant, but worth knowing. Regardless, thanks to the work of early linguists during the time when the language was spoken, there were historical records of the language (vocab, pronunciation, and perhaps grammar). Thanks to the interest of a Myammia descendent, a linguist, and a seed amount of resources, a lot of work coalesced in reviving the language into something that is spoken by a few hundred people on some basis. For a language that had completely died decades ago, that’s remarkable. Hearing the full story is worth it, especially for certain tidbits that do not appear in the written article. For example, students came from distant, disparate regions to learn the Myammia language at Miami University (OH), but there was not as much speaking among the students outside of the class as they hoped. It remained mainly an academic exercise of second-language learning. The big spark happened when they introduced a new class to the curriculum that also taught the history and traditions of the Myammia. There was a huge upsurge in usage and attachment to the language as a sense of identity took root among the learners.
]]>https://elangocheran.com/2018/03/19/reviving-the-miami-language-from-the-dead/feed/1echeranGoogle Design blog post on Indian language fontshttps://elangocheran.com/2018/03/08/google-design-blog-post-on-indian-language-fonts/
https://elangocheran.com/2018/03/08/google-design-blog-post-on-indian-language-fonts/#respondThu, 08 Mar 2018 06:49:47 +0000http://www.elangocheran.com/blog/?p=708Continue reading Google Design blog post on Indian language fonts]]>The new post from the Google Design blog entitled “The New Wave of Indian Type” is very interesting. The differences already noticeable in the examples of Tamil fonts in the blog post is already striking. And the blog post, of course, is showcasing fonts with open-source licenses and encouraging people to use them as starting points to create their own. I like these ideas very much.
This post about open-source fonts for South Asian languages reminds me of the Story Weaver website. The website is hosted by an Indian publishing company and hosts repository of open-source licensed stories and their translations for English and all of the languages spoken in South Asia. The website is geared towards getting people to contribute their own translations for the stories, which get placed alongside the already-provided pictures for the story.
]]>https://elangocheran.com/2018/03/08/google-design-blog-post-on-indian-language-fonts/feed/0echeranRecent articles about kids, language, and technologyhttps://elangocheran.com/2018/03/07/recent-articles-about-kids-language-and-technology/
https://elangocheran.com/2018/03/07/recent-articles-about-kids-language-and-technology/#respondWed, 07 Mar 2018 08:15:53 +0000http://www.elangocheran.com/blog/?p=703Continue reading Recent articles about kids, language, and technology]]>If you have seen the talk that Tim and I presented at Clojure/West in October on Learning Clojure through Logo, it should come as no surprise that topics of education, technology, and language are of interest. A couple of recent articles were published that caught my attention:

Icelandic language battles threat of ‘digital extinction’
This article talks about how the relatively low population of Iceland (only 300 thousand) means that there are not enough speakers for the economy to be a first priority for technology companies. But as technology becomes pervasive (smart phones, and now home devices, some of which are voice-activated), the gulf between a supported language and a less-supported language widens. Perhaps Iceland is like other Scandinavian countries in that there is a high rate of notable fluency among the populace, and in Iceland’s case, the prevalence of native Icelandic is diminishing as its relevance relative to English.

South Korea bans English education for first and second graders
In South Korea, a possible future balancing act is unfolding. Because English is already seen as too prevalent relative to Korean, the government has banned English from 1st and 2nd grade education. Pre-adolescent kids will still be able to pick up English, thankfully. But clearly, this action comes from a place of fear that the trend happening in Iceland has already progressed too far in South Korea. There are a lot of interesting issues of language, identity, and economics to unpack as well from that article, but I will not do so here.

Both of the articles above take a view that is worried about the eroding future of minority/non-English languages, and with it, culture and/or identity. They look at the current generation of kids’ adoption of technology as the change agent hastening this change. But it also reminds me of the following excerpt of a TED talk, that marvels in that very same ability for kids to learn on their own, and to do so via technology:

How Much Can Children Teach Themselves?
Click the blue play button to hear the audio from the TED Radio Hour news story. The entire story is worth hearing. The featured speaker, Sugata Mitra, a professor of education, did many experiments of putting a single, unattended computer in poor areas that kids can reach. Kids in Delhi taught themselves English and how to use a computer in the most improbable way. Kids in Tamil Nadu taught them the basics of DNA.

When he gave his talk previously, in the LIFT conference in 2007, he entitled it “Kids can teach themselves”. There is a positive, affirmative statement there that kids can learn anything, and they always seem to find ways to work around problems in doing so when given the chance. There are a lot of echoes of Seymour Papert’s philosophy about education and the role of technology to enable fundamentally different ways of teaching that are more effective and user-driven.

And his stories of kids teaching themselves via technology, kids without many resources or a good education to begin with, sometimes teaching themselves basic English just to operate a computer, brings us back to the beginning. It reminds me of the fact that Power Turtle has the ability to support any human language in teaching the basics of programming that extends into a full-blown programming language also in their native tongue.

There is still a lot of interesting and exciting work left to be done to deliver on that promise: in regards to programming education, and also in regards to supporting the diversity of languages of the world fully (the full stack from font to rendering to input method).