-
Notifications
You must be signed in to change notification settings - Fork 61
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
Adding examples to Janet api documentation. #242
Conversation
Thanks Eric, I appreciate the code examples! Looks like the example file for |
I hesitated to name the file But I can see that what I did isn't getting picked up in the generated docs. No biggie. Feel free to close this and I can resubmit with the unescaped file name. |
@erichaney You can just change it in place and the PR will update automatically. 🙂 |
I also thought this when examining the file naming scheme for examples before. Some of the printable characters that looked potentially problematic to me for Windows included:
( FWIW, I think some of the code that handles symbol to file name conversion currently is here. My translation of that is: (def- replacer
(peg/compile
~(accumulate
(any
(choice (replace (capture (set "/*%"))
,|(string "_" (0 $)))
(capture 1))))))
(defn- sym-to-filename
"Convert a symbol to a filename. Certain filenames are not allowed on various operating systems."
[fname]
(string "examples/" ((peg/match replacer fname) 0) ".janet")) May be it makes sense to also handle the following specially?
For comparison, this is the scheme I settled on for janet-ref. Some use can be see here. |
Removed escape from file name.
I removed the escape from the file name. I'll focus on contributing examples that don't use any special characters for now. 👍 |
Fix file name for windows
I think the evaluation result for this line (line 4 of (- 1.4 -4.5) # -> -5.9 What I get here is:
|
For this line (line 4 of (reduce2 + []) # -> 0 what I get here is:
|
Not sure how much we should be concerned with the following sort of thing, but FWIW, I noticed in some lines that there is no space between the For reference, the following have examples of the aforementioned:
(Unfortunately, you may need to scroll to see the relevant bits via the links.) |
Thanks for pointing out the issues. I think I will close this PR and resubmit one file at a time so it is easier to review and track changes. |
Added an example for
++
,--
, and->
. Let me know if the filenames are not what they ought to be.