Imperative vs. functional vs. linear functional

506 views
Skip to first unread message

gmhwxi

unread,
Feb 4, 2016, 11:36:24 PM2/4/16
to ats-lang-users

I wrote a small article in the Effective-ATS series where
3 styles of programming are compared:

http://ats-lang.sourceforge.net/EXAMPLE/EFFECTIVATS/HanoiTowers/index.html

Imperative: difficult to reasonable
Functional: facilitating reasoning but is wasteful in terms of memory usage
Linear functional: Functional + efficient memory usage

Cheers!

--Hongwei

Raoul Duke

unread,
Feb 5, 2016, 12:44:16 PM2/5/16
to ats-lang-users

Website down.
Cannot say I have much love for sourceforge these days.

gmhwxi

unread,
Feb 5, 2016, 1:22:36 PM2/5/16
to ats-lang-users
There is a backup link at github:

http://ats-lang.github.io/EXAMPLE/EFFECTIVATS/
Message has been deleted

gmhwxi

unread,
Feb 6, 2016, 2:37:35 PM2/6/16
to ats-lang-users

anonymous anomymous

unread,
Feb 10, 2016, 5:45:46 AM2/10/16
to ats-lang-users
I always thought of functional programming somewhat wasteful (for reason mentioned) but superior to other programming styles. Linear functional ATS is really impressive. What am I saying? ATS on the whole is impressive! Thanks, Professor, for the article. I hope, in time, the language gets the popularity it deserves. I mean, it's sad that such a good language is a bit lacking in terms of attention. I often hear complaints about the syntax... Programmers nowadays are really spoiled by Ruby and Python.

Best regards,
anonymous

Raoul Duke

unread,
Feb 10, 2016, 10:37:24 AM2/10/16
to ats-lang-users

For me, the main advantage of Python etc. is ease of installation. :-) (Not a super big fan of then as actual languages per se.)

gmhwxi

unread,
Feb 10, 2016, 2:52:00 PM2/10/16
to ats-lang-users

Thanks :)

One can certainly write ATS code that looks elegant. For instance:

https://groups.google.com/forum/#!searchin/ats-lang-users/permute/ats-lang-users/LYHMWUMalIM/g4WCoANCEQAJ

It takes time to write elegant code, though. People complaining about the syntax of ATS are often not knowing much about
ATS. There are certainly amny Haskellers who think that anything non-Haskell is ugly.
Message has been deleted

aditya siram

unread,
Feb 10, 2016, 7:36:08 PM2/10/16
to ats-lang-users
Hi,
I really like what ATS can do but a lot of the examples, including the one you link to, don't seem to show off it's overloading capabilities. I'm a noob so I maybe misunderstanding the code but it seems to make calls to a lot of type specific functions and datatypes like `list0_tabulate` and `nil0`.

I have seen some of the overloading peek through in your template function examples that use `fwork` but not much beyond.

Can you point to examples of how support for overloading is better than ML's?

Thanks!
-deech

gmhwxi

unread,
Feb 10, 2016, 9:33:48 PM2/10/16
to ats-lang-users

>>Can you point to examples of how support for overloading is better than ML's?

My understanding is that there is very little support for overloading in ML.

For instance, 'xs - i' means removing the element 'i' from the list 'xs' in the
code I showed. That is, '-' is given the following type in this case:

(list0(a), a) -> list0(a)

This is not possible in ML as '-' is given the type 'a * 'a -> 'a during type inference.

Also, dot-symbol overloading in ATS is not ML-like:

http://ats-lang.sourceforge.net/DOCUMENT/ATS2TUTORIAL/HTML/HTMLTOC/c260.html

Overloading in ATS is completely ad-hoc. Basically, anything goes as long as the compiler
can figure out what is being overloaded based on the arity and type information.

anonymous anonymous

unread,
Feb 11, 2016, 1:24:24 AM2/11/16
to ats-lang-users
The thing is that ATS is not inelegant in the first place. Societal understanding of elegance and beauty is a giant BS. Your point "that shorter code is harder to write and much harder to debug" is very relevant. Many of you will probably judge me for my comparison but Java's verbosity can be considered an advantage in some situations. I know some Scala and like it a lot, but the extreme conciseness (that some people like and introduce in their code) trips up enough people. Haskell also could be ridiculously concise and "ungraspable" because of that. Haskell can be ungraspable in general but that's not always Haskell's, the programming language's, fault (far from that). Strangely enough, and you will likely consider me as a person with bad taste, I don't like Haskell's syntax but I am not alone here. I am in the Ocaml and SML camp. (I can't say ML in general because Haskell is not not ML.) Probably that's why I don't see ATS unnatural for my eyes.

anonymous anonymous

unread,
Feb 11, 2016, 1:31:39 AM2/11/16
to ats-lang-users
I am glad you think that way. I also hope you have ATS in your preferences.
Reply all
Reply to author
Forward
0 new messages