Giter VIP home page Giter VIP logo

pyret-docs's Introduction

The source of the documentation for the Pyret programming language.

Read the built documentation at https://www.pyret.org/docs/latest/

Learn about the language at https://www.pyret.org.

See the code for the language at https://github.com/brownplt/pyret-lang.

Program in Pyret at https://code.pyret.org.

Installing

Make sure you install Racket.

If you are using a Mac, racket will not be runnable automatically. To make it runnable, say that you are using Racket 6.5 and install the program at /Applications/Racket\ v6.5/, you need to put

export PATH=$PATH:/Applications/Racket\ v6.5/bin/

to .bashrc (if you use Bash) and then restart the shell to make it take an effect.

Also make sure you have node and npm.

When you have everything mentioned above, run make install to download additional files needed for compilation.

Compilation

You can compile the documentation via make.

pyret-docs's People

Contributors

asolove avatar blerner avatar dkearns avatar dwoos avatar jchen avatar johnuuu avatar jpolitz avatar jrheard avatar jswrenn avatar mkolosick avatar peblair avatar pnkfelix avatar sarahkf avatar schanzer avatar sdooman avatar sorawee avatar tom-hoffman avatar tov avatar yonilavi avatar zacharyespiritu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyret-docs's Issues

more cross-linking of equality

This is a very nice section:

https://www.pyret.org/docs/latest/equality.html#%28part._s~3aroughnum-equality%29

I think it would benefit from saying there are two kinds of comparisons possible, and linking to

https://www.pyret.org/docs/latest/equality.html#%28part._s~3abounded-equalities%29

I also wonder if the error message for roughnum equality couldn't link to the first link above? (Yes, it's controversial to have links in error messages… But it's such good prose, and a student who doesn't know what is going on is going to miss out on it.)

Spy unbound id error

In https://www.pyret.org/docs/latest/s_spies.html, the code example:

fun reverse(lst, sofar):
  spy "lengths":
    lst-length: lst.length(),
    sofar-length: sofar.length(),
    sum: lst.length() + sofar.length()
  end
  cases(List<A>) lst:
    | empty => sofar
    | link(first, rest) =>
      reverse(rest, link(first, sofar))
  end
end

check:
  reverse([list: "a", "b", "c"], empty) is [list: "c", "b", "a"]
end

has an unbound id A in List<A>.

Student friendly name for color list

It would be handy to have a list of colors with the HTML title as "Colors in Pyret" or something else more meaningful to a student than "3.18?image-structs", which is what currently comes up in Google Classroom when I paste in the link.

desugaring of function to lambda is not accurate

The doc previously said:

A function expression is syntactic sugar for a let and an anonymous function expression.

This is obviously false for recursive functions. So I add "for non-recursive case" to the doc. Still, it is awkward as readers might wonder how recursive functions get desugared. Also, fun in fact always gets desugared to a variable assignment, so it's technically inaccurate too.

Searching for `include` in docs doesn't find anything

First off, please feel free to close this issue; I'm partly just interested to know if this is the right way to report things like this, or if things like this should be reported at all.

I've just spent a happy half-hour running through some of the first assignments from csci0111, and in assignment 2 I can't use the link because I don't have a brown gmail address, no problem but I have to figure out how to import the list functions myself. Assignment 1 uses the form "include image" to import the image library.

Trying to use "include lists" fails with a giant list of "please don't re-import " errors. I went looking for "include" in the docs, and I'm pretty sure it's not there at all. I do see the docs for "import", which give me everything I need, but it looks like "include" is undocumented.

Steps to reproduce:

  1. visit this URL: https://www.pyret.org/docs/latest/Glossary.html?q=include

Documentation/Functionality Error for scene-line

https://pyret.org/docs/latest/image.html#%28part._image_scene-line%29

scene-line :: (
img :: Image,
x1 :: Number,
y1 :: Number,
x2 :: Number,
y2 :: Number,
background :: Image
)
-> Image
Draws a line from (x1,y1) to (x2,y2) on the scene background. Unlike add-line, this function crops the resulting image to be the same size as background.

But the background parameter should instead refer to a parameter of type ImageColor, as seen below for add-line:

https://pyret.org/docs/latest/image.html#%28part._image_add-line%29

add-line :: (
img :: Image,
x1 :: Number,
y1 :: Number,
x2 :: Number,
y2 :: Number,
color :: ImageColor
)
-> Image
Creates a new image like img with a line added starting from the point (x1,y1) and going to the point (x2,y2). Unlike scene-line, if the line passes outside of img, the image gets larger to accommodate the line.

Additionally, scene-line adds a small black border around the resultant image, which is not a stated feature of either scene-line, add-line, or crop.

Link to Bootstrap

@schanzer suggests linking to Bootstrap from the main page (like we do to DCIC), which is a good idea. Just having a full curriculum list would be nice and we can add others as needed.

runtime.runThunk is undocumented.

runtime.runThunk seems to be critical to getting Pyret and Javascript to play nicely together when you want to do asynchronous things, but I can't find it anywhere in the docs.

Possible Type in string-dict documentation

Possible typo on the following line.

@collection-doc["mutable-string-dict" #:contract `(a-arrow ("elt" "a") ,(SD-of "a"))]

Maybe this should return a mutable string dict?

The current line returns a String Dict (SD-of "a")
@collection-doc["mutable-string-dict" #:contract `(a-arrow ("elt" "a") ,(SD-of "a"))]

I think the correct line would be the following but I may be incorrect!

@collection-doc["mutable-string-dict" #:contract `(a-arrow ("elt" "a") ,(MSD-of "a"))]

gdrive imports are undocumented?

The only example on the relevant docs page is import equality as EQ (a builtin library).

The my-gdrive and shared-gdrive variants should be documented there as well.

If they are documented elsewhere, I would not know where to look.

example in "extracting columns from tables" incorrect

On the Tables page, under "Extracting Columns from Tables" (currently section 3.22.7), there is the following example:

name-list = select name from my-table end
check:
  name-list is [list: "Bob", "Alice", "Eve"]
end

The "select" in this code example should say "extract" as shown below:

name-list = extract name from my-table end
check:
  name-list is [list: "Bob", "Alice", "Eve"]
end

Mention "no preceding space" rule for left paren in function declaration and lambda expressions

Currently this rule is mentioned in

But Pyret will also complain if a space exists before opening parenthesis in

This also seems to suggest, that the grammar rule for ‹args› (line 916 below)

fun-decl: FUN NAME fun-header [BLOCK] COLON doc-string block where-clause END
fun-header: ty-params args return-ann
ty-params:
[LANGLE list-ty-param* NAME RANGLE]
list-ty-param: NAME COMMA
args: LPAREN [list-arg-elt* binding] RPAREN

should be updated to

args: PARENNOSPACE [list-arg-elt* binding] RPAREN

As a reference, in pyret-grammar.bnf in pyret-lang repo, ‹args› has grammar rule

args: (PARENNOSPACE|PARENAFTERBRACE) [binding (COMMA binding)*] RPAREN

Consistent Ordering of Builtins and Libraries

Right now, the order of the entries on the Builtins and Libraries page (horizon link) makes sense to us as Pyret compiler developers, but it seems counterintuitive. They should be reorganized to either (a) be alphabetized or (b) be partitioned into logical groups which are then individually alphabetized. Regardless, we should pick a convention and stick with it.

Note that even in the case of (a), the Builtins should be kept at the top, with the Libraries beneath them.

@jpolitz @shriram @blerner @anyotherhigherpowersthatbe

for operators

We could use a list of the built-in valid for operators in addition to map, filter and fold.

I just wrote one for fold_n (https://code.pyret.org/editor#share=11xDUUtBkp-FtsvXGV3izsA3sOeJhY89U&v=be0f222) for myself and was just going to start on fold2 when I discovered to my surprise that it already works. I couldn't find the relevant code in the Pyret source tree.

The longer explanation of for operators should also be moved from the tour to section 2.1.

Num-atan2 needs documentation

The documentation for num-atan is incomplete, and doesn't explain the range of angles that it returns. Then we need to explain num-atan2 and how and why it differs.

Document `lists.take-while`

Once brownplt/pyret-lang#1134 lands, we'll have a new function take-while available, which takes a predicate and splits a list into a front and back part such that all the items in the front list pass the predicate, and the first item of the back list fails.

Search: support space

Entering "expression forms" in the search bar will instead search for "expression%20forms". We need to deal with the percent encoding properly.

documentation error

https://pyret.org/docs/latest/tables.html#%28part._.Ordering_.Tables%29

This example will first sort the data in increasing order on column1. If there are any duplicate values in column1, each such group of rows will be sorted in decreasing order by column2. If there are any duplicates in both columns, each remaining group will be sorted in increasing order by column3.

But the order expression is in the order column1, column3, column2. Just swap 3 and 2 in the displayed code.

Thanks to Henry Nieves at Brown for finding this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.