poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [COMMITTED] libpoke, testsuite, doc: support for lambda expressions


From: Egeyar Bagcioglu
Subject: Re: [COMMITTED] libpoke, testsuite, doc: support for lambda expressions
Date: Sun, 8 Nov 2020 18:03:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1


This commit adds support for lambda expressions to Poke.  Lambda
expressions use the following simple syntax:

   lambda FUNCTION_SPECIFIER

Where a FUNCTION_SPECIFIER is the same notation that one would use
when defining a function in a `fun' construction.  Examples:

  (poke) lambda void: {}
  #<closure>
  (poke) lambda (int i) int: { return i + 2; }
  #<closure>

Lambdas can be invoked like any other function value:

  (poke) lambda void: {} ()
  (poke) lambda (int i) int: { return i + 2; } (10)
  12

Lambdas can also be stored in variables:

  (poke) var la = lambda (int i) int: { return i + 2; }
  (poke) la (10)
  12

this is so cool!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]