Simulated optics experiment/Data analysis: Difference between revisions

→‎{{header|ATS}}: Forget the Boehm GC
(Added ATS.)
(→‎{{header|ATS}}: Forget the Boehm GC)
Line 58:
I know ATS can be very difficult to comprehend if you do not know the language, but there is not much "ATSism" in this code. It likely is readable by many. The following peculiarities do occur: some of the loops are written as tail recursions (which Schemers, ML-users, etc., probably will have no difficulty with), and there is C code embedded in the program in more than one way. I embed C code in part to avoid using libraries other than the ATS prelude, which is minimal.
 
The program will have to be linked with the C math library and with an allocator, which can be malloc(3), although(despite free(3) willnever not bebeing called.), Ibecause usedthe Boehmonly GC (whichallocation is slowerfor thanthe my malloc, so probably a bad idea, but c'est la vie)array:
<pre>patscc -O2 -std=gnu2x -DATS_MEMALLOC_GCBDWDATS_MEMALLOC_LIBC optics_simulation_analysis_task.dats -lgc -lm</pre>
 
(It is my habit to tell patscc to use C beyond -std=c99)
<pre>patscc -O2 -std=gnu2x -DATS_MEMALLOC_GCBDW optics_simulation_analysis_task.dats -lgc -lm</pre>
 
<syntaxhighlight lang="ats">
1,448

edits