agentlang-ai / agentlang

Generative AI-powered Programming Language
Apache License 2.0
119 stars 4 forks source link

Using destructuring nested data with `:as` #1488

Closed mkazmi-twist closed 1 month ago

mkazmi-twist commented 1 month ago
(defn nested-result []
  {:Name "David"})

(dataflow
 :Test1
 [:match true
  true [[:eval (quote (nested-result))
         :as :R]
        :R.Name]
  :as :K])

I want to assign "David" to :K so that it can be used subsequently as a normal string. However, this code results in compilation errors.

(dataflow
 :Test1
 [:match true
  true [[:eval (quote (nested-result))
         :as :R]
        (quote (identity :R.Name))]
  :as :K])

I am using this workaround (wrapping it in identity function) which works fine but the syntax looks awkward.