-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
New Exercise: Word count #90
Conversation
rename file |
LOOP AT GROUP BY does not work yet |
no worries, It's probably better to refactor the solution than wait for the implementation which is surely not that easy, right? |
we'll never really know 😅 if the exercise is most easily solved with GROUP BY, then we should wait, but 🤷♂️ everything has different solutions |
If the obvious solution is to use I had a look at the exercise, and can see a couple of ways. IMHO |
@marianfoo can you paste the full code example? Update: oh, its the original code, guess its a derived error |
ah ok, would make sense |
You can try with a different solution :D |
I didn't mean for us, of course we can find workarounds 🙂 What I meant was caution about putting out something where the probability of people running into issues is high. Maybe put a note in the description to avoid LOOP with GROUP BY if time to resolve is unknown, or hold this in draft if we expect it can be implemented in the next week or so. |
perhaps just wait a bit, focus on getting #87 merged, then there are 2 more ready to merge? might leave some time for GROUP BY to be implemented 😅 |
I don't think here's my solution: METHOD count_words.
DATA(clean) = replace( val = to_lower( phrase ) sub = `'` with = `` occ = 0 ).
clean = replace( val = clean sub = `\n` with = ` ` occ = 0 ).
clean = replace( val = clean sub = `\t` with = ` ` occ = 0 ).
clean = replace( val = clean regex = `[^a-z0-9]` with = ` ` occ = 0 ).
SPLIT condense( clean ) AT ` ` INTO TABLE DATA(words).
LOOP AT words INTO DATA(word).
DATA(one_result) = VALUE return_structure( word = word count = 1 ).
COLLECT one_result INTO result.
ENDLOOP.
ENDMETHOD. this does require a change of the result type i.e. TYPES:
return_table TYPE STANDARD TABLE OF return_structure WITH KEY word. PS: Since it's now an abapGit repo, this needs PPS: abaplint errors will go away with #157. |
yeah, I forgot that the collect statement isn't implemented yet simple statement in abap but lot's of things happening behind the scenes. you could replace it with: DATA(one_result) = VALUE return_structure( word = word count = 1 ).
" COLLECT one_result INTO result.
READ TABLE result ASSIGNING FIELD-SYMBOL(<result>) WITH TABLE KEY word = one_result-word.
IF sy-subrc = 0.
<result>-count = <result>-count + one_result-count.
ELSE.
INSERT one_result INTO TABLE result.
ENDIF. |
@mbtools green 🥳 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just remove tests.toml, results.json
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 👍
just a question of how many students will use |
programming in abap for 4 years, never heard of it |
Quite a few errors in solution.
Set status to "WIP" so only maintainers see this on exercism (as documented here)
Source
https://github.com/exercism/javascript/tree/main/exercises/practice/word-count
SAP Unit Tests
ABAP Lint
Few errors
local_testclass_location
Don´t know what that means
check_syntax
May have a problem with the
GROUP
.check_syntax
return_structure
is a local type../exercises/practice/word-count/.meta/zcl_word_count.clas.abap[52, 7] - "return_structure" not found, findTop (check_syntax)
Run Tests in Docker
Don´t know if my docker run is faulty because there are many errors in the output.