Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Functional programming — Gideros Forum

Functional programming

BJGBJG Member
edited February 2013 in General questions
I've recently been looking at languages like Haskell and Clojure. Any fans of the functional paradigm...? Lua seems quite flexible so I guess perhaps it's possible to adopt a functional approach in ways. I don't suppose it would be possible to create an app combining aspects of Gideros with one of these more esoteric languages...?

I know you lot appreciate a good IDE, so speaking of Clojure you might be interested in Light Table...

http://www.kickstarter.com/projects/ibdknox/light-table

Comments

  • Lua is pretty similar to Javascript and for Javascript I know there is a Coffescript which basically allows to use functional programming paradigm. So maybe there's something similar for lua too. :)
  • BJGBJG Member
    edited February 2013
    I just came across a couple of functional libraries for Lua...

    http://bo1024.wordpress.com/2011/10/08/a-functional-library-for-lua/
    https://github.com/davidhollander/fn

    (I believe Gideros uses Lua 5.1.4. Although the first link directs to a page which refers to this version, the actual code which is displayed by default has been updated to 5.2, and I'm not sure if this is compatible. It's possible to pull up the earlier 5.1.4 release from the same page though.)
  • BJGBJG Member
    edited February 2013
    It seems to do something, though I'm not sure what. :|

    Downloaded the 5.1.4 versions of "lua-functional" and "lua-functional-examples", set up a Gideros project and ran the first sample...
    -- initialize the library, save it as 'lfunc'
    lfunc = dofile('lua-functional.lua')
    -- add 17 to each number in the list {1, 5, 8}
    print(unpack(lfunc.map(lfunc.apply(lfunc.add,17),{1,5,8})))
    Uploading finished.
    18 22 25

    Awesome. I love functional programming.
  • atilimatilim Maintainer
    @BJG Also there is moonscript http://moonscript.org/ and the only requirement is LPeg (which is included with Gideros installation as a plugin).

    If you want to play with it, just copy lpeg.dll (Windows) or lpeg.dylib (Mac) to Plugins directory.
  • Why not taking a look at Moses or Allen ?
  • Thanks @Roland_Y. I've got distracted by Clojure at the moment and trying to find out how to use it with libgdx, but I'm looking forward to retreating back to the sanity and simplicity of Gideros...
Sign In or Register to comment.