aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai WU <kaiwu2004@gmail.com>2024-08-07 09:59:41 +0800
committerKai WU <kaiwu2004@gmail.com>2024-08-07 09:59:41 +0800
commitf22e9b37d7f6faf82da722928f501d7d661331d0 (patch)
tree0acf4e83d5c0b2502be7d6dc0f813cc2c1835b49
parent34e38efb3d495a7a77a74f5a484950cda31c1f12 (diff)
downloadqgs-f22e9b37d7f6faf82da722928f501d7d661331d0.tar.gz
qgs-f22e9b37d7f6faf82da722928f501d7d661331d0.zip
test array list json
-rw-r--r--src/qgs.gleam13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/qgs.gleam b/src/qgs.gleam
index dacd6ed..9c5e4c2 100644
--- a/src/qgs.gleam
+++ b/src/qgs.gleam
@@ -1,5 +1,16 @@
import gleam/io
+import gleam/javascript/array
+import gleam/json
+import gleam/list
pub fn main() {
- io.println("Hello from qgs!")
+ [1, 2, 3]
+ |> list.map(fn(x) { x + 1 })
+ |> list.zip(["2", "3", "4"], _)
+ |> array.from_list
+ |> array.map(fn(t) { #(t.0, t.1 |> json.int) })
+ |> array.to_list
+ |> json.object
+ |> json.to_string
+ |> io.println
}