expr-data-story Pub Share

Data transformation examples and tests

CSV

send::  msg ctx.csv  (list :Array, separator=",")

expect::  (payload is array)
expect::  (payload[="0"=0] contains ",")
expect::  (payload[="2"=2] contains "3")

mkString

send::  msg ctx.set  (payload :Array=[..])

send::  msg ctx.mkString  (separator=",")

expect::  (payload contains "a,b,c")

Empty and accessors

send::  msg ctx.set  (a:Undefined)

expect::  (a is undefined)
send::  msg ctx.set  (a18)

expect::  (a18 is undefined)
send::  msg ctx.set  (a20)

expect::  (a20 is undefined)
send::  msg ctx.set  (a22)

expect::  (a22 is undefined)

send::  msg diesel.try 

send::  msg ctx.set  (b)

send::  msg ctx.set  (b20)

send::  msg ctx.set  (b30)

send::  msg ctx.set  (j :JSON)

send::  msg ctx.set  (b32)

send::  msg ctx.set  (b33)

send::  msg diesel.catch 

expect::  (b is defined)
expect::  (b20 is undefined)
expect::  (b30 is undefined)
expect::  (b32 is undefined)
expect::  (b33 is undefined)

Callingl messages without declaration

send::  msg ctx.set  (z44 :Array)

expect::  (z44 is [2,3])

Folds and reduce

send::  msg ctx.set  (payload:Number=0)

send::  msg ctx.set  (z51 :Array)

expect::  (z51 is 10)

Math functions

send::  msg ctx.set  (arr :Array=[..])

send::  msg ctx.set  (x)

expect::  (x is 1)
send::  msg ctx.set  (x)

expect::  (x is 4)
send::  msg ctx.set  (x)

expect::  (x is 10)
send::  msg ctx.set  (x)

expect::  (x is 2.5)

send::  msg ctx.set  (x:Number)

expect::  ( (( (x as string) ) is "1"))
send::  msg ctx.set  (x:Number)

expect::  ( (( (x as string) ) is "1.0"))


Was this useful?    

By: Razie | 2020-09-17 | Tags: story , dsl


Viewed 783 times ( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2024, all rights reserved.