DISQUS

DISQUS Hello!  The comments on this profile are unclaimed and thus are unverified.

Do they belong to you? Claim these comments.

rvirding's picture

Unregistered

Feeds

aliases

  • rvirding
  • Robert Virding

rvirding

1 month ago

in Building a Parser-Generator in Erlang, Part 2 - sean cribbs :: digital renaissance man on sean cribbs
Nice! But a bit unfair comment about comparing readability with the output of LALR generators as they are definitely not for human consumption. And yours was hand-written.
1 reply
Sean Cribbs Robert, that is true, but it is very helpful to have readable code when debugging a generated parser, as is the case with any code.

4 months ago

in Optimizing Erlang - A death match of arrays and tuples on Think Erlang!
There are a number of comments I must make here:

- One important reason why using the array module is faster than gb_trees - array is optimised to use integer keys while gb_trees must be able to handle any key. This make a difference.

- Setting a value in gb_trees is more efficient if you know whether you are inserting a new value (gb_trees:insert) or updating an existing value (gb_trees:update). The gb_trees:enter is general and slower than either of the others.

- Tree based structures can be sensitive to in which order elements are added to them.

- Try using dict, which in some cases is faster than gb_trees, or my rbdict (not in standard OTP) which has the same api as dict but uses another tree structure. Both, like gb_trees, can handle any type of key.

It is a very interesting problem of course, but you usually end up testing the various options for your specific application and choosing the best one. Or at least you should. :-) Also the API's have a different style and provide different features so you may find that one suits your needs better than the others irrespective of speed.

1 year ago

in Why Make Erlang a Functional Language? on Humanist → Blog
I think that if you actually looked at Erlang you would see that the reason for this is very simple and obvious. In Erlang it is perfectly legal to have *different* functions with the same name but with different arities, so if you want to reference a function uniquely you need to specify the arity. Of course, in some limited situations this may not be necessary but in the general case it is.

This is usually demonstrated in the second version of factorial shown, the tail-recursive one.

Sorry for being so sarcastic here but this feature is so basic that to have missed it is really surprising.

1 year ago

in Erlang: An Introduction to Records | 20bits on 20bits
Records were never intended to be anything else other than providing named fields for tuples. In this respect they *are* like C structs and should not be confused with associative arrays, use dict, orddict or gb_trees for that. Or ETS.
Returning? Login