yamlscript

2024-08-01T15:27:36.745129Z

I tried to form the table into a markdown table, but I ran into the limitations of markdown tables

2024-08-01T15:47:54.443679Z

looks like the multi-line examples are mangled

Ingy döt Net 2024-08-01T15:48:01.778399Z

I copied to google sheets exported to TSV ran through this dumb thing https://products.aspose.app/cells/conversion/tsv-to-markdown then pasted into gist

Ingy döt Net 2024-08-01T15:48:58.157899Z

Yeah it's crap but we just need to find the right flow

Ingy döt Net 2024-08-01T15:49:23.491959Z

Where did you find that canvas thing?

Ingy döt Net 2024-08-01T15:50:11.578969Z

I'm guessing using google sheets might be best in that we can find more tooling to get where we want

Ingy döt Net 2024-08-01T15:50:28.909909Z

but maybe there's something better

2024-08-01T15:53:54.301989Z

Maybe we just need to break it out of the table structure and make it a flat markdown document instead

Ingy döt Net 2024-08-01T15:54:24.790419Z

working on something. sec

Ingy döt Net 2024-08-01T16:10:58.527579Z

which we can easily format with markys

2024-08-01T16:11:28.440289Z

yeah that looks great

Ingy döt Net 2024-08-01T16:11:29.315599Z

or https://docs.google.com/document/d/1ndSua7SOpKCSqLcS65AGXgp52sgEDLv92pvslerq-sM/edit for collaboration :)

😀 1
Ingy döt Net 2024-08-01T16:12:17.084259Z

I wonder if github has multiedit mode

Ingy döt Net 2024-08-01T16:12:55.150579Z

vscode probably does and github has vscode in the browser

2024-08-01T16:15:07.163919Z

I need to be granted access to your google doc it seems

Ingy döt Net 2024-08-01T16:15:39.706379Z

it's just a copy of the gist

Ingy döt Net 2024-08-01T16:15:47.714579Z

let's not go the google route

Ingy döt Net 2024-07-30T22:39:21.100669Z

This is cool. In the middle of stuff but will ping later!

Ingy döt Net 2024-07-31T01:58:20.806199Z

Can I edit this?

Ingy döt Net 2024-07-31T01:58:48.226639Z

bbl

2024-07-31T02:15:54.516659Z

Yes feel free to edit it

2024-07-31T02:16:44.368389Z

I made it with the intent to synthesize my learnings and confirm my understanding

2024-07-31T02:17:05.283789Z

so I'm open to all changes, feedback, & correction

Ingy döt Net 2024-07-31T03:23:35.864419Z

I made a bunch of changes 🙂

Ingy döt Net 2024-07-31T03:23:51.779469Z

Let me know if you have any questions

2024-07-31T03:30:28.960309Z

I like all the changes, I'll go ahead and delete the incorrect interpolation example

2024-07-31T03:30:44.184639Z

Thank you for the edits!

Ingy döt Net 2024-07-31T04:09:59.582499Z

Do you know if that exports to markdown or anything else?

2024-07-31T04:15:22.358599Z

I'm not sure to be honest

Ingy döt Net 2024-07-31T04:18:51.230599Z

I don't see anything

2024-07-30T02:13:30.447599Z

Why does this work:

!yamlscript/v0

my-metadata =: 
    =>: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient

with-meta:
    client
    my-metadata
while this gets an error:
!yamlscript/v0

with-meta:
    client
    =>: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient
This is the error I see (note that I'm using ys -c)
ys -c src/experiment.ys 
Error: mapping values are not allowed here
 in reader, line 5, column 7:
        =>: !
          ^
{:eval [], :debug-stage {}, :compile true}

Ingy döt Net 2024-07-30T02:17:25.547749Z

It's invalid YAML (thus invalid YS)

Ingy döt Net 2024-07-30T02:18:32.264399Z

!yamlscript/v0

with-meta:
    =>: client
    =>: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient
maybe

Ingy döt Net 2024-07-30T02:19:13.727439Z

or better:

!yamlscript/v0

with-meta client:
    =>: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient

Ingy döt Net 2024-07-30T02:19:50.214149Z

or better:

!yamlscript/v0

with-meta client: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient

Ingy döt Net 2024-07-30T02:21:29.640509Z

or better:

!yamlscript/v0

with-meta client::
  :unsynchronized-mutable: True
  :tag: AsyncHttpClient

Ingy döt Net 2024-07-30T02:24:44.450539Z

with-meta:
    client
    my-metadata
is same YAML as:
with-meta: client my-metadata
client my-metadata is a YAML scalar but the you kept a scalar client and tried to add a mapping, which you can't do

Ingy döt Net 2024-07-30T02:26:18.482679Z

but in YS

with-meta: client my-metadata
is same as
with-meta client: my-metadata
so now you can replace the scalar node my-metadata with the mapping node it refers to

Ingy döt Net 2024-07-30T02:30:02.305519Z

also

my-metadata =: 
    =>: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient
can be simplified to
my-metadata =: !
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient
or
my-metadata =::
        :unsynchronized-mutable: True
        :tag: AsyncHttpClient
:: was made to avoid : ! (just because it is so common and looks cleaner)

Ingy döt Net 2024-07-30T02:32:20.778939Z

Error: mapping values are not allowed here
 in reader, line 5, column 7:
        =>: !
          ^
is an error from the YAML parser in YS, because you started a scalar with client and now a mapping node is not allowed there

Ingy döt Net 2024-07-30T02:33:31.086879Z

you would get the same error from clj-yaml (which uses essentially the same YAML parsing library (snakeyaml) as YS)

2024-07-30T02:47:31.612789Z

oh ok thank you for the very thorough answer!

👍 1
2024-07-30T02:59:30.993259Z

I have this defprotocol from https://github.com/redplanetlabs/rama-demo-gallery/blob/master/src/main/clj/rama/gallery/rest_api_integration_module.clj from the Rama demo gallery:

(defprotocol FetchTaskGlobalClient
  (task-global-client [this]))
which I've written as
defprotocol FetchTaskGlobalClient:
  task-global-client: .[this]
am I misusing the . dot here? The generated code looks right

Ingy döt Net 2024-07-31T01:43:45.452009Z

Sorry. missed this one. You are using . correctly although I now favor + over . for that. They are the same but I might deprecate .

Ingy döt Net 2024-07-31T01:45:35.762149Z

The act as escape chars for things that YAML parses as a certain thing but you want it to parse as a "plain YAML scalar" (thus a ys expression)

Ingy döt Net 2024-07-31T01:46:57.750479Z

say: "Go!\n" * 3   # YAML error
say: +"Go!\n" * 3   # Works

Ingy döt Net 2024-07-31T01:48:13.628589Z

say:: [1 2 3]   # ["1 2 3"]
say: +[1 2 3]   # [1, 2, 3]
say: [1 2 3]    # YS error, flow seq not allowed in code mode