Skip to main content

Erlang: Toying with Erlang

I'm really interested in distributed computing and concurrency right now. Given that I've been playing with Haskell so much, I thought I'd give Erlang a try since it's all about distributed computing, concurrency, and scalability.

I must admit that it already seems easier for me to read than Haskell. I'm not sure why. As I mentioned before, I do like Erlang-style concurrency, since strangely enough, that's how I had always thought things should work.

I'm fascinated by Mnesia, Erlang's distributed database. Unfortunately, according to this:
Mnesia is not perfect, of course, and its biggest downside at the moment is that its disc storage engine isn't suited for storing large volumes of data (Mnesia was designed for soft real-time applications where the data is stored mostly in RAM), but I hope this will be resolved in the not-too-distant future.
This is a major downer for me because I'm currently interested in terabyte-sized data sets. Nor is there a suitable MySQL driver.

Yaws is the Web application framework for Erlang. I can't say whether it's good or bad, but as a matter of taste, ever since I used Apache's Element Construction Set back in the day, I've had a particular dislike for generating HTML using programming language syntax as is done in Yaws:
%% the little status field in the upper left corner
head_status(User) ->
T =
{ehtml,
{table, [],
{tr, [],
[{td, [{width, "30%"}],
{table, [ {border, "1"}, {bgcolor, beige},{bordercolor, black}],
[{tr, [], {td, [], pb("User: ~s", [User])}}
]}
},
{td, [{align, right}], {img, [{src, "junk.jpg"}
]}}
]
}
}
}.
Yuck :(

Nonetheless, Erlang has already taught me new ways of thinking about distributed computing. I guess I'm wondering if there's anything I can't do the Erlang way in Python. Afterall, consider Candigram, which is an implementation of Erlang concurrency primitives in Python; although Candigram itself doesn't provide microthreads like Erlang. That reminds me, I'm still looking for an answer to my post Limitations of Coroutines via Enhanced Generators.

And if you're wondering--no, I don't know what the hell I'm talking about! I've only been looking at this stuff for like two days! I guess I should just shut up and go back to reading Erlang for C, C++ and Java Programmers. Hmm, I wonder where the tutorial for Python programmers is ;)

Comments

jjinux said…
http://erlang.org/faq/x479.html#AEN513

Ugh, so you mean I won't have regular expressions that support UTF-8?
jjinux said…
More about Mnesia's limitations:

http://erlang.org/faq/x1409.html

The ODBC driver for Erlang:

http://www.erlang.se/doc/doc-5.4/lib/
odbc-2.0.2/doc/html/part.html
Andrew Dalke said…
Try out stackless python.
jjinux said…
I have. I was really looking for the benefits of stackless Python without the heavy-handed approach that it uses to implementing it ;)
Richard said…
I quite liked this simple equivalent to Stackless's tasklets written in lisp or scheme (same difference to me). As you can see from the comment I added, the lisp test case maps pretty much one to one to the Stackless one.
Andrew Dalke said…
I was really looking for the benefits of stackless Python without the heavy-handed approach that it uses to implementing it ;)

Though it's not as heavy-handed as switching to a different language entirely. Think of it as a different language which just happens to support existing Python code and extensions.
Steve Jenson said…
You can fragment mnesia tables to store terabytes of data. Check out
Section 5.3
jjinux said…
Thanks for all the great comments guys!
Bill Mill said…
What about this or this as your erlang mysql driver?
Bill Mill said…
whoops, those two links are to the same driver. Anyway, have you tried it? It looks pretty nice to someone who hasn't tried it.
Anonymous said…
Candygram is spelled w/ a "y", not an "i"
Qrilka said…
Have you tried Erlyweb?
BTW Yaws is actually a Web server not a framework (wich is Erlyweb on top of Yaws)
Anonymous said…
check out yarivsblog.com, this guy yariv is building all kinds of erlang webby stuff....incl a mysql driver, web framework, template language, object-relational mapping, and a macro system.
jjinux said…
> check out yarivsblog.com

Yeah, I was checking it out before. He seemed at the same time brilliant and "young" (meaning, he was doing stuff that I had done before but turned out not to like). I'm sure he's smarter than I am ;)
jjinux said…
> What about this or this as your erlang mysql driver?

Nope, I haven't tried it. I think it came out after I looked last.

> Candygram

My apologies.

> Have you tried Erlyweb?

No, it's new to me.

Wow! So many Erlang comments!

Popular posts from this blog

Ubuntu 20.04 on a 2015 15" MacBook Pro

I decided to give Ubuntu 20.04 a try on my 2015 15" MacBook Pro. I didn't actually install it; I just live booted from a USB thumb drive which was enough to try out everything I wanted. In summary, it's not perfect, and issues with my camera would prevent me from switching, but given the right hardware, I think it's a really viable option. The first thing I wanted to try was what would happen if I plugged in a non-HiDPI screen given that my laptop has a HiDPI screen. Without sub-pixel scaling, whatever scale rate I picked for one screen would apply to the other. However, once I turned on sub-pixel scaling, I was able to pick different scale rates for the internal and external displays. That looked ok. I tried plugging in and unplugging multiple times, and it didn't crash. I doubt it'd work with my Thunderbolt display at work, but it worked fine for my HDMI displays at home. I even plugged it into my TV, and it stuck to the 100% scaling I picked for the othe

Drawing Sierpinski's Triangle in Minecraft Using Python

In his keynote at PyCon, Eben Upton, the Executive Director of the Rasberry Pi Foundation, mentioned that not only has Minecraft been ported to the Rasberry Pi, but you can even control it with Python . Since four of my kids are avid Minecraft fans, I figured this might be a good time to teach them to program using Python. So I started yesterday with the goal of programming something cool for Minecraft and then showing it off at the San Francisco Python Meetup in the evening. The first problem that I faced was that I didn't have a Rasberry Pi. You can't hack Minecraft by just installing the Minecraft client. Speaking of which, I didn't have the Minecraft client installed either ;) My kids always play it on their Nexus 7s. I found an open source Minecraft server called Bukkit that "provides the means to extend the popular Minecraft multiplayer server." Then I found a plugin called RaspberryJuice that implements a subset of the Minecraft Pi modding API for B

Creating Windows 10 Boot Media for a Lenovo Thinkpad T410 Using Only a Mac and a Linux Machine

TL;DR: Giovanni and I struggled trying to get Windows 10 installed on the Lenovo Thinkpad T410. We struggled a lot trying to create the installation media because we only had a Mac and a Linux machine to work with. Everytime we tried to boot the USB thumb drive, it just showed us a blinking cursor. At the end, we finally realized that Windows 10 wasn't supported on this laptop :-/ I've heard that it took Thomas Edison 100 tries to figure out the right material to use as a lightbulb filament. Well, I'm no Thomas Edison, but I thought it might be noteworthy to document our attempts at getting it to boot off a USB thumb drive: Download the ISO. Attempt 1: Use Etcher. Etcher says it doesn't work for Windows. Attempt 2: Use Boot Camp Assistant. It doesn't have that feature anymore. Attempt 3: Use Disk Utility on a Mac. Erase a USB thumb drive: Format: ExFAT Scheme: GUID Partition Map Mount the ISO. Copy everything from