<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7118778965888677191</id><updated>2011-09-01T16:58:57.635+01:00</updated><category term='Programming and Erlang'/><category term='General stuff'/><title type='text'>Robert on anything</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-2930568101117648535</id><published>2009-10-24T16:13:00.002+01:00</published><updated>2009-10-24T16:16:45.518+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>What are BIF's?</title><content type='html'>There has always been much confusion about what a BIF really is, how they relate to the Erlang language. An example of this was a discussion earlier this year when someone wanted to have some more functions in lists coded in C and so become part of Erlang. Saying that they are functions coded in C just tell us how they are implemented not what they *are*.&lt;br /&gt;&lt;br /&gt;The source of this confusion is very old and exists in the earliest documentation, where a BIF was described as function "which could not be written in Erlang or written in C for efficiency". They were in some sense implicitly part of Erlang and considered to be in the module 'erlang'. Some could be used without specifying the module but there was no clear reason why some needed the module and others did&lt;br /&gt;not.&lt;br /&gt;&lt;br /&gt;A first proper attempt to define what a BIF is came when Jonas Barklund and I wrote the Erlang specification. There we proposed that a BIF was part of the Erlang language that did not have a special syntax but looked like a normal function call. Spawn, link and trapexit are just as much part of Erlang as ! and receive even though they use normal function syntax and semantics. We also decided that it was irrelevant in what language the function was written, what was important was the function itself. This is analogous to processes where the semantics are what is important. I think this definition is correct but calling them BIFs was wrong.&lt;br /&gt;&lt;br /&gt;Our BIF proposals were put on ice together with the Erlang specification.&lt;br /&gt;&lt;br /&gt;The problem still remains and has not become better - there is still much confusion as to what a BIF is, if being coded in C has anything to do with it, and if being coded in C means that the functions automatically becomes part of the language. BEAM and the compiler also handle BIFs in many different ways which does not always help.&lt;br /&gt;&lt;br /&gt;Currently BIF is used to describe at least three different things:&lt;br /&gt;&lt;br /&gt;- Functions which are part of Erlang, spawn and link are examples of this.&lt;br /&gt;&lt;br /&gt;- Functions which are not part of Erlang but which are part of a basic runtime system, the trace BIFs are an example of this.&lt;br /&gt;&lt;br /&gt;- Functions which have been coded in C for efficiency, for example lists:reverse.&lt;br /&gt;(Some might not agree with separating the first two)&lt;br /&gt;&lt;br /&gt;Moving the module 'erlang' from kernel to erts is a step in the right direction. As is putting the new unicode BIFs (?) in a separate module, because they are not part of the language just a library where some functions are coded in C.&lt;br /&gt;&lt;br /&gt;OK, so why worry about it? Does it really matter? I think it does (or else I wouldn't be writing this mail) for the following reasons:&lt;br /&gt;&lt;br /&gt;- We need a proper language specification and this would be a part of it. Some day I plan to resurrect the old Erlang spec and get it up to date and we have to start somewhere.&lt;br /&gt;&lt;br /&gt;- It would clarify what is part of the language and what is not. This would put various discussions about adding things to the implementation/language in their proper context. So coding a function in lists in C would just become an implementation detail where the issue would be whether it is worth the extra effort to do this, and not misplaced discussions about adding to the language.&lt;br /&gt;&lt;br /&gt;- I think it would allow you to do more with the FFI than is proposed today and still be consistent with the language.&lt;br /&gt;&lt;br /&gt;- And it would help people realise and understand what is what - unclarity and confusion are never good.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-2930568101117648535?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/2930568101117648535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2009/10/what-are-bifs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/2930568101117648535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/2930568101117648535'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2009/10/what-are-bifs.html' title='What are BIF&apos;s?'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-1243831781066221090</id><published>2009-04-09T02:16:00.006+01:00</published><updated>2009-12-09T20:17:01.813Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>Backtracking in Erlang, part 2 - passing data</title><content type='html'>In the first part I showed how we could program backtracking in a generic way in Erlang. While Erlang does not directly support it, it is relatively easy to do. In this part we will look at some ways of handling data within this context. The basic problem is how to get data out of a function as in this context functions never return.&lt;br /&gt;&lt;br /&gt;For a specific application this may not be a problem as either each function always explcitly knows what the contunation is, or a it is possible to have a local convention of how to pass arguments. For an example of this see the Erlog parser in the file erlog_parse.erl where each continuation function has two arguments, the remaining tokens and the term parsed so far. This works well for this specific case.&lt;br /&gt;&lt;br /&gt;This is not possible in the general case or when writing generic functions. Seeing we cannot return values we will adopt the method used in logic languages like prolog (or C) of "returning" values through the function arguments. For example the following "function" fubar/2 (written in a logic style) which takes input in the argument X and "returns" data through the argument Y:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;fubar(X, Y) :- foo(X, M, N), bar(M, O), baz(N, O, Y).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Each of the functions foo/3, bar/2 and baz/3 behave in a similar way but they have varying numbers of input and output arguments.&lt;br /&gt;&lt;br /&gt;I will show one way how this can done. We will define a variables structure which contains the bindings of variables. It has the following interface:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;new_vars() -&gt; Vars.&lt;br /&gt;new_var(Vars) -&gt; {Var,Vars}.&lt;br /&gt;bind_var(Var, Value, Vars) -&gt; Vars.&lt;br /&gt;get_var(Var, Vars) -&gt; Value.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;A requirement on the Vars structure is that all variable bindings are undone on backtracking. Note that we are not really defining logical variables here or implementing unification, we are just creating variables and binding them. There is no default value for a variable, trying to get the value of an unbound variable will generate an error.&lt;br /&gt;&lt;br /&gt;We will adopt the convention that all continuation functions have one argument and they will be called with the current Vars structure. We will also adopt the convention that each normal function will have its arguments in the following order: first come normal Erlang arguments, then the Vars structure, then the arguments which use the Vars structure with the input arguments first followed by the output arguments, and finally the continuation. Using Vars and this convention we could translate fubar/2 into the following Erlang function:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;fubar(Vars0, X, Y, Next) -&gt;&lt;br /&gt;    %% Create the new variables in fubar.&lt;br /&gt;    {M,Vars1} = new_var(Vars0),&lt;br /&gt;    {N,Vars2} = new_var(Vars1),&lt;br /&gt;    {O,Vars3} = new_var(Vars2),&lt;br /&gt;    Next2 = fun (Vars) -&gt; baz(Vars, N, O, Y, Next) end,&lt;br /&gt;    Next1 = fun (Vars) -&gt; bar(Vars, M, O, Next2) end,&lt;br /&gt;    foo(Vars, X, M, N, Next1).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here we have assumed that fubar is part of a larger application which has created the Vars structure. The continuation function is called with the current Vars. So for example the (trivial) function bar/2 which has M as input and binds O for output could be written:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;bar(Vars0, M, O, Next) -&gt;&lt;br /&gt;    Mval = get_var(M, Vars),&lt;br /&gt;    Oval = &lt;do&gt;do_stuff(Mval),&lt;br /&gt;    Vars1 = bind_var(O, Oval, Vars),&lt;br /&gt;    Next(Vars1).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Choice points are now introduced by:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cp([fun (Vs) -&gt; do_stuff_a(Vs, Next) end,&lt;br /&gt;   fun (Vs) -&gt; do_stuff_b(Vs, Next) end,&lt;br /&gt;   fun (Vs) -&gt; do_stuff_c(Vs, Next) end,&lt;br /&gt;   ...], Vars).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The code for cp/2, is still simple:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cp(Vars, [G|Gs]) -&gt;&lt;br /&gt;   case G(Vars) of&lt;br /&gt;       {succeed,Value} -&gt; {succeed,Value};&lt;br /&gt;       fail -&gt; cp(Vars, Gs)&lt;br /&gt;   end;&lt;br /&gt;cp(_, []) -&gt; fail.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We see here that if the Vars structure does not use side effects then we will automatically undo all bindings on backtrackíng.&lt;br /&gt;&lt;br /&gt;I will give a simple definition of the Vars structure and its interface. It uses dicts to store the variable bindings.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-record(vars, {vc,dict}).&lt;br /&gt;&lt;br /&gt;new_vars() -&gt; #vars{vc=0,dict=dict:new()}.&lt;br /&gt;&lt;br /&gt;new_var(#vars{vc=Vc,dict=Dict}=Vars) -&gt;&lt;br /&gt;   {{var,Vc},Vars#vars{vc=Vc+1}}.&lt;br /&gt;&lt;br /&gt;bind_var({var,Var}, Value, #vars{dict=Dict}=Vars) -&gt;&lt;br /&gt;   Vars#vars{dict=dict:store(Var, Value, Dict)}.&lt;br /&gt;&lt;br /&gt;get_var({var,Var}, #vars{dict=Dict}) -&gt;&lt;br /&gt;   dict:fetch(Var, Dict).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's it, we're done. Again a lot of explanation for quite a simple concept and very little code.&lt;br /&gt;&lt;br /&gt;In the next installment I will give an example of how this can be used and some problems with the current implementation.&lt;/do&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-1243831781066221090?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/1243831781066221090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2009/04/backtracking-in-erlang-part-2-passing.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1243831781066221090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1243831781066221090'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2009/04/backtracking-in-erlang-part-2-passing.html' title='Backtracking in Erlang, part 2 - passing data'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-7419155245256891214</id><published>2009-03-18T01:47:00.010Z</published><updated>2009-12-09T20:23:26.757Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>Backtracking in Erlang, part 1 - control</title><content type='html'>Sometimes you need to be able to do search algorithms which can step back and try other alternate ways of finding a solution, "backtracking". Generally this is difficult to do in functional languages like Erlang (most other languages too for that matter). A classic example of this type of problem is parsing ambiguous grammars.&lt;br /&gt;&lt;br /&gt;Prolog syntax is like that, in some cases you need almost indefinite look-ahead before you can decide how input is to be parsed. When I implemented Erlog (a prolog in and for Erlang) I decided to do the parser in Erlang so that it could run stand-alone and so I ran straight into this problem.&lt;br /&gt;&lt;br /&gt;Here is *a* solution to the problem. It is in two parts, the first describing the control structures and the second (more difficult) describing handling of data. There may also be a third part discussing some problems with the solution to control, if anyone is still interested.&lt;br /&gt;&lt;br /&gt;The main problem we have to overcome is that normally when you choose a path you "commit" to it and can't go back and try an alternate path. For example in:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;case get_a_value() of&lt;br /&gt;    Choice1 -&gt; ... ;&lt;br /&gt;    Choice2 -&gt; ... ;&lt;br /&gt;    ...&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;once you have chosen a path, say Choice1, there is no (simple) way to go back try Choice2 if you later decide that Choice1 was wrong. We can't backtrack.&lt;br /&gt;&lt;br /&gt;Another problem is that if we have:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;a() -&gt; foo(), bar(), baz().&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and once we have completed foo() then even if it gave an answer which later was shown to be wrong there is no way to step back into it, backtrack, and let it give a new answer.&lt;br /&gt;&lt;br /&gt;In this first section we will (almost) completely ignore arguments and return values.&lt;br /&gt;&lt;br /&gt;When looking at control we will (almost) completely ignore arguments and returning values. We will use the convention that functions return either '{succeed,Value}' when they succeed or 'fail' when they can't find a solution.&lt;br /&gt;&lt;br /&gt;The trick is to ensure that functions only return at all when they fail, otherwise they just continue by explicitly calling the next thing which should be done. We will do this by using a Continue Passing Style (CPS) where each function will have an argument which is the next function call to continue. (CPS is not new and is generally known) So functions will usually look like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;a(Next) -&gt;&lt;br /&gt;    do_stuff(),&lt;br /&gt;    OurNext = fun () -&gt; even_more_stuff(Next) end,&lt;br /&gt;    more_stuff(OurNext).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We will use the convention that when a function fails and cannot go on it will return 'fail'. When *the* solution has been found then the final test will return {succeed,Value}. So the top level function will look something like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;top_call() -&gt;&lt;br /&gt;    Succeed = fun () -&gt; {succeed,yes} end,        %We have succeeded&lt;br /&gt;    find_solution(Succeed).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So now our program will keep going forwards until it finally calls the Succeed fun when it all returns back to the initial caller.&lt;br /&gt;&lt;br /&gt;The next problem is to introduce 'choice points' where we can choose one path but still allow the code to backtrack and make another choice. This is the done in the function cp/1 where the argument is a list functions which are separate paths to choose from:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cp([fun () -&gt; do_stuff_a(Next) end,&lt;br /&gt;    fun () -&gt; do_stuff_b(Next) end,&lt;br /&gt;    fun () -&gt; do_stuff_c(Next) end,&lt;br /&gt;    ...]).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Cp/1 will try the functions in order, if one succeeds then the choice point will succeed and return the same succeed value, if it fails then the next function in the list will be tried, until no more exist when the choice point will fail: The code for cp is simple:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cp([G|Gs]) -&gt;&lt;br /&gt;    case G() of&lt;br /&gt;        {succeed,Value} -&gt; {succeed,Value};&lt;br /&gt;        fail -&gt; cp(Gs)&lt;br /&gt;    end;&lt;br /&gt;cp([]) -&gt; fail.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's it, we're done. A lot of explanation for very little code.&lt;br /&gt;&lt;br /&gt;A slight variation is to not chain the continuation together as shown here but to have Next as a list of functions to call. Instead of directly calling Next you call next/1 with argument Next, next(Next), where next/1 is defined as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;next([N|Ns]) -&gt; N(Ns).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There is no functional difference it just make writing some code a bit easier. For example the function defined above:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;a() -&gt; foo(), bar(), baz().&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;would look like this in the normal way:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;a(Next) -&gt;&lt;br /&gt;    Next1 = fun () -&gt; baz(Next) end,&lt;br /&gt;    Next2 = fun () -&gt; bar(Next1) end,&lt;br /&gt;    foo(Next2).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;while using the list variant it would look like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;a(Next) -&gt;&lt;br /&gt;    foo([fun (Ns) -&gt; bar(Ns) end,&lt;br /&gt;         fun (Ns) -&gt; baz(Ns) end | Next]).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;which can be easier to read, especially if there many calls in the continuation.&lt;br /&gt;&lt;br /&gt;After I introduce handling data in the next installment I can give a proper example.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-7419155245256891214?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/7419155245256891214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2009/03/backtracking-in-erlang-part-1-control.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/7419155245256891214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/7419155245256891214'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2009/03/backtracking-in-erlang-part-1-control.html' title='Backtracking in Erlang, part 1 - control'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-8767584514535204425</id><published>2008-11-28T21:18:00.002Z</published><updated>2008-11-28T21:21:44.241Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>The Erlang Rationale - The problem with ‘if’</title><content type='html'>Sigh. If was added as an almost “on the spur of the moment” hack. We knew how to compile guards and thought it might be useful in the case where you don’t have a value to match against. As Erlang has pattern matching we found that a “pure” if is used less than in many other languages, we never used it much ourselves and therefore didn’t really worry much about it. This is not really that strange as in many languages if is used in way which resembles very trivial pattern matching. For example in C:&lt;br /&gt;&lt;br /&gt;if ((x = get_some_value()) != 0) {&lt;br /&gt;   do stuff with x&lt;br /&gt; else {&lt;br /&gt;   do some other stuff&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;Also I don’t really have a problem using case when I want to do a conditional, but then again I am so used to it I don't think about it.&lt;br /&gt;&lt;br /&gt;There have been repeated suggestions and discussions of either extending if to allow user defined boolean functions or adding a new construct. The problem with extending if is that the tests would no longer be guard tests and would handle differently for exceptions. A guard test silently just fails while a normal expression generates an error, which would make the change incompatible. We actually made cond a reserved word but never got around to adding it to the language.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-8767584514535204425?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/8767584514535204425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale-problem-with-if.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/8767584514535204425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/8767584514535204425'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale-problem-with-if.html' title='The Erlang Rationale - The problem with ‘if’'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-1977318368231713632</id><published>2008-11-08T22:23:00.002Z</published><updated>2008-11-08T22:25:20.740Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>The Erlang Rationale - Characters and strings</title><content type='html'>This is one non-terminating discussion we had.&lt;br /&gt;&lt;br /&gt;There have been many suggestions whether to have a proper type character data type or to leave them as integers. While adding a new type would not have been difficult we could not quite agree as to whether we should do it. If so which encoding should we use, stay with ASCII or go to ISO-8859-1 (Latin1) or UNICODE? If we changed to UNICODE should we also allow that in atoms as well? In the end we decided not to add a character type but make sure we could handle Latin1 in the libraries. As our primary application area was not handling text we felt that this was sufficient.&lt;br /&gt;&lt;br /&gt;Very early on we decided that strings were lists. This was partly environment as many of the languages we were using, such as Prolog, use lists and partly practical as lists are a very powerful data type.&lt;br /&gt;&lt;br /&gt;Using a general data type like lists and having characters is seldom as problem as you usually know what if you are processing a list which is a string or if it is something else. It is only within generic functions like printing or the shell where you can have problems with such a general data type.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-1977318368231713632?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/1977318368231713632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale-characters-and-strings.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1977318368231713632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1977318368231713632'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale-characters-and-strings.html' title='The Erlang Rationale - Characters and strings'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-6342377584180816645</id><published>2008-11-03T21:33:00.003Z</published><updated>2008-11-03T21:37:11.471Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>The Erlang Rationale</title><content type='html'>A while back I released the Erlang Rationale which is an attempt to explain why things look like they do in Erlang and our thinking behind many of the properties and features of the language. There is also some descriptions of part of the system which today seem to lack description, for example the i/o system and groups. The Rationale mainly deals with the core parts of the language and the older parts of the libraries and not OTP.&lt;br /&gt;&lt;br /&gt;It can be found on trapexit.org &lt;a href="http://forum.trapexit.org/viewtopic.php?t=15022"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The rationale is not finished and I am adding to it and expanding/improving what is already there. When there has been a significant enough change I will release a new version. However, someone suggested I could release new bits as they come and get comments and suggestions. This seems like a good idea and i will try it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-6342377584180816645?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/6342377584180816645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/6342377584180816645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/6342377584180816645'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/11/erlang-rationale.html' title='The Erlang Rationale'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-8674114030090254050</id><published>2008-07-06T23:24:00.002+01:00</published><updated>2008-07-06T23:29:17.800+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General stuff'/><title type='text'>Gogol på Roma Teatern</title><content type='html'>Igår var vi på Roma Teatern på Gotland och såg på Revisorn av Gogol. Det var en riktigt bra uppsättning och väl värt att se. Jag kan rekomendera att ni går och ser den om ni är på Gotland under sommaren.&lt;br /&gt;&lt;br /&gt;Det enda tråkiga var att få reda på hur lite bidrag Roma teatern får jämfört med t.ex. riktsteatrar och olika "fria" teatergrupper. Tydligen att göra bra uppsättningar år efter år som folk uppskattar är inte något som prioriteras av stat och kommun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-8674114030090254050?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/8674114030090254050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/07/gogol-p-roma-teatern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/8674114030090254050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/8674114030090254050'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/07/gogol-p-roma-teatern.html' title='Gogol på Roma Teatern'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-6838131314216958909</id><published>2008-03-19T01:34:00.003Z</published><updated>2008-03-19T07:53:14.065Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='General stuff'/><title type='text'>"Optimerad laddning"</title><content type='html'>Jag har en Sony Ericsson K610i som för det mesta tycks fungera bra (fast ibland tror jag att den stänger av sig själv). Det som förundrar mig är att när man laddar den så säger den "Optimerad laddning". Då undrar jag förstås om den även klarar av "Ooptimerad laddning" och vad i så fall är skillnaden. Eller är det bara någon marketroid  som har en tänkt lite mer än vad han/hon borde?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-6838131314216958909?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/6838131314216958909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/03/optimerad-laddning.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/6838131314216958909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/6838131314216958909'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/03/optimerad-laddning.html' title='&quot;Optimerad laddning&quot;'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-3791031381545377979</id><published>2008-01-11T02:02:00.000Z</published><updated>2008-01-11T11:00:22.910Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>Virding's First Rule of Programming</title><content type='html'>&lt;span class="q"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;After reading the blogs about how good Erlang's concurrency model is and how we just just made a super implementation of it in XXX I have been led to formulate Virding's First Rule of Programming&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;:&lt;br /&gt;&lt;br /&gt;Any sufficiently complicated concurrent program in another language contains &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.&lt;br /&gt;&lt;br /&gt;With all respect to Greenspun.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-3791031381545377979?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/3791031381545377979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2008/01/virdings-first-rule-of-programming.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/3791031381545377979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/3791031381545377979'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2008/01/virdings-first-rule-of-programming.html' title='Virding&apos;s First Rule of Programming'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-1559222798328346651</id><published>2007-09-30T13:56:00.000+01:00</published><updated>2007-09-30T14:37:04.857+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General stuff'/><title type='text'>Att installera Windows XP på en Dell XPS M1330</title><content type='html'>&lt;span style="font-family:arial;"&gt;I veckan fick jag en ny dator. Det är en Dell XPS M1330, en trevlig liten dator med god prestanda och ett bra grafikkort för att vara så liten. Enda verkliga nackdelen med den är att den endast leveras med Windows Vista.&lt;br /&gt;&lt;br /&gt;Av någon mystiskt anledning leveras den bara med Vista eftersom Dell anser att det är en dator för privatpersoner och dessa &lt;span style="font-weight: bold;"&gt;skall&lt;/span&gt; använda Vista. Nu skall jag ha den till jobbet där vi kör XP och jag f.ö. inte är intresserad av att använda Vista. Definitivt inte innan ett par service packs och troligen inte efter det heller.&lt;br /&gt;&lt;br /&gt;Då var problemet att få XP att fungera på den och att få rätta drivers till den. Dell supportar &lt;span style="font-weight: bold;"&gt;inte&lt;/span&gt; XP men det finns några drivers och applikationer på deras support sida. Efter lite sökning så hittade jag denna fantastiska tråd på dellcommunity som "tells it all":&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dellcommunity.com/supportforums/board/message?board.id=insp_general&amp;amp;thread.id=253132"&gt;http://www.dellcommunity.com/supportforums/board/message?board.id=insp_general&amp;amp;thread.id=253132&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;Jag har bara två kommentarer till vad som sägs där:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1. Jag behövde inte ladda ner något extra för att få ljudkortet att fungera, bara drivers&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. Jag hittade en bättre (och nyare) driver för grafikkortet genom:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;a href="http://www.laptopvideo2go.com/forum/index.php?showtopic=8128"&gt;&lt;br /&gt;http://www.laptopvideo2go.com/forum/index.php?showtopic=8128&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.laptopvideo2go.com/forum/index.php?showtopic=13742"&gt;http://www.laptopvideo2go.com/forum/index.php?showtopic=13742&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Med den info som fanns här kunde jag ladda nre drivers från NVIDIA's hemsida och mycket enkellt få det att fungera. Jag använder v162.18 nu.&lt;br /&gt;&lt;br /&gt;På det hela gick det mycket smärtfritt och var bara att ladda ner och installera allt.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-1559222798328346651?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/1559222798328346651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2007/09/att-installera-windows-xp-p-en-dell-xps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1559222798328346651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1559222798328346651'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2007/09/att-installera-windows-xp-p-en-dell-xps.html' title='Att installera Windows XP på en Dell XPS M1330'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-5036543197921367138</id><published>2007-05-22T00:40:00.000+01:00</published><updated>2007-05-22T00:52:06.642+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming and Erlang'/><title type='text'>New Erlang book</title><content type='html'>There is a new Erlang book coming out soon, &lt;span style="font-style: italic;"&gt;Programming Erla&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ng: So&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ftware for a Concurrent World&lt;/span&gt; by Joe Armstrong, which is very good and a great improvement over the old book. Apart from a very understandable description of the language it all also describes some of the more generally useful libraries, and gives real-world examples of how to use them. As I already know the language it is the second part of the book which I find most helpful.&lt;br /&gt;&lt;br /&gt;In all the book is well worth reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-5036543197921367138?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/5036543197921367138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2007/05/new-erlang-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/5036543197921367138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/5036543197921367138'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2007/05/new-erlang-book.html' title='New Erlang book'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7118778965888677191.post-1577994783167707455</id><published>2007-05-13T22:20:00.000+01:00</published><updated>2007-05-22T00:40:21.959+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General stuff'/><title type='text'>Dåliga förlorare</title><content type='html'>Efter att ha lyssnat en del på &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;ESC&lt;/span&gt; i går kväll så tycker jag att &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;kommentatorerna&lt;/span&gt; visade tecken på att vara extremt dåliga förlorare. Bara för att vi inte vann var allting kasst, östländerna bara kompisröstade och det hela var en stor skandal. Detsamma gäller många av de inlägg man läser i tidningarna idag.&lt;br /&gt;&lt;br /&gt;Den som ger sig in i leken får leken tåla, och det gör vi visst inte.&lt;br /&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7118778965888677191-1577994783167707455?l=rvirding.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rvirding.blogspot.com/feeds/1577994783167707455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rvirding.blogspot.com/2007/05/dliga-frlorare.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1577994783167707455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7118778965888677191/posts/default/1577994783167707455'/><link rel='alternate' type='text/html' href='http://rvirding.blogspot.com/2007/05/dliga-frlorare.html' title='Dåliga förlorare'/><author><name>Robert Virding</name><uri>http://www.blogger.com/profile/16187415127098159771</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ikZaw5hU8VI/SYMfzTgFTyI/AAAAAAAAAAM/Yt0b0wJdz7E/S220/Robert+i+badet.jpg'/></author><thr:total>0</thr:total></entry></feed>
