[m-rev.] Trivial diff: improve fft.m in extras

Ralph Becket rafe at cs.mu.OZ.AU
Mon Sep 12 14:35:36 AEST 2005


Estimated hours taken: 0.25
Branches: main

extras/complex_numbers/samples/fft.m:
	Use `Re + Im*i' instead of `complex(Re, Im)'.

Index: extras/complex_numbers/samples/fft.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/complex_numbers/samples/fft.m,v
retrieving revision 1.7
diff -u -r1.7 fft.m
--- extras/complex_numbers/samples/fft.m	8 Sep 2005 07:44:02 -0000	1.7
+++ extras/complex_numbers/samples/fft.m	12 Sep 2005 04:31:53 -0000
@@ -25,23 +25,26 @@
 %------------------------------------------------------------------------------%
 :- interface.
 
-:- import_module io, list, complex_numbers, complex_numbers.complex.
+:- import_module io.
 
 :- pred main(io::di, io::uo) is det.
 
-:- pred fft(list(complex), list(complex)).
-:- mode fft(in, out) is det.
-
 %------------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module float, int, math, require.
+:- import_module float, int, list, math, require.
+:- import_module complex_numbers, complex_numbers.complex.
+:- import_module complex_numbers.float_imag, complex_numbers.imag.
 
 main(!IO) :-
-	fft([cmplx(1.0, 0.0), cmplx(0.0, 0.0), cmplx(1.0, 0.0), 
-		cmplx(0.0, 0.0)], T),
+	Zero = 0.0 + 0.0*i,
+	One  = 1.0 + 0.0*i,
+	fft([One, Zero, One, Zero], T),
 	io.write(T, !IO),
 	io.nl(!IO).
+
+:- pred fft(list(complex), list(complex)).
+:- mode fft(in, out) is det.
 
 fft(Ins, Outs) :-
 		% First put the list into bit-reversed order.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list