# Effective ATS: Word Counting

**URL:** <https://discourse.ats-lang.org/t/effective-ats-word-counting/73>\
**Category:** Google Group\
**Created:** [August 23, 2013, 6:11pm UTC](https://discourse.ats-lang.org/t/effective-ats-word-counting/73 "2013-08-23T18:11:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [August 23, 2013, 6:11pm UTC](https://discourse.ats-lang.org/t/effective-ats-word-counting/73/1 "2013-08-23T18:11:24Z")

</div>

FYI:

I wrote another piece in my Effective-ATS series:

[http://www.ats-lang.org/EXAMPLE/EFFECTIVATS/word-counting/](http://www.ats-lang.org/EXAMPLE/EFFECTIVATS/word-counting/)

This time, I presented an example to show that one could start with  
a simple running functional implementation and then turn it (with the help  
of  
linear types) into a memory-clean implementation that properly frees all the  
dynamically allocated memory before it terminates.

Cheers!

---

<div class="post-metadata">

**Author:** ![Zhiqiang\_Ren](https://avatars.discourse-cdn.com/v4/letter/z/9fc29f/32.png) [@Zhiqiang\_Ren](https://discourse.ats-lang.org/u/Zhiqiang_Ren)\
**Post date:** [September 4, 2013, 7:25pm UTC](https://discourse.ats-lang.org/t/effective-ats-word-counting/73/2 "2013-09-04T19:25:01Z")

</div>

Thanks for the example. I have two simple questions.

1. In [http://www.ats-lang.org/EXAMPLE/EFFECTIVATS/word-counting/main.html](http://www.ats-lang.org/EXAMPLE/EFFECTIVATS/word-counting/main.html),  
it provides a template solution for stateless word counting. In ATS, we can  
use , , and etc to specify whether a function is actually a  
closure. Do these decorators apply to template declaration?

2. In [wordcnt\_vt.dats], there is something like the following

list\_vt\_freelin$clear

Is this the new syntax of ATS2?

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [September 4, 2013, 7:41pm UTC](https://discourse.ats-lang.org/t/effective-ats-word-counting/73/3 "2013-09-04T19:41:15Z")

</div>

Answer to 1:

No. They do not apply to implementation (initiated by the keywork  
’implement’).

Answer to 2:

Yes, this syntax is new. The naming convention I use is this:

foo$bar refers to a template function used by another template function  
named foo.
