Wishlist: array language like K

“Thank you, I’m feeling much better! :blue_heart:

2 Likes

@andradefr8 I’ve just reviewed your PR and it is great! Thanks a ton. I’ve approved so feel free to merge.

Thank you, the merge has been successfully completed. My next steps involve updating the existing exercises. I have some ideas that I plan to implement, and I welcome any thoughts or alternative suggestions:

  • I’m considering adding an option to ignore the tests (need to investigate how this will interact with the test runner)
  • I’m thinking of replacing the use of the ] verb with the 13!:8 (55) foreign in the stub file. This will return a custom error message prompting the user to make their implementation, which I believe is a common practice in most tracks.
  • I plan to replace ,: with 1$ when simply changing the shape of the verb argument by one. I believe that $ makes the intention clearer (and it’s easy to mixup the monadic uses of ,:, ,., and , , specially for beginers).

Since there are no official code formatting guidelines, I will adhere to the style used in the book ‘J for C Programmers’ and the compilation ‘Fifty Shades of J’

That would be great! Depending on the test framework, the test runner usually does something like:

  • Pass in an additional argument to the test command that forces all tests to run
  • Set an environment variable that forces all tests to run
  • Use sed or something similar to (temporarily) regex replace the test files’ contents to unskip the tests

I can’t really comment on the other points, sorry.

Update current exercises and adapt the test runner to run all individual tests even when ignore flag is active.

@ErikSchierboom
The general/unittest imposes a limit of 40 characters on test names. Currently, I abbreviate certain words in the names (e.g., "year divisible by 100, not divisible by 400 in common year" becomes "div_by_100_but_not_div_by_400_common_yea"). However, this style is not very good for readabilty and does not align with what is done in language tracks.

My short-term solution involves storing the full name as a temporary file (similar to how we handle ordering and task IDs) and then replacing the test name with the full name in the test runner

In the future i could make a personalized version of the general/unittest including those informations (order, task_id, full name) as properties inside each test case and have an option to load them as locative for the test runner.

That sounds like a nice enough solution!

1 Like

Am delighted that an array language is being added. I had toyed with adding one to my list of additions (after SNOBOL4 and Seed7), namely KLONG. Now I don’t have to. Thank you.

1 Like
  • The label name in the generated JSON is synchronized with the description in canonical-data.json.
  • The use of helper files is simplified:
    • Order and task_id information will not be stored if it’s not necessary.
    • All file handling is now done in the test runner (previously, files were created by the test.ijs file in the solution and deleted either by the test runner or by the JE).

Tomorrow i’ll start to work on new exercises. I’ll try to catch the 48in24 calendar in next three or four weeks.
My list now is:

  • spiral-matrix — (Trying to find purely functional solution for this exercise F# who got me into J)
  • pangram
  • all-your-base — Maybe
    • Trivial solution but can be used to introduce some primitives:
      • Solution can be constructed with combinations of #., #:, p. and while..
    • Possible work around the need of three inputs:
      • Make it an adverb? which value u?
      • Make it a conjunction? u and v are the bases.
      • Boxed input containing the bases as left argument?
      • Boxed input containing the digits and base as right argument?
  • zebra-puzzle — Maybe
  • minesweeper
  • dnd-character
  • pig-latin — Maybe
    • Can’t think any of a solution not using REGEX whitouth going into extra verbosity
  • space-age
  • yacht
  • matching-brackets
  • rna-transcriptionDone
  • binary-search — Probably not
    • If you need to implemt this you would go for another language
  • secret-handshake — Maybe
    • Almost trivial solution
    • Probably as a concept using gerunds
  • anagram
    • Also trivial
    • Can be an introduction to indexings
  • kindergarten-garden
  • robot-simulator
  • knapsack
  • meetup

Next, my intent is to also include some easier exercises tied to concepts (like leap , collatz , raindrop ) and adapt the concept exercises from the F# track.

Just to be clear, I would suggest to focus on just getting those initial 20+ practice exercises done just to be able to launch the track. After that, porting concept exercises sounds great!

Add the exercises:

  • leap
  • collatz-conjecture
  • spiral-matrix
  • pangram
  • raindrops

and updates current exercises

Nucleotide-count and collatz-conjecture are marked as "wip’ because i am not sure on how to treat the cases where an error is expected. I did not find a way to make the verbs to produce a domain error without calling the foreign 13!:8(45).

The track has now 12 exercises (10 of them completed).

1 Like

If some tests cases don’t make sense for your exercise, feel free to ignore them (best to add include = false in their tests.toml entry). Not all test cases make sense for a track, so feel free to ignore those.

In my view, these exercises necessitate a specific type of error—specifically, a domain error—rather than a general one.
To provoke this specific error, I utilize the 13!:8 debug foreign function. However, a newcomers probably will not encounter this function before a considerable period of time.
Considering these factors, I have reservations about including the error check, as it could potentially transform straightforward exercises into more challenging ones.

An option would be to include a note specifying that the function should return empty for illegal values. This mirrors the way the Haskell track handles some similat situations by returning Nothing

1 Like

That’s also an option. But you should feel free to omit the test cases and only have error checking for later exercises

Add exercises:

  • space-age
  • dnd-character
  • yacht

About the error cases, I think I found a good middle-ground solution. For the currently implemented exercises that deal with error cases, I am making the tests pass if the solution returns empty or the proper error for the exercise. Later, I try to fit the information about the error return could fit at the intructions as an extra option.

This week, I intend to meet the 20-exercise cap and then take a deeper look at the documentation. I’ll probably add some snippet examples to the instructions for exercises with multiple inputs too.

2 Likes

Reviewed. Just one tiny nit.

Sorry, I just accepted the changes

1 Like