Add stx txexpr functions in txexpr/stx #5

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

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 5 years ago (Migrated from github.com)
Owner

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 5 years ago (Migrated from github.com)
Owner

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 5 years ago (Migrated from github.com)
Owner

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 5 years ago (Migrated from github.com)
Owner

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 5 years ago (Migrated from github.com)
Owner

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

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

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 5 years ago (Migrated from github.com)
Owner

I have added tests and docs.

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

Thanks for catching those typos

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

Thank you for the PR

Thank you for the PR
The pull request has been merged as 87cd845136.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

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