#another experiment package require fileutil set data [fileutil::cat [pwd]/sample1.json] puts stdout $data proc charP {ch} { pipeset parser .= { pipeswitch { #puts "-->$input" pipecase = $input |> \ ,'${ch}'@1.= {list [string range $data 1 end] [string index $data 0] } |> { set data } return nothing } } \ ,'result'@@ok/@0.= { .= list $pipe $input |p@,i@> {{*}$p $i} } |result@@ok/result> { #todo - we need inverse of the destructure operation of pattern-matching #i.e we need restructure - which puts the values in at the matched locations #- (return the updated result without necessarily knowing its full specific structure) } return nothing-functor } } \ ,'result'@@ok/@0.= { .= list $pipe $input |p@,i@> {{*}$p $i} } |tail@@ok/result/@0,char@@ok/result/@1> {list $tail [{*}$cmd $char] } | return nothing-functor } }