Skip to content
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

Incorrect example for ⎕IO=1 on page /SystemFunctions.html #5

Closed
AleBeda opened this issue Jan 16, 2022 · 11 comments
Closed

Incorrect example for ⎕IO=1 on page /SystemFunctions.html #5

AleBeda opened this issue Jan 16, 2022 · 11 comments

Comments

@AleBeda
Copy link

AleBeda commented Jan 16, 2022

This example does not look correct. The second result should be 1 2 3 4. The reason is that the assignment of ⎕IO should precede ⍳4.

⍳4
⎕IO←0
⍳4
⎕IO←1
0 1 2 3
0 1 2 3
@NaincyKumariKnoldus
Copy link

Hey @AleBeda I would love to do this. Can I?

@AleBeda
Copy link
Author

AleBeda commented Jan 16, 2022

@NaincyKumariKnoldus, the repository is not mine. It's up to @xpqz to decide. He probably won't mind if you send him a PR.

@NaincyKumariKnoldus
Copy link

okay @AleBeda sure I am doing it.

@NaincyKumariKnoldus
Copy link

Hey @xpqz and @AleBeda I have raised PR for this. Please review this.
Thanks!

@xpqz
Copy link
Owner

xpqz commented Jan 17, 2022

Hi @NaincyKumariKnoldus annd @AleBeda -- and thanks for taking the time.

It's in fact the first result that's wrong; I was relying on ⎕IO being defaulted to 1 when you open a new session in a notebook, but the build system that makes the book has an IO-setting that 'spills over' from an earlier chapter. The last ⎕IO←1 in the section you highlight is simply to return to the default. I'll make it clearer.

For future reference, the HTML pages are auto-generated from the Jupyter notebooks that make up the source for the book; thus any PRs would need to target those, as any changes to the HTML pages will get overwritten next time I run jupyter-book build. See https://jupyterbook.org/basics/build.html for details on how that works.

@NaincyKumariKnoldus
Copy link

Okay! @xpqz You mean to say I have to change first result not second result. Right?

@xpqz
Copy link
Owner

xpqz commented Jan 17, 2022

That was my intention, but it works doing it like so, which should be immune to this problem:

4  ⎕IO0
4  ⎕IO1

@NaincyKumariKnoldus
Copy link

okay I am changing first result. Correct?

xpqz added a commit that referenced this issue Jan 17, 2022
@xpqz
Copy link
Owner

xpqz commented Jan 17, 2022

I've fixed it already this time. But as I said, your PR would have needed to target the notebook itself

Fixed in 142e6af

@NaincyKumariKnoldus
Copy link

Means ......I havent understand.

@xpqz
Copy link
Owner

xpqz commented Jan 17, 2022

So assuming you're not familiar with jupyter and jupyter-book....the book is built from jupyter notebooks and the Dyalog jupyter kernel. The website's html is automatically generated, and need never be modified manually.

The notebook in question is this:

https://github.com/xpqz/cultivations/blob/main/contents/SystemFunctions.ipynb

Any changes to the book's content text, code examples etc always go in the notebook files (contents/*.ipynb). The _build/html/*.html files are build artefacts only -- they're generated by the jupyter-book build contents command.

Whilst the notebooks themselves are basically just a bunch of json, they're not intended to be edited directly. Instead, in order to make changes to the notebooks you need the following bits and bobs installed:

  1. Jupyter itself (https://jupyter.org/)
  2. the Dyalog jupyter kernel (https://github.com/Dyalog/dyalog-jupyter-kernel)
  3. the jupyter-book authoring system (https://jupyterbook.org)

With that in place, you can edit directly in a web browser, crucially including executing APL code in place.

Your PR changes the build artefacts, not the source. Instead, had you changed the notebook source, the build process would have executed the APL snippet, and included the (correct) output into the generated html.

Don't let this put you off: you spotted a problem, reported it, and it got fixed. Play around a bit with the jupyterbook system; it's a super-cool tool chain to do this kind of thing with.

@xpqz xpqz closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants