[erlang-questions] Trying to learn the Erlang Way

Fred Hebert mononcqc@REDACTED
Fri Feb 7 15:52:55 CET 2014


It's not exactly helpful right now, but I would recommend you use what
is more or less the standard way to write Erlang functions (methods are
for other languages!) and use the following format:

    coordinate_greater_than(V, {X, Y, Z}) when ....

This generally makes it easier to spot variables from functions and in
my opinion makes the code a bit more readable, whether you use syntax
highlighting or not.

There's this old document from Ericsson on Erlang style guidelines:

http://www.erlang.se/doc/programming_rules.shtml

Some of them are more fluid than others and debatable, but they're very
good guidelines to read and absorb no matter what.

Regards,
Fred.

On 02/07, kraythe . wrote:
> Man I feel silly. but then I am fighting a chest cold. I guess this happens
> easier when you don't have completion or highlighting that I am used to in
> an IDE.
> 
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
> 
> 
> On Fri, Feb 7, 2014 at 1:27 AM, Vlad Dumitrescu <vladdu55@REDACTED> wrote:
> 
> > Hi,
> >
> > On Fri, Feb 7, 2014 at 8:25 AM, kraythe . <kraythe@REDACTED> wrote:
> > > coordinateGreaterThan(V, {X, Y, Z}) when X > V; Y > V; Z > V -> true;
> > > coordinateGreaterThan(_, _) -> false.
> > >
> > > %% Culls the list of vectors X to only those that are in the sphere
> > devined
> > > by vector C as a center and R as a radius.
> > > cull(C, R, Vectors) when is_number(R), is_tuple(C) -> cull(C, R, Vectors,
> > > []).
> > > cull(C, R, Culled, []) -> Culled;
> > > cull(C, R, Culled, [Head|Tail]) ->
> > >   D = subtract(C, Head),
> > >   case coordinateIsGreaterThan(R, Head) of
> > >     true -> cull(C, R, Culled, Tail);
> > >
> > > 1) Why is it saying my coordinateIsGreaterThan/2 method is undefined
> > when I
> > > can see it here and then to say it is unused in the next line? That seems
> > > contradictory?
> >
> > Look carefully and see that you define "coordinateGreaterThan" and
> > call "coordinateIsGreaterThan".
> >
> > regards,
> > Vlad
> >

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list