Choose Language Hide Translation Bar
JMP scripting challenge 1

jmp-challenge-v2.pngWelcome to the first in what I plan to be a series of regular JMP challenges! For the most part, these challenges will focus on the JMP Scripting Language (JSL), but occasionally, I'll sneak something in that can be doe without scripting.

On or around the first of every month, I hope to offer you a problem that will test your JMP abilities. Each challenge will look to emphasize certain programming and data-oriented skills as they apply to JMP. I’d like to encourage everybody, regardless of your ability level, to give them a try. During my career, I have learned more by trying to do what seemed impenetrable, beyond my skills, coming up with a solution, and then learning (or discovering) a better way to do things.

With each new post, I’ll call out the best performers from the previous challenge and share their solutions along with other interesting solutions. I’ll talk about what I think made the previous challenge challenging, and try to offer bits of wisdom.

As time goes on, I’ll keep track of the top performers. The challenge will be open to everyone, but I’ll keep the staff entries separate from the rest. As you might expect, we have a few ringers at JMP.

The rules are simple:

  1. Everything must be done completely in JMP, without invoking any application outside of JMP such as SAS, R, or Python, or using external sources of supplementary information.
  2. A script must complete its task in a reasonable time, as specified in the challenge.
  3. It must run on Catalina or Windows 10.
  4. While I prefer using JMP 15, I am willing to consider testing it on JMP 14. If this is your preference, you need to let me know in your entry.
  5. Post your entries to the blog. I must receive your final entry by 11:59 PM Eastern Time on the day of the deadline. I will consider only one entry per person.

Points will be awarded each month to the top-performing scripts based on criteria appropriate for the challenge. While the challenge is going on, I will moderate the comments section to keep hints, clues, submissions, etc., from inadvertently getting out. I will let you know when I receive your entry.

JSL Challenge 1

I love a good word puzzle. This challenge is inspired by Spelling Bee in The New York Times. In it, you must create words from a list of seven letters with the condition that one of the letters is always used. The other letters can be used once, more than once, or not at all. I am modifying the conditions to make things a bit trickier.

Given seven letters, find:

  1. The longest word using all seven letters and only those seven letters. Letters may be used more than once.
  2. The longest word using all seven letters and any other letters.
  3. The longest word using all seven letters and any other letters where no letter from the set of seven is used more than once.
  4. The longest word in which 5 of the 7 letters appears. Any letter including those outside of the 7 may appear once or more except the two unused letters from the list of 7, which may not appear at all.

For all four items, there may be no words that meet the criteria or multiple words. Scripts must accept a list of seven lower case alphabetical character (a-z) strings that will be stored in a global variable named letterSetList. For example, if the first item in the list is "abcdefl", the answers would be:

  1. "defaceable"
  2. "discomfortableness"
  3. "fibrochondrosteal"
  4. "formaldehydesulphoxylate" and "scientificophilosophical"

All scripts will be tested on the same three seven-letter sets. All words will be taken from the dictionary posted below. Please access it as a JMP data table when your script executes. Write all words to the log. Make sure to include the item number with the output. You will have a time limit of five minutes total. Entries must be received by 11:59 PM Eastern Time on Wednesday, April 15.

Scoring: Two points for each correct solution. Two additional points for solving all four. The three fastest scripts (total time to answer all four items correctly) will be awarded 6, 3, and 1 points. Two points for any script that can produce the correct answer that is half the size or less of the second shortest of the three fastest solutions (total non-white space character count and with comments removed). Three points if your script runs as fast or faster than the fasted submitted by a staff member.

Good luck!

10 Comments
Staff (Retired)

Nice challenge!

Old riddle: 10 letter word that can be spelled with just the keys on the top row of a typewriter?

Level VI

When you say " please access it as a JMP data table" (the wordlist), what is the way you want us to do this?  

 

Use Current Data Table()?  Or a specific file/path reference?  

Staff

@MathStatChem , thanks for asking. Either way would work. The dictionary table will be opened in JMP and be the current data table. If you using the file reference approach, assume the table will be saved in the same directory as your script. Avoid using any user query functions (like Pick File() and open it directly from its path location.

Level VI

another question:  for the items in  letterSetList, can we assume that there will be no duplicate letters, that is, no entries like "aabbcc", but rather only entries with a string of letters that occur only once in the string.  

Staff

That is correct. All the letter in a set of seven will be different.

Level VI

for rule 2 should it be "use all seven letters once  and any other letters?", or just that the word must contain all seven letters.

 

 

 

Staff

@MathStatChem for 2. the word must contain all seven letters at least once. It may contain any other letter one or more times.

Level VI

How do you want us to post our scripts?  Just as text in a comment here?  

Staff

@MathStatChem it is probably safest to private message me with the script. I am moderating the blog, too, so you could even post here and I can refrain from approving the post until after the 15th.

Staff

A reminder for those considering submitting a script who haven't. You have a little under a week. Deadline is Wednesday April 15th at 11:59 PM Eastern time.