Giter Club home page Giter Club logo

beautiful-racket's Issues

brag cuts literal when it is not instructed to

Hi,

I'm currently writing a grammar for a Prolog-like language. It contains the following rule: abstract-list : /"[" [abstract-term ("," abstract-term)* ["|" (abstract-list | abstract-variable)]] /"]"
If I use this rule to parse a larger data structure which contains an abstract list (for instance, (mycompound([g1,g2]))), the comma disappears from the parsed datum. If I put in a vertical bar instead, that is included in the parsed datum.

So, the whole parse tree, when I use a comma:

(at
  (treelabel
    ((abstract-atom "mycompound" (abstract-list (abstract-g-variable 1) (abstract-g-variable 2))))))

And the parse tree, when I use a bar:

(at
  (treelabel
    ((abstract-atom "mycompound" (abstract-list (abstract-g-variable 1) "|" (abstract-g-variable 2))))))

I figured this might have something to do with the cut also being applied in nested terms, so I rewrote the rule as follows:

abstract-list : /"[" [abstract-term term-tail ["|" (abstract-list | abstract-variable)]] /"]"
@term-tail : ("," abstract-term)*

But now the comma is included, so I get:

(at
  (treelabel
    ((abstract-atom "mycompound" (abstract-list (abstract-g-variable 1) "," (abstract-g-variable 2))))))

The latter is the result I want, but fail to see why the original rule and the one with the term-tail spliced in lead to a different outcome.

gui-lib issues

Hi, I'm running Racket v6.5, but I'm having issues with this library.

gui-lib (have 1.24, need 1.26)

Unfortunately, gui-lib is in the installation scope, so doesn't get automatically updated.

And updating it doesn't seem to work either:

$ raco pkg update -i gui-lib
> No updates available

Would you be able to point me in the right direction?

contract violation when running #lang reader stacker-demo/stacker

In the first tutorial, I encounter an error on MacOS when running this command:

#lang reader stacker-demo/stacker

 Library/Racket/8.3/pkgs/beautiful-racket-demo/stacker-demo/stacker.rkt:14:5: first: contract violation
  expected: (and/c list? (not/c empty?))
  given: '()

which seems to originate here

My installation seems to be correct, asracket -l br/test returned You installed beautiful-racket v1.6 correctly. and I can run #lang br, #lang br/quicklang without problems. I've also set the #lang br to be default as suggested in the tutorial.

Broken example code:

https://github.com/mbutterick/beautiful-racket/blob/master/beautiful-racket-lib/br/scribblings/br.scrbl

Unless I'm mistaken in reading the docs for define-macro, these two examples are not meant to include errors:

> (sandwich brie ham please)
eval:30:0: syntax-parse: literal is unbound in phase 0
(phase 0 relative to the enclosing module)
  at: sandwich
  in: (syntax-parse (syntax-case stx () (any (syntax any)))
#:literals (sandwich) #:datum-literals (please) ((sandwich
TOPPING FILLING please) (begin (syntax (format "I love ~a
with ~a." (quote FILLING) (quote TOPPING))))) (else
(raise-syntax-error (quote san...
> (sandwich banana bacon please)=
eval:30:0: syntax-parse: literal is unbound in phase 0
(phase 0 relative to the enclosing module)
  at: sandwich
  in: (syntax-parse (syntax-case stx () (any (syntax any)))
#:literals (sandwich) #:datum-literals (please) ((sandwich
TOPPING FILLING please) (begin (syntax (format "I love ~a
with ~a." (quote FILLING) (quote TOPPING))))) (else
(raise-syntax-error (quote san...

Errors during package install

I'm running on macOS 10.14.4 and wanted a clean/fresh DrRacket environment. I did the following:

  • deleted ~/Applications/DrRacket
  • deleted ~/Library/Racket
  • deleted all PL and racket files from ~/Library/Application Support/Preferences
  • re-installed DrRacket

When I try to install beautiful-racket from the command-line using the following

raco pkg install --auto beautiful-racket

I get all sorts of errors during the install. The first error looks like this:

standard-module-name-resolver: collection not found
  for module path: brag/lang/reader
  collection: "brag/lang"
  in collection directories:
  ...

Other errors report not being able to open a module file.

open-input-file: cannot open module file
  module path: brag/support
  path: /Users/kevin/Library/Racket/7.2/pkgs/brag/support.rkt
  system error: no such file or directory; rktio_err=3

I verified that file is not present on my drive, but I suspect I'm getting a cascade of errors due to the initial error.

If I test the beautiful-racket install via racket -l br/test, I get a message that it has installed correctly; however, with all of the errors I'm seeing, I'm not sure if I can trust that :). Perhaps my DrRacket install is hosed.

Thanks!

stackerizer-mb macro flatten arity mismatch

In the middle of the page (http://beautifulracket.com/stackerizer/the-expander.html) where the input gets flatten the shown code:

(define-macro (stackerizer-mb EXPR ...)
  #'(#%module-begin
     (for-each displayln (reverse (flatten EXPR ...)))))

fails with

flatten: arity mismatch;
 the expected number of arguments does not match the given number
  expected: 1
  given: 5
  arguments...:

the code should be

(define-macro (stackerizer-mb EXPR ...)
  #'(#%module-begin
     (for-each displayln (reverse (flatten EXPR))) ...))

Include project status info

I'd like to read the book, but it's hard to tell which chapters are 100% done and how many chapters you're intending to write.

Maybe include a tentative table of contents with a % completed by each chapter?

Can't send feedback

Hi, I was trying to send feedback with the included comment section, but it looks like you're trying to request a rkt file over mixed HTTP when posting a comment, and Chrome is blocking it. Here's the whole error message in the developer console:

VM131:1 Mixed Content: The page at 'https://beautifulracket.com/jsonic/the-tokenizer.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://beautifulracket.com/scripts/poster.rkt'. This request has been blocked; the content must be served over HTTPS.

Thanks so much for the book, really enjoying it!

bound-identifier=?: contract violation

Steps to reproduce:

  1. Down­load basic-tuto­r­ial.zip (https://beautifulracket.com/basic/source-listing.html)
  2. Run raco pkg install basic/

Result:

raco setup: 3 making: <pkgs>/basic
bound-identifier=?: contract violation
  expected: identifier?
  given: #f
  argument position: 2nd
  other arguments...:
   #<syntax:/home/sorawee/Desktop/basic-tutorial/basic/expander.rkt:12:10 b-line>
  compilation context...:
   /home/sorawee/Desktop/basic-tutorial/basic/expander.rkt
  context...:
   /home/sorawee/.racket/6.10.1/pkgs/beautiful-racket-lib/br/private/generate-literals.rkt:25:0: generate-bound-and-unbound-literals4
   /home/sorawee/.racket/6.10.1/pkgs/beautiful-racket-lib/br/define.rkt:151:11

Confusing error for `(define-macro (id x ...) ....)`

When an ellipses follows a non-wildcard variable, define-macro can give a strange error message. E.g.:

#lang racket/base
(require br/define (for-syntax racket/base))

(define-macro (my-begin x ...)
  #'(begin x ...))

Error message:

$ raco make foo.rkt
foo.rkt:5:13: syntax: no pattern variables before ellipsis in template
  at: ...
  in: (begin x ...)

define-macro should warn about ... that don't come after a wildcard (I think that's the only place they're allowed)

Incorrect contract for previous-line function

The contract seems to specify that it always return exact-nonnegative-integer? but it may return #f if on the first line. This does not seem to be checked currently otherwise the indentation example in the book would fail.

missing package dependency

Looks like a dependency on "at-exp-lib" is needed:

raco setup: --- summary of package problems ---
raco setup: undeclared dependency detected
raco setup:   for package: "beautiful-racket-lib"
raco setup:   on package:
raco setup:    "at-exp-lib"

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.