Funcy

by dr-dan

17

Funcy

Written in Godot 3.2

A library to aid a functional programming style in gdscript. Provides operators that deal with lists and individual items.

Similar to ramda, underscore.js

Largely untested but good for speedy prototyping.

Usage

examples...

Funcy.gd

Quick demo

const F = Funcy

# open fields for each
F.map(F.open(['inv/weapon', 'name', 'age']))

# get only the items that pass validation
F.filter(F.all([F.gt(4), F.lteq(9)]))

# compose operators
F.comp([
    # map, filter
    F.map([
        F.expr('_x + 3'),
        F.fn(self, 'plus_xy', [2])]),
    F.filter(F.gt(5))
    ])

eval

There are multiple ways to trigger evaluation of a query

# use query later
F.map(op)

# these have the same effect
F.map(op).eval(data)
F.map(op, data)
F.do(F.map(op), data)

Installation

Download from the Asset Store

Or place addons/Funcy in the addons folder of your project.

Version

0.7.1

Engine

3.3

Category

Scripts

Download

Version0.7.1
Download

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author