aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Udf/LambdaAsCallable.yqls
blob: 082da79b045cea67f54a8f38a460a5432ca23522 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(
#comment
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))

(let res_sink (DataSink 'result))
(let list (AsList (String 'A) (String 'B) (String 'C) (String 'D) (String 'E)))
(let state (String '""))
(let fold (Udf 'TypeInspection.Fold (Void)
    (TupleType
        (TupleType
            (TypeOf list)
            (TypeOf state)
            (CallableType '() '((DataType 'String)) '((DataType 'String)) '((DataType 'String)))
        )
        (StructType)
        (TupleType)
    )
))
(let func (lambda '(item state) (Concat state item)))
(let data (Apply fold list state func))
(let world (Write! world res_sink (Key) data '()))
(let world (Commit! world res_sink))
(return world)
)