Scheme Filter | |
---|---|
Description | Filters elements based on scripts written in a Scheme-like language. |
Threaded | No |
Memory Usage | Depends |
Stream Support | No |
Added In | —- |
Scheme Filter
This is a filter that processes elements based on Scheme code that the user can input. The code written here has access to all of the functions in the Option Scheme code and can call on a function (elements [source=0]) which returns all of the elements of the specified source as a list. Each element of the list has the form ((p0 p1 …) (v0 v1 …)) and gives the parameters and values of the elements of the specified source.
The Scheme code must have a function (filterElements numSources) that will be passed the number of sources for this filter. This function should return a list of elements of the same format as what the elements function returns. That will be used as the output. By default you are provided with a method that returns a null list so no elements go throughs.
To do a transformation, you can write a function that transforms an element list and apply it to the elements using the map function that is given by default in the Options pane. To select and transform use the selectMap with two functions that is provided for you.
You can also write functions of the form (parameterDescription pnum) and (valueDescription vnum) that should return quoted names for the specified parameters and values. What is passed in will be integers that are 0 referenced. If these functions are not written, default names will be provided. Note the SVScheme does not have string processing so the quoted names can only be single words.
An example for a possible valueDescription function might be the following:
(define (valueDescription vnum)
(cond
((= vnum 0) 'time)
((= vnum 1) 'a)
((= vnum 2) 'e)
(else 'error)))
NOTE: Because the SVScheme implementation does not properly implement tail recursion, SVScheme code can not recurse through many elements. If you truly need programming capability and don't want to write Java code, it is recommended that you use the Script Filter for any large jobs.