About Archive Tag Cloud Translations RSS

You are writing a comment about Writing Join in Erlang, here is a quick summary:

Erlang doesn't have a built in function for joining strings, and so I sat down to put one together quickly. A quick look at two different ways that join can be implemented.


You are responding to this comment written by Will on May 5th 2008, 03:24.

First, restoring some syntax coloring/formatting that my comments probably previously stripped (sorry!).

implode(Data, Seperator) when is_list(Data) 
                     andalso is_list(Seperator) ->
       lists:foldr(fun(X,[]) -> X; 
              (X,Acc) -> X++Seperator++Acc end,
           "", Data).
   

Second, that is a pretty impressive solution. Certainly more so than either of mine. Thanks.

One thing I will say about functional programming, is that I find it more difficult to glance at a piece of code and make sense of it quickly, I suppose because functional code tends to be more compact. I suppose it'll come with practice. ;)


Please be aware that comment forms go stale after one hour.





Comments may make use of LifeFlow MarkDown. Raw html will be escaped.


Quick Introduction to LifeFlow MarkDown Syntax

A highlighted code block:

@@ ruby
def a (b, c):
  b * c
end
@@

Other common languages work as well: scheme, python, java, html, etc.

Other markdown syntax:

 ### This is an h3 title
#### This is an h4 title
**this is bold**
*this is italics*

1. This is an
2. ordered list

* And an unordered
* list too

[this is a link](http://www.lethain.com/ "Lethain")