-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: replace dream with sexp in first program #2093
Conversation
I guess I was too fast when suggesting sexplib belongs to the same kind of library, but Sexp instead of JSON. The result type doesn't use polymorphic variants, but simple ADT. |
Ah, no worries I'll give that one a shot instead. I went with JSON because it was more familiar, now I get to learn what S expression is 🤣 |
"is there a better way to describe the type that Yojson returns that is more instructive " Some programs need a configuration file. Then if we read it, it can be convenient to parse it, especially if the config is complex (variable assigned to list...). Then a program which extract a value could demonstrate an interest. JSON and Sexp both permit this kind of configuration. Note Polymorphic variants ADT are very close to the usual ADT... Perhaps we could use them. (You already have typed a Sexp... |
data/tutorials/getting-started/1_02_your_first_ocaml_program.md
Outdated
Show resolved
Hide resolved
Here's another option based on the suggestion of Sexplib - let me know what you all think |
data/tutorials/getting-started/1_02_your_first_ocaml_program.md
Outdated
Show resolved
Hide resolved
data/tutorials/getting-started/1_02_your_first_ocaml_program.md
Outdated
Show resolved
Hide resolved
``` | ||
The JSON string is parsed into a [JSON type](https://ocaml-community.github.io/yojson/yojson/Yojson/Safe/index.html) so that you can use it in your program. Refer to the [Yojson documentation](https://ocaml-community.github.io/yojson/yojson/index.html) for more information. | ||
The string you entered representing a valid S-expression is parsed into `List`of `List`s of `strings` so that you can use it in your program. Refer to the [Sexplib documentation](https://github.com/janestreet/sexplib) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string you entered representing a valid S-expression is parsed into `List`of `List`s of `strings` so that you can use it in your program. Refer to the [Sexplib documentation](https://github.com/janestreet/sexplib) for more information. | |
The string you entered representing a valid S-expression is parsed into `List` of `List`s of `strings` so that you can use it in your program. Refer to the [Sexplib documentation](https://github.com/janestreet/sexplib) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, I was wrong in my first comment (I have edited). It is not a list of atom (string) or sexp, but an atom (string) or a list of s-exp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions and typos.
data/tutorials/getting-started/1_02_your_first_ocaml_program.md
Outdated
Show resolved
Hide resolved
I see several of my suggestions are now outdated, so I'll go through it again when the content is set. 🙂 |
9b2452c
to
51f9f5c
Compare
I updated the type def - I think it's ready for a re-review / input whether it's a good enough example to switch for dream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, only small changes suggested.
data/tutorials/getting-started/1_02_your_first_ocaml_program.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Cuihtlauac Alvarado <[email protected]>
@jonahbeckford: What's your view on this PR? It should be good for Windows? |
It works on Windows, yes. (I can't think of a more portable example, although I'm not enthused about the example itself. Better than the alternate so LGTM) |
Related to #1962
What does everyone think about something like this? I tested on windows and it works, the example is just pulled from Yojson's readme, but we could make it 'learning ocaml' specific if you prefer.
Two things:
eval $(opam env)
but that only helps if you're running linux based...