#1 Visual Code Editor: Quick Copy and Paste of Forms

This following technique is really useful for quickly copying a selecting form and pasting it to desired point in visual code. You can utilise this, for instance, when you need to add many similars forms: Just define first one form, copy it, and paste it as many times as you need. The steps are presented in the following slide show:

  1. The form to be copied. e.g. an Array form in this example.
  2. The target location as a Form Addition Point for pasting the copied form.
  3. Invoke the Form Actions Bottom Sheet by performing a long press on the name or icon of the visual form component.
  4. Select Copy form action.
  5. Long press on the selected destination Form Addition Point, and
  6. The original form get copied to the selected as a copy form.

#2 Visual Code Editor: Quickly Show Form Info

Form info can be shown by selecting the Show form info action for the Form Actions Bottom Sheet as described in Visual Code Editor. But there is also a quicker way described below:

  1. Click on the form’s name (or icon) to active Form Info Bottom Sheet.
  2. The clicked visual form is expanded to show argument names.
  3. The Form Info Bottom Sheet is shown, which displays:
  4. Name of the form.
  5. Visual form component syntax
  6. Form description
  7. To close the bottom sheet, either click on the Close Button, or
  8. Click anywhere outside the bottom sheet.

#3 Utilise Lisp Expressions

Since visual FLX language is based on FLX List under the hood, it is possible to utilise Lisp features just a literal parsing and evaluation. You can write arbitrary FLX List literals and use those within you visual code. For instance, sometime it is easier to write a List expression for, say, a mathematical expression, than write it using the visual code.

For instance, if you need to calculate the volume of a sphere with radius r with the formula:

You could use FLX’s Arithmetic API and define the calculation as visual code. Other possibility is to use a Lisp literal (* (/ 4 3) pi (* r r r)) and String.eval function:

  1. The radius r defined as an immutable value (val).
  2. Evaluation of the Lisp expression. Note that is possible use variables and values defined with val and var functions in literal.

It is also possible to use List expressions and String.eval function to implement functions:

  1. Function with name “sphereVolume” which has a single parameter defined as symbol “r” and function body defined as evaluation of literal (* (/ 4 3) pi (* r r r)).
  2. Invocation of defined function with parameter 2.5 for radius r.

For implementing functions with List expressions, there is even more powerful function performance wise: String.compile. It parses the given literal and caches the resulting form future evaluations:

#4 Use IFTTT Web Hooks

IFTTT provides a service for makers called Webhooks. It allows makers to integrate other services on IFTTT with their DIY projects via simple web requests. FLX provides a simple API for utilising Webhooks to as a part of FLX applets. Register as a user for IFTTT, create any IFTTT service you want and hook them to your FLX applet. The API is used like as follows:

  1. You need the event name of your IFTTT service. In this example an IFTTT service with name “play_song” is used. The service, when triggered via webhook request, starts playing a song in a IFTTT connected Android phone.
  2. For authenticating the user, a key is needed. (The key in picture is a dummy key, don’t reveal and share you own key).
  3. Webhook requests may have optional, max. three values as a payload. The values have names “value1″, value2”, and “value3”. In the example, the service has a single value – the name of the requested song.
  4. A Webhook request is made using function (IFTTT.trigger event key callback value1? value2? value3?).
  5. A code block for defining the callback handling when the requested webhook provides response. Inside the code block. on nested code level, the response object HttpResponse is provided as a parameter.