Sign in to follow this  
Alpha_ProgDes

AI classes that use a functional language

Recommended Posts

Alpha_ProgDes    6930
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 this post


Link to post
Share on other sites
Alberth    9525

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 this post


Link to post
Share on other sites
alvaro    21263
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 this post


Link to post
Share on other sites
WozNZ    2010

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

Share this post


Link to post
Share on other sites
Agony    3452

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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this