Transd (short for Transformation and Analysis of Structured Data) is a statically typed, general purpose, multi-paradigm programming language, which:
- has extended functionality for data processing, such as a built-in data query language for working with tables and collections of records in a database-like fashion;
- has a very compact implementation (two C++ files with less than 25 KLOCS);
- uses an innovative execution model - virtual compilation - which doesn't include just-in-time compilation and in the same time offers a good performance.
The current stage of Transd development is beta of the first production version, which is planned for release in the first quarter of 2023.
(with v [1,2,3,4,5,6]
(for i in v do (textout i " ")
(textout "\n")
(for i in v where (not (mod i 2)) do (textout i " ")
)
// <= 1 2 3 4 5 6
// <= 2 4 6
The 'for' statement is used not only for iterations, but for list comprehensions as well.
(with list1 (for i in Range(22) where (not (mod i 3)) project (* i i) )
(textout list1)
)
// <= [0, 9, 36, 81, 144, 225, 324, 441]
class Speaker : {
say: Lambda<String String>(),
@init: (λ f Lambda<String String>() (rebind say f )),
call: (λ s String() (ret (exec say s)))
}
MainModule: {
greeter: Lambda<String String>(λ s String() (ret (+ "Hello, " s "!"))),
_start: (λ
(with sp Speaker( greeter )
(textout (call sp "World"))
) )
}
// Output: Hello, World!
#lang transd
MainModule : {
tabdata:
"Name,Salary:Int,Department
Alice,10000,IT
Susan,25000,HR
Bob,30000,Marketing",
table: Table(),
_start: (λ
(load-table table tabdata)
(build-index table "Salary")
(with rows (tsd tabl
select: ["Name", "Department"]
as: [[String(),String()]]
where: "Salary > 20000"
sortby: "Name")
(for row in rows do (lout row)))
// OUTPUT:
// <= ["Bob", "Marketing"]
// <= ["Susan", "HR"]
)
}