Can I get some eyes on the WIP jq track?

It looks like the assert_equal arg order was swapped. PR sent.

Yeah, in probably. This StackOverflow answer goes into great depth about the issues at hand: windows - PowerShell stripping double quotes from command line arguments - Stack Overflow

EDIT: I can only imagine the confusion this could potentially avoid from Windows users!

I had a stab at making the exercises in the syllabus. Submitted my solutions for mentoring if someone is monitoring those and wants to take a look at them.

Going through the concepts was a great experience and I had lots of fun! My previous experience with jq was very little, I mainly used it as a json pretty-printer and for some very basic “get a field from this json” kinds of tasks. Once I tried to read the documentation on jq to know a little more but came away confused by some of the topics.

The jq track changed all of that! I found the explanations detailed enough to be useful, but not so detailed to be boring. They were straight to the point. And something about how the concepts were put together made jq really click with me in a way the official documentation didn’t, so thanks for that! I feel I learned a lot just with these 3 exercises and feel well-equipped to understand better the official documentation now.

Some of the things I found:

  • The setup. I figure the track docs are not quite ready yet, but they were missed. I like to run all tracks on exercism locally, and I wanted something to make sure I wasn’t doing something not intended. I know my way around bash, but I didn’t know about bats. Each exercise cames with two bats-related files and I kinda guessed that I had to run the .bats one to run the tests. I also found that running the filter on its own with some input was very valuable for debugging and trying things out, so some instructions introducing the -f flag can also be good.
  • I also found the initial concept a bit long, but weirdly I think I actually liked that. As I mentioned, I think no information provided there was wasteful. Despite being a lot of information I found everything interesting and useful. I was never bored reading it. A potential idea for splitting the initial concept a bit can be to have a concept for arrays and objects separate. After reading the part about arrays I felt totally ready to do an exercise just about arrays.
  • I was also caught by the need of () around some instructions. I eventually figured it out, but even when I did, I was unsure exactly why it worked.
  • For the “Lasagna” exercise, I felt the need of using .some_key // 0 to give a default value for the expression in case some_key was not present. But I was not sure if I was supposed to do that because the // operator was not introduced. I looked at Isaac’s solution after and he was clever in using a default object containing the default values and merging it with the actual object received using the + operator. Although the “basics” concept shows the merging of objects, maybe including an example on what happens when you merge objects with some keys that are the same can be useful. And/or introduce the // operator.
  • For the “Remote Control Car” exercise, I felt the need to use if statements which are not introduced in the concepts. After solving I also took a peek at the exemplar solution, which uses assignments to properties in the form of .nickname = nickname, which I didn’t know were possible just with the text from the concepts. Despite assignments to properties not being strictly required for the exercise, maybe having an example or 2 showcasing them could be useful. Or maybe this can be introduced in an earlier concept just about objects.
1 Like

Wow, excellent feedback. Lots to consider.

I agree that Basics is too long. One for arrays and one for objects sounds right. When building the concepts/exercises, I

  1. Started with a sketch of
  2. chose a story, (surprisingly tricky)
  3. Wrote the exemplar and tests
  4. Only then, when I know what material to cover did the concept text get written.

If anyone wants to help out with a story and exemplar for

  1. arrays: index, slice, construct (including capturing elements of a stream), .[] to output the elements as a stream, concatenate, methods of iteration (map, select, perhaps reduce)
  2. objects: index (various ways), construct, merge, modify sub-elements, test for keys (has, in), to/from_entries
  3. also the “new basics” without arrays and objects, or with minimal instruction about arrays and objects

27 exercises completed, 11 to go. I’m not sure what it is about jq but I’m having a blast solving these. Maybe too much fun, if you ask my fiancé… Thanks for putting this track together!


While you’re doing this, consider if there are additional concepts that would be helpful

String interpolation is pretty useful and seems missing from the concepts. Ditto on reduce.

For more advance one, I’d love to see concept docs/exercises on reduce, for, path, recurse, walk, limit. (I haven’t yet figured out how to use limit.)

There’s also mention of tailcall optimization which, I think, if a really interesting topic, but it only gets a single sentence.

nth-prime instructions says the tests use --argjson n for the input. The bats file inputs the n via STDIN. Which should it be?

Ah. We need to restore the bats from from git history and exclude this exercise from the test generator. Can you open an issue/PR please?

For nth-prime (again), we may need to disable the 10001 test. I can get 1001 in 2 seconds by only checking prior primes and by limiting to sqrt(candidate) but I’m not sure I can get 10001 in under 10s. I’m currently at 4 minutes :slight_smile:

Without giving away any secrets, the example.jq runs in about 4 seconds.

I have this exercise as difficulty 7 which is still “medium” I think.

I think this kind of discussion could move to Programming/jq category


Note that getting the right granularity for the concept exercise is extremely hard. The way you’ve gone about it, creating concept exercises, testing them and then tweaking them (e.g. splitting up a concept exercise into multiple exercises, or introducing new prerequisite concept exercises) is the way we recommend these exercises to be built. It is so much easier to see what makes sense and what doesn’t if you have implemented the actual concept exercises.

Do we need assistance in getting a jq tag added?

jq already exists as a subcategory of #programming => #programming:jq

(I see the notation discourse uses now with the hash and the colon)

@IsaacG , @porkostomus , @andrerfcsantos

I can’t “at” you as reviewers in github, but please have a look at Basics improvements by glennj · Pull Request #88 · exercism/jq · GitHub

Commented on some of the phrasing.