Skip to content

Functions

Giorgio Garofalo edited this page Jan 19, 2022 · 13 revisions

In Pikt, functions are essentially variables, with a block as its value, which starts with lambda.open , ends with lambda.close and contains the instructions that should be executed.

This is what an empty function looks like:

Now let's make the function print "ABC", and then call it via funcall .

The output is ABC as expected.

Arguments

Every pixel between lambda.open and the first instruction of the block is read as a function argument.
Let's try editing the previous function so that the printed value comes from an argument :

Now let's call the function with "ABC" as a parameter. Keep in mind that each parameter is a single pixel, therefore we must store "ABC" into a temporary variable :

Return value

WIP...