Add stx txexpr functions in txexpr/stx #5

Merged
AlexKnauth merged 7 commits from stx into master 6 years ago
AlexKnauth commented 6 years ago (Migrated from github.com)

Similar to functions like stx-car from syntax/stx, this PR adds:

  • stx-xexpr?
  • stx-txexpr?
  • stx-txexpr->values
  • stx-txexpr->list
  • stx-txexpr-tag
  • stx-txexpr-attrs
  • stx-txexpr-elements
Similar to functions like `stx-car` from `syntax/stx`, this PR adds: - `stx-xexpr?` - `stx-txexpr?` - `stx-txexpr->values` - `stx-txexpr->list` - `stx-txexpr-tag` - `stx-txexpr-attrs` - `stx-txexpr-elements`
mbutterick commented 6 years ago (Migrated from github.com)

I can take the container functions. I would be unwise to accept the others, because I don’t know anything about syntax-parse and thus cannot maintain the code. (It would also need docs & tests.)

Why not create a separate stx-txexpr package that depends on txexpr but adds your stx module to the txexpr collection.

I can take the `container` functions. I would be unwise to accept the others, because I don’t know anything about `syntax-parse` and thus cannot maintain the code. (It would also need docs & tests.) Why not create a separate `stx-txexpr` package that depends on `txexpr` but adds your `stx` module to the `txexpr` collection.
AlexKnauth commented 6 years ago (Migrated from github.com)

What if I took out just the two syntax-parse forms, and left the functions like stx-txexpr? and stx-txexpr->values? I could define the syntax-parse forms in terms of those functions.

What if I took out just the two `syntax-parse` forms, and left the functions like `stx-txexpr?` and `stx-txexpr->values`? I could define the syntax-parse forms in terms of those functions.
mbutterick commented 6 years ago (Migrated from github.com)

Still would need tests & docs.

Also, I remain unclear about the overall purpose of these functions. I thought stx-txexpr-tag? would be a predicate for syntax objects that contain txexpr-tag?. But that's not so — it also returns #true for ordinary txexpr-tags.

Still would need tests & docs. Also, I remain unclear about the overall purpose of these functions. I thought `stx-txexpr-tag?` would be a predicate for syntax objects that contain `txexpr-tag?`. But that's not so — it also returns `#true` for ordinary `txexpr-tag`s.
AlexKnauth commented 6 years ago (Migrated from github.com)

Yes, just like stx-pair? returns true on both normal conss and syntax containing them and stx-null? returns true on both normal '() and syntax containing it.

Yes, just like `stx-pair?` returns true on both normal `cons`s and syntax containing them and `stx-null?` returns true on both normal `'()` and syntax containing it.
mbutterick commented 6 years ago (Migrated from github.com)

OK, if it corresponds to an existing idiom, that’s fine.

OK, if it corresponds to an existing idiom, that’s fine.
AlexKnauth commented 6 years ago (Migrated from github.com)

All the functions in syntax/stx work just as well on normal non-syntax versions as they do on full syntax versions. And one of the reasons you would use stx->list instead of syntax->list is for situations like (cons 1 (cons 3 #'(3 4))), where it's both a "normal" cons and could-be-flattened-into-a-normal-list, but part of the list inside still needs to be converted.

I will delete the syntax-parse forms and add tests and docs.

All the functions in `syntax/stx` work just as well on normal non-syntax versions as they do on full syntax versions. And one of the reasons you would use `stx->list` instead of `syntax->list` is for situations like `(cons 1 (cons 3 #'(3 4)))`, where it's both a "normal" cons and could-be-flattened-into-a-normal-list, but part of the list inside still needs to be converted. I will delete the syntax-parse forms and add tests and docs.
AlexKnauth commented 6 years ago (Migrated from github.com)

I have added tests and docs.

I have added tests and docs.
AlexKnauth commented 6 years ago (Migrated from github.com)

Thanks for catching those typos

Thanks for catching those typos
mbutterick commented 6 years ago (Migrated from github.com)

Thank you for the PR

Thank you for the PR
The pull request has been merged as 87cd845136.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b stx master
git pull origin stx

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff stx
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/txexpr#5
Loading…
There is no content yet.