[erlang-questions] On Joe's micro-lightweight-unit-testing

Angel clist@REDACTED
Wed Mar 25 13:09:44 CET 2009


El Miércoles, 25 de Marzo de 2009 12:57:47 Daniel Goertzen escribió:
> Since K is already bound in K=fastfib(25), that expression becomes a
> comparison instead of a bind.
> 
> What the code really means is...
> 
> fib(25)  = fastfib(25),

Wow!!

 I see, just prolog syntax again!!

Thats why all attemps to rebind variables to new values fail ¿correct?
the bind becomes a comparison that only success on equal values?

K=2
K1=2

K=3  %% Fail!!
K=K1 %% Correct

Thanks!



> 
> Dan.
> 
> On Wed, Mar 25, 2009 at 6:52 AM, Angel <clist@REDACTED> wrote:
> 
> > Hi list
> >
> > Im very new to erlang, just still astonished about erlang and all, you
> > guys, say here
> >
> > Still im trying every day going deeper and deeper on erlang and functional
> > programing.
> >
> > Got recently very please reading Joe's introcction to TTD and Unit test on
> > erlang
> >
> > shttp://
> > armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html
> >
> > some where in the article Joe says..
> >
> > step 4) Add unit tests for fastfib
> >
> > test/0 looks like this:
> >
> > test() ->
> > 0 = fib(0),
> > 1 = fib(1),
> > 1 = fib(2),
> > 6765 = fib(20),
> > 0 = fastfib(0),
> > 1 = fastfib(1),
> > 1 = fastfib(2),
> > 2 = fastfib(3),
> > K = fib(25),
> > K = fastfib(25),
> > ok.
> >
> > Here I check that fastfib returns the same value as fib with the lines
> >  K = fib(25),
> > K = fastfib(25).
> >
> > But K=fib(25) binds K to the value fib(25) so, K= fastbib(25) must be wrong
> > as K was previously bound to fib(25) ¿isnt it?
> >
> > so, What im missing here ?
> >
> > Thanks
> >
> > --
> > No imprima este correo si no es necesario. El medio ambiente está en
> > nuestras manos.
> > __________________________________________
> >
> > Clist UAH a.k.a Angel
> > __________________________________________
> > ...being the second biggest search engine in the world is good enough for
> > us. Peter @ Pirate Bay.
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> 
> 
> 



-- 
Este correo no tiene dibujos. Las formas extrañas en la pantalla son letras.
__________________________________________

Clist UAH a.k.a Angel
__________________________________________
Money is a good standard. Micro$oft.



More information about the erlang-questions mailing list