Public Group

# AI classes that use a functional language

This topic is 1195 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was just wondering if there are any intro to AI classes that use a functional language instead of an OOP language? Most of the time I see Java, C++, C# Javascript, and Python as the languages of choice. But I thought functional languages were in part meant to do AI. So I thought it strange that I haven't seen any. Maybe I'm not looking in the right places. So, does anyone know of an [online] classes that teach an Intro to AI in a functional language?

##### Share on other sites

But I thought functional languages were in part meant to do AI.

From a language theory point of view, the interesting part in functional languages is that you don't have assignment.
You program them by calling a function for each calculation step, like
def sum_N(n):
if n == 0:
return 0
else:
return 1 + sum_N(n-1)
As far as I know, functional languages are not specifically designed for AI.

Maybe you mean logical languages like Prolog instead? You write 'facts' and reasoning rules in them, and then ask a question, where the program then tries to find an answer (typically yes/no).

##### Share on other sites
In the 1960s the idea that AI somehow requires programs that can modify themselves made languages like LISP (which is functional) very popular for AI. That idea is probably wrong, and most people these days use the same languages for AI as for any other type of programming.

##### Share on other sites

Many languages now allow a mix of functional and imperative styles. C# is becoming more functional and F# is a mix but biased to Functional. I believe the only really pure functional language is Haskell but this hardcore mentality has limited its take up in the real world, shame as it is a beautiful language.

Here is my A* in C# which is fully immutable, uses a fair chunk of functional thinking etc. There is a while loop as C# does not have tail call optimisation and so recursion would risk stack blowout and also I have made many of the functions extensions to give more fluent style. I did consider a trampoline to mimic tail call but these always look ugly and just add too much noise to the code

##### Share on other sites

Keep in mind also that there is a fairly strong split between game development AI and academic AI.  The two disciplines often tend to have significantly different objectives, and so the techniques and recommendations tend to be quite different also.  Functional programming languages are more popular among academia, and may also be more useful for the AI tasks undertaken within academic research.  But even if so, that might have very little bearing on the types of AI tasks undertaken within game development, where imperative and object oriented styles are far more common and familiar.

##### Share on other sites
I was referring to academic AI. Not game-specific.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 11
• 13
• 9
• 9
• ### Forum Statistics

• Total Topics
634081
• Total Posts
3015385
×