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 acronym exercise #219

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Add acronym exercise #219

merged 1 commit into from
Feb 19, 2024

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Feb 19, 2024

No description provided.

@glennj glennj requested a review from a team February 19, 2024 05:00
@@ -0,0 +1,5 @@
.phrase
| [ scan("[[:alpha:]][[:alpha:]']*") ] # find all the words
| map(.[0:1]) # first character
Copy link
Member

Choose a reason for hiding this comment

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

jq has a first function, too. FYI.

Copy link
Contributor Author

@glennj glennj Feb 19, 2024

Choose a reason for hiding this comment

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

Yes, but:

$ jq -n '"hello" | first'
jq: error (at <unknown>): Cannot index string with number
$ jq -n '"hello"[0]'
jq: error (at <unknown>): Cannot index string with number
$ jq -n '"hello"[0:1]'
"h"
$ jq -n '"hello" | explode | first'
104

@glennj glennj merged commit 842deb4 into exercism:main Feb 19, 2024
3 checks passed
@glennj glennj deleted the exercise-acronym branch February 19, 2024 13:56
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.

2 participants