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

Curly braces and square brackets #29

Closed
FemtoEmacs opened this issue Oct 18, 2016 · 4 comments
Closed

Curly braces and square brackets #29

FemtoEmacs opened this issue Oct 18, 2016 · 4 comments

Comments

@FemtoEmacs
Copy link

I am currently writing a tutorial on femtolisp. I would appreciate if the owner of this site and developer of femtolisp modify the compiler, so that curly braces be synonymous for parentheses. The rationale for the change was given in an email to Jeff. The change entails the following modification in the read.c file:

static inline int symchar(char c)
{
static char *special = "()[]{}'";`,| \f\n\r\t\v";
return !strchr(special, c);
}

/* Recognize the tokens */
if ((c == '(') || (c == '{')) {
toktype = TOK_OPEN;
}
else if ((c == ')') || (c == '}') ) {
toktype = TOK_CLOSE;
}

@JeffBezanson
Copy link
Owner

Square brackets are already taken for vectors. If I add curly braces, they will have to match (i.e. } can only match { and not (), so that patch will not be sufficient.

Femtolisp allows { and } as identifier characters, which is arguably a bug and I think should be disabled first of all.

Then there are two further problems:

  1. R6RS allows square brackets to work like parentheses, and uses only #( ) for vectors (which femtolisp also allows). I should likely follow suit.
  2. Lisps generally do not use curly braces as parentheses; they tend to be reserved for read macros and/or things like SRFI 105 (infix syntax).

So I think what we can do is (1) make {} an error, (2) make [] work like parens (with correct matching of course).

@JeffBezanson
Copy link
Owner

@FemtoEmacs I can't seem to find the email you refer to; best to post the rationale here.

@FemtoEmacs
Copy link
Author

The email and the rationale was written by Vernon Sipple, the person who is
writing a tutorial on femtolisp. Mr. Vernon and I are using the same
machine. But I will tell him to post the rationale on the femtolisp github
site. By the way, I am very interested in the issue of bracket as well.

2016-10-19 15:17 GMT-02:00 Jeff Bezanson [email protected]:

@FemtoEmacs https://github.com/FemtoEmacs I can't seem to find the
email you refer to; best to post the rationale here.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUJ1Dxrb-aJ50yJk49cMRjgw_ncjO97Lks5q1lCxgaJpZM4KaIau
.

@JeffBezanson
Copy link
Owner

Closing as dup of #30.

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

2 participants