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

Added function to write words as strings #661

Closed
wants to merge 3 commits into from

Conversation

mariatsalakou
Copy link
Collaborator

No description provided.

@james-d-mitchell james-d-mitchell added the new-feature A label for PRs that contain new features label Apr 14, 2020
Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariatsalakou this looks good, just a few hoops left to jump through and I'll be happy to merge.

@@ -0,0 +1 @@
DeclareOperation("WordToString", [IsString, IsList]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file requires the copyright header, same as the other files.

gap/fp/word.gi Outdated
function(alphabet, word)
local str, i, j;
str := "";
j := PositionMaximum(word);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use j = Maximum(word);?

gap/fp/word.gi Outdated
[IsString, IsList],
function(alphabet, word)
local str, i, j;
str := "";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to assign str to a value only after checking that alphabet and word are compatible.

gap/fp/word.gi Outdated
str := "";
j := PositionMaximum(word);
if word[j] > Length(alphabet) then
return "Error, there are not enough letters in the alphabet";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the correct way to do an error in GAP, you should use ErrorNoReturn, please look at another file in Semigroups to see an example.

@@ -0,0 +1,8 @@
WordToString := function(alphabet, word)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove this file completely, git rm gap/WordToString.g

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to remove this file @mariatsalakou

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you re-introduced it when you did a merge.

configure.ac Outdated
@@ -23,7 +23,7 @@ AC_CANONICAL_HOST
dnl ##
dnl ## Setup automake
dnl ##
AM_INIT_AUTOMAKE([1.11 -Wall foreign subdir-objects])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are already in the master branch, it looks like you'll need to rebase your branch on the master branch: git fetch origin master && git rebase master (origin might have to be upstream or something else, depending on your setup.

Copy link
Collaborator

@flsmith flsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good!
Some documentation and tests would be welcome here.

@@ -0,0 +1,8 @@
WordToString := function(alphabet, word)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to remove this file @mariatsalakou

gap/fp/word.gi Outdated
[IsString, IsList],
function(alphabet, word)
local str, i, j;
j := Maximum(word);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important, but you could just use Maximum(word) in the following line instead of defining j

@@ -0,0 +1,8 @@
WordToString := function(alphabet, word)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you re-introduced it when you did a merge.

gap/fp/random.gd Outdated
#############################################################################
##
## random.gd
## Copyright (C) 2020 James D. Mitchell
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you authored this, I think your name should be here as well!

gap/fp/random.gi Outdated
##
## random.gi
## Copyright (C) 2020 James D. Mitchell
##
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please combine the two files into one with the name fp/word.g, then I'm happy to merge.

Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nearly ready to go. I made some minor edits, but there's one final thing that you'll have to do @mariatsalakou, and that's actually include the documentation you've written in the manual, which I suggest doing by adding a new section to the file docs/z-chap10.xml. I'm not 100% sure that the documentation you've written will compile (the RandomWord entry is missing the \<Description\> tags.

doc/word.xml Outdated Show resolved Hide resolved
Co-authored-by: Murray Whyte <[email protected]>
@MTWhyte
Copy link
Collaborator

MTWhyte commented Jul 29, 2020

This PR's superseded by #686.

@MTWhyte MTWhyte closed this Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A label for PRs that contain new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants