background preloader

Erlang

Facebook Twitter

Domain Specific Languages in Erlang. People are talking about Erlang. This talk is disproportionately about concurrency rather than any of the other powerful properties of the platform, such as reliability. This article is about a property of Erlang which does not get the credit it deserves - Erlang is a fantastic workbench for Domain Specific Languages. The domain I have chosen is investment finance. You will see how easy it is to translate plain English at runtime and execute it in the Erlang Runtime System. You may also learn a thing or two about functional programming. The Erlang reference manual is a good place to start if you get lost along the way. Let's begin with a high level run through of how this DSL can be used and move into a step by step detailed discussion of the implementation.

Implementation The first three echo commands create the file biz_rules.txt, populating it with three rules. Our DSL exists in an Erlang module called "dsl", consisting of a single file called dsl.erl. Spawning a Broker Conclusion. Tsung. Reading Erlang: CouchDB - From REST to Disk in a few function calls. As you can probably figure out from the title, the purpose of this post is to track how CouchDB is saving a document on the disk. We have already tracked how much of CouchDB works, including some fascinating pieces such as btree:lookup and btree:query_modify. Now it is time to dig ourselves from the trenches and have a slightly higher level view of what is going on. We start with the recently refactored couch_httpd_db module. The fun starts with handle_request. It took me a few seconds to realize what is going on here.

As we can see, the create_db_req and delete_db_req have different disposal semantics than do_db_req. do_db_req will just open/close the database and then execute the function in the cotext of this database handle. This is quite a common pattern in functional programming, and it used frequently in Ruby. This is where we are handling with a request for a specific document. couch_util:dict_find is where we need to look now... couch_doc:from_json_doc is interesting, though. Learn You Some Erlang for Great Good!

Hey there, it appears your Javascript is disabled. That's fine, the site works without it. However, you might prefer reading it with syntax highlighting, which requires Javascript! Introduction Starting Out Starting Out (for real) Modules Syntax in Functions Types (or lack thereof) Recursion Higher Order Functions Errors and Exceptions Functionally Solving Problems A Short Visit to Common Data Structures The Hitchhiker's Guide to Concurrency More On Multiprocessing Errors and Processes Designing a Concurrent Application What is OTP? Clients and Servers Rage Against The Finite-State Machines Event Handlers Who Supervises The Supervisors?

Building an Application With OTP Building OTP Applications The Count of Applications Release is the Word Leveling Up in The Process Quest Buckets Of Sockets EUnited Nations Council Bears, ETS, Beets Distribunomicon Distributed OTP Applications Common Test for Uncommon Tests Mnesia And The Art of Remembering Type Specifications and Erlang Conclusion Postscript: Maps. Erlang App. Management with Rebar.

Introduction Rebar is a build and packaging tool for Erlang applications. It is implemented in Erlang and the only dependency is the Erlang Virtual Machine, so it can work as a stand-alone escript in your project. Rebar was created by Dave Smith from Basho, creators of Riak. In this tutorial I'll be creating a sample application, building it and generating a release for it, all of this with Rebar. Application Requirements Rebar expects that your applications follows the OTP Design Principles.

The application directory must have the following sub-directories: - *src* - Contains the Erlang source code. - *ebin* - Contains the Erlang object code, the beam files. Don't worry about this, Rebar can create applications with this kind of directory structure automatically. Installation To install Rebar is very easy, just download it at: h2. To see what Rebar offers just execute . $ . Getting Started This was pretty easy to follow. -module(mysample_app) . $ .

OTP

Clustering.