Any dynamically-typed scripting language is good for that sort of thing. Scheme in particular is very productive because of its meta-programming capabilities and REPL-based development.
> artificial intelligence
"Scheme was created during the 1970s at the MIT AI Lab [...]"
Scheme is a popular extension language. You could use it the same way Torch uses Lua.