AI classes that use a functional language

Started by
5 comments, last by Alpha_ProgDes 8 years, 7 months ago
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?

Beginner in Game Development?  Read here. And read here.

 

Advertisement

C# as been augmented with a lot of functional and dynamic features.

Here is an article to teach you to use C# as a fully functional language.

http://www.codeproject.com/Articles/375166/Functional-programming-in-Csharp

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).
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.

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

https://github.com/WozSoftware/BadlyDrawRogue/blob/master/Woz.PathFinding/RouteFinder.cs

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.

"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
I was referring to academic AI. Not game-specific.

Beginner in Game Development?  Read here. And read here.

 

This topic is closed to new replies.

Advertisement