Posts

Showing posts with the label erlang

My programming language usage

In recent months, I've been developing Python (Geany, Netbeans), BASH (gedit, Geany) and a bit of HTML/Javascript (Netbeans, Geany) for work, Java (Eclipse) for coursework, Erlang (Emacs, sometimes Geany) and a bit of Emacs LISP (Geany) for labwork, and Haskell (Geany) for my own needs. I have also refreshed my Logo (Geany) skills recently to refactor two of my homeworks. I will move to C++/Qt/FFmpeg/SQLite (Qt Creator) again in the upcoming days for some time. I have dug into Gnome's Genie (and Vala) and will write a short overview of the language soon. That's 8-10 languages at my fingertips, but a few more aren't deep down below either, like C (you never forget the horror), Ada (hard to forget the beauty), Pascal (need to find a way to convert to Ada), Eiffel (have seen it, but no professional coding done in it yet). Sadly, I'm not allowed to share my Python code, and some of my more interesting BASH scripts. You also can't enjoy some unpublished parts of Refa...

OCaml vs. Haskell

Do you prefer laziness or ease of compiler implementation and proof of correctness? Haskell feels very comfortable to me, and I can write some beautiful code in it. Laziness could introduce some complexity to reason about temporary memory usage. It's the same reason I like Erlang: quick, dirty, but also elegantly minimalistic and predictable. I haven't tackled OCaml ( yet ;->). Do you think it worths it? OCaml vs. Haskell discussion at Y-Combinator Haskell performance is on par with OCaml (shootout.alioth.debian.org) do note, that the Haskell compiler and solutions have evolved since then

Erlang vs. Scala

From Yariv’s Blog: Erlang vs. Scala - aspects discussed: concurrent programming, hot code swapping, garbage collection, scheduling, distributed programming, mnesia, tail recursion, network IO, remote shell, simplicity, libraries, reliability and scalability See also: bkil: Haskell vs. Erlang vs. Scala

Nice and clean bash scripting for dialyzer dependencies

edit2: New escaper run. edit: Backslash is fixed now. I made a nice script that checks an Erlang source tree for base library dependencies. I needed this in order to speed up the system library PLT building analysis phase of the Dialyzer on my old computer. The trivially implemented algorithm is only an approximation based on sed-processed program text, but according to my review it's should almost never generate a smaller set of packages than a proper parser. Note that even a proper parser would have problems with the pathological cases which this simple one would fail on. The style is, however, much more interesting if you take a look at the attached code. What do you think about it? #!/bin/dash ##### library code ### # unpure! debug(){  [ -n "$NDEBUG" ] &&   echo "DEBUG:" "$@" >> $LOG } # unpure! warning(){  echo "warning:" "$@" >> $LOG } # unpure! error(){  echo "error: ${1}!" >&2  sleep 1  ...

Is Java a slow language?

You can have a look for yourself at the Computer Language Benchmarks Game: Java vs. Erlang ( Erlang in the industry ) Java vs. Scala Java vs. C# Mono (note that I'm told that Mono's runtime may be inferior in some aspects to the official .NET CLR) Various approaches to detailed analysis: Java performance (Wikipedia) Java is Slow Revisited (2007) Performance of Java versus C++ by J.P.Lewis and Ulrich Neumann, Computer Graphics and Immersive Technology Lab, University of Southern California (2003) Java theory and practice: Urban performance legends, revisited (IBM, 2005) Java Performance (Code Instructions) All in all, we can conclude that neither Java, nor it's much higher level sibling, Scala deserves a reputation for being slow, though memory usage does show room for improvement. However, I would look forward to seeing results of the game tests ran under different virtual machines. I am working on a post about efficient high level embedded programming (including Java),...

Program Erlang/OTP without the syntax quirks

I think I can say that you can be pretty comfortable with Erlang after a while, but you never forget how clear and conscious Haskell (or Scala, etc.) code is compared to that. If only you needed to type less punctuation and if it had static types... Anyway you can both have your pie and eat it according to some projects: Targeting a Haskell compiler for the Erlang BEAM The following were newbie hacking attempts at transforming Haskell syntax to Erlang syntax at the source level: The Haskerl index of some related mails [erlang-questions] Any recent progress on Haskerl? (the project page blog.tornkvist.org seems to be unavailable at the moment)

Haskell vs. Erlang vs. Scala

Comparing Haskell , Erlang and Scala by way of examples and intelligent analysis: An Example Syntax in Haskell, Erlang and Scala (blogtrader) The multicore crises: Scala vs. Erlang (a detailed and informed analysis by Niclas Nilsson and nice follow-up discussion) Programming language shootout game on x86-64: Haskell Programming language shootout game on x86-64: Erlang Programming language shootout game on x86-64: Scala Of course, all three are great languages, with Haskell having an edge over the competition in pureness and syntax neatness, Scala in technology, experience transfer and sometimes syntax, while Erlang has the edge over provenly great concurrency, scalability and a beginner-friendly straight-forward syntax - in exchange for being a dynamic language. Expect to read more introductory articles on Scala in the future.

Quine in Erlang

How could I have forgotten about the friend of mine who's fond of Erlang? :-D -module(q). -export([s/0]). s()->io:format("~s~p.\n",[p(),p()]). p()->"-module(q).\n-export([s/0]).\n\ns()->io:format(\"~s~p.\\n\",[p(),p()]).\n\np()->". Here's another one for the Eshell REPL: fun(P)->io:format("~s\n~p).\n",[P,P])end( "fun(P)->io:format(\"~s\\n~p).\\n\",[P,P])end("). And as I know he's also in love with LISP, here's a Haskell variant rewritten in that spirit: (\ (x)-> ((++) x (show x)))"(\\ (x)-> ((++) x (show x)))"

Binary numbers toy in Erlang GS graphics

Because of popular demand, I have ported the previous example to Erlang using it's built-in GS package. Enjoy! :-D All code and text in this post is Copyright (c) bkil.hu [also known as bkil], 2009; and is licensed under the GNU GPL v2. Refer to the standard license texts from June 1991 for exact conditions. Here is an example link: http://www.gnu.org/licenses/gpl-2.0.html Here's the core (simbins.erl): -module(simbins). -export([radix/3, binaries/2, simbins/1]). %% Radix conversion with LSB output. radix(_,0,_) -> []; radix(R,W,N) -> [N rem R | radix(R, (W-1), (N div R))]. %% A full-matrix transpose stub. transpose([H|T]) when is_list(H) -> Append = fun(V, M) -> lists:zipwith(fun(E,L) -> [E|L] end, V, M) end, Vector = fun(L) -> lists:map(fun(E) -> [E] end, L) end, [RH|RT] = lists:reverse([H|T]), lists:foldl(Append, Vector(RH), RT). %% 'binaries' is a solution to Paul R. Potts's idea. %% Prepend `lists:reverse( ` to get MSB. bi...