jcalahor / functions

show capabilities of functions as objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

functions

show capabilities of functions as objects

The functions.py shows the different capabilities that python has around functions as objects feature. Wondering how this can be implemented in modern programming languages such as c#, f# or kotlin. feel free to submit a pull request for further improvements or provide a counterparty sample in other language to see if other language can beat this :) by using less lines of code or better architecture around it

The file functions_x.py si a more sofisticated sample of the dynamic behavior of python.

sample run:
enter lambda to use:lambda x: x * 10
executing <function calc..context..m1 at 0x000000000251AA60> current value is 10
executing <function calc..context..m2 at 0x000000000253ABF8> current value is 20
executing <function calc..context..m3 at 0x000000000253AEA0> current value is 2000
executing <function calc..context..m1 at 0x000000000251AA60> current value is 11
executing <function calc..context..m2 at 0x000000000253AEA0> current value is 21
executing <function calc..context..m3 at 0x000000000253ABF8> current value is 2100
executing <function calc..context..m1 at 0x000000000251AA60> current value is 13
executing <function calc..context..m2 at 0x000000000253ABF8> current value is 23
executing <function calc..context..m3 at 0x000000000253AEA0> current value is 2300
[3000, 3100, 3300]

About

show capabilities of functions as objects


Languages

Language:F# 46.4%Language:Python 30.4%Language:C# 23.1%