Skip to content
Snippets Groups Projects
Select Git revision
  • e57d3da6fc539a2815c1e3a98edd112bdb58743f
  • master default protected
  • feature/personal_state
  • feature/gpio-module
  • rahix/menu
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • rahix/bma
  • rahix/bhi
  • schleicher-test
  • schneider/schleicher-test
  • freertos-btle
  • ch3/api-speed-eval2
  • schneider/mp-for-old-bl
  • ch3/leds-api
  • ch3/genapi-refactor
  • ch3/dual-core
  • v0.0
22 results

genapi.py

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    closure1.py 215 B
    # closures
    
    def f(x):
        y = 2 * x
        def g(z):
            return y + z
        return g
    
    print(f(1)(1))
    
    x = f(2)
    y = f(3)
    print(x(1), x(2), x(3))
    print(y(1), y(2), y(3))
    print(x(1), x(2), x(3))
    print(y(1), y(2), y(3))