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

Add checking mode examples for append #2773

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jgarte
Copy link

@jgarte jgarte commented Jan 15, 2025

This pull request adds a checking mode/direction example for append.

@jgarte jgarte changed the title Master Add checking mode example for append Jan 15, 2025
@triska
Copy link
Contributor

triska commented Jan 16, 2025

My personal opinion: Illustrating list predicates is a good opportunity to show how conveniently strings can be written in Scryer Prolog. For example:

?- append("Scr", "yer", "Scryer").
   true.

@jgarte
Copy link
Author

jgarte commented Jan 16, 2025

My personal opinion: Illustrating list predicates is a good opportunity to show how conveniently strings can be written in Scryer Prolog. For example:

?- append("Scr", "yer", "Scryer").
true.

This sounds good to me. Should I update the proposed PR to use your string example in both modes for append/3?

@triska
Copy link
Contributor

triska commented Jan 16, 2025

Personally, I would favour such a change, yes. @aarroyoc I would also greatly appreciate your opinion on this. Thank you a lot!

@triska
Copy link
Contributor

triska commented Jan 16, 2025

Regarding the wording of the documentation for append/3, please also consider the Prologue:

https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue#append

Note how generally phrased the sufficient condition is: "... true if Zs is the concatenation of the lists Xs and Ys."

It doesn't say "concatenate the lists" (which would suggest only a single usage mode), but "true if ...".

@jgarte
Copy link
Author

jgarte commented Jan 16, 2025

@triska I'll wait on @aarroyoc 's opinion here for the PR.

@aarroyoc
Copy link
Contributor

I agree with @triska that append/3 is a good place to showcase Scryer Prolog strings but I would keep at least one example with the [] syntax to not confuse people into thinking it's a predicate exclusively made for strings.

@jgarte jgarte changed the title Add checking mode example for append Add checking mode examples for append Jan 16, 2025
@jgarte
Copy link
Author

jgarte commented Jan 16, 2025

@aarroyoc @triska Ok, I pushed a new commit with the suggestions. What do you think?

@triska
Copy link
Contributor

triska commented Jan 16, 2025

Looks excellent to me, thank you a lot! Please consider also the description of the predicate if you are interested! Ideally the description also conveys the generality.

@jgarte
Copy link
Author

jgarte commented Jan 17, 2025

Looks excellent to me, thank you a lot! Please consider also the description of the predicate if you are interested! Ideally the description also conveys the generality.

@triska Pushed a commit to improve that. Thanks for the suggestion!

a17e529

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

Successfully merging this pull request may close these issues.

3 participants