Coding Intentionally in Bash Grains
exercism.io
exercism.io
- Where can I find a set of practice problems which will force me to really engage with learning a new language?
- Given a specific problem, what does the solution look like in various langauges?
- Given a specific language, what do the solutions to a variety of problems look like?
Unfortunately, exercism's web interface is really only set up to cater to the first of those.
So I made an couple of indexes to solve for the other two:
https://gist.github.com/cellularmitosis/ae76bb09973f55418d97...
https://gist.github.com/cellularmitosis/2aec8d88a76771452f35...
With the new interface, I need to wait for official mentors, and while some have been way above and beyond, the dearth of reactions from anyone for long periods can be a real downer. I preferred the semi-OK amateur mentorship over the wildly inconsistent/non-existent mentor assistance.
There was one mentor that I would have happily paid directly to keep giving me feedback, but there was no mechanism in exercism for me to make that offer, even if exercism took a cut.
Also in the old interface, the community solutions were sorted by recency, so it was easier to interact with other fellow learners, and the new interface is not that, I'm not sure what the order is, but it's of no use for me to comment on a piece of code submitted two years ago.
Just to chime in with data here, there is 5x more feedback per day on the new system than there was with the old system. Depending on the track, you'll get feedback in 3hrs to 7days (very occasionally longer), so it is definitely inconsistent in that respect, but you will get feedback. In the old system, you'd get feedback at all in under 10% of submissions.
> There was one mentor that I would have happily paid directly to keep giving me feedback, but there was no mechanism in exercism for me to make that offer, even if exercism took a cut.
In the future we'll be adding the ability to "pair" mentor/mentees who have both rated the other highly, so this will sort-of happen for you.
I got things like kudos etc... and comments which were helpful, I would have considered either one feedback. In general, there seemed to be more interaction, regardless of whether you call it feedback, or social validation.
The pair mentor/mentee sounds good, I look forward to it!
So Independent Mode is very similar to "classic" Exercism.
I'm defining "feedback" really as (1) - so there are 5x more comments (from mentors + public) now than there were in old Exercism (public).
So for a tangible example: - Feb 1st 2018 (classic): 162 comments, 110 stars - Feb 1st 2019 (new): 831 comments, 46 stars
I randomly picked that date, but every date is basically the same sort of ratio.
Lots of people say the same as you do that it feels like there's less interaction, but really there's a lot more. I feel like we're failing to make Exercism feel as alive as it actually is for some reason, but I'm not sure why :)
It's also worth pointing out that this whole thing is dramatically evolving. It may be that you're a more "expert" developer and doing the more complex problems that means you're effectively lower in the queue (harder to mentor than basic solutions). Things like https://exercism.io/blog/automated-mentoring-support-project aim to free up our mentors to give them more time to deal with the harder problems. And things like https://github.com/exercism/exercism/issues/4658 and https://exercism.io/blog/track-anatomy-project aim to make mentoring easier and more enjoyable, which means we keep mentors around for longer and they mentor more because it's more fun for them. It may also be that you're on a track that has had 5x or 20x growth (I'm not sure if there are any but you get the idea) in which case the speedbump might have corresponded more to the growth of that track than v2.
If you don't mind telling me your exercism handle, I'd be interested to dig into your situation further to understand why you hit that speedbump. It's easy for me to talk in terms of data, but I'm limited to seeing the general patterns rather than hearing real people's stories such as yours, so it's really valuable for me to understand. Feel free to email me (jeremy@exercism.io) if you don't want to disclose it on here :)
I haven't received any peer feedback on my submissions, either, and I've seen almost no stars or comments on any of the solutions I've viewed. There seems to be very little of either one. I think giving feedback is hard and deserves care, which is why I haven't given any myself.
These aren't intended as complaints, just observations on my experience. I've decided the main value for me is that it gives me a set of practice problems, and the opportunity to learn from other people's solutions.
This is frustrating to me; in the Erlang space, we don’t have enough people to abuse the system, so I used to be able to provide and receive feedback from anyone without any negativity.
https://github.com/exercism/exercism/issues/4333
(that's my work account)
This code should be readable enough to give you an idea what is happening and how to change it.
my $board-depth = 8;
my $board-width = 8;
my $squares = $board-depth * $board-width;
my @grains-per-square = ( 1 .. $squares ).map({ 2 ** ($_-1) })
say [+] @grains-per-square;
Which if you read Perl6 says number of squares, and in each one put 2^n-1 grains, then add them all up.Hint: `[]` is the reduction metaoperator, it lets you specify an operator to use when reducing a list. [+] means "add it up".
It finishes basically instantly, and while Perl6 has gotten a lot faster, it is not a fast language (yet?). So no need to optimize this.
I mean you write the code and then marketing will have a poorly specified variation like "double only the odd ones".
If you implemented this as `2^64-1` then you are starting from scratch.
For the above the map only needs a tweak:
map({ $_ %% 2 ?? $_ :: 2**(n-1) })
Or whatever it turns out that marketing meant.In the article, I didn't see informational intentionality, I saw premature optimization and obfuscation.
The `-` must be followed by an alphabetic character (or `_`) for it to be seen as part of an identifier.
So `_-1` is the same as `_ - 1`
{
my \_ = 4;
say _-1; # 3
}
{
sub _ () { 8 }
say _-1; # 7
}
It may be a bad idea to name a variable or subroutine `_` but that is for you to decide, not for Perl6 to decide.
(It's not your overprotective mother.)---
I suppose if you really want to do something completely daft like that, there is not really anything stopping you:
{
my \_ = 3;
say _-1; # 2
my \term:<_-1> = my $ = 4;
say _-1; # 4
_-1 = 53;
say _-1; # 53
say _ -1; # 2
}
Note that it doesn't just create a variable named `_-1`.What it does is much more powerful than that. It modifies the parser lexically to add `_-1` as a term. (Since it is lexical it stops being valid after the closing `}`)
The `my $` is just so that it has a rewritable container so that it can be reassigned to `53` later.
This can be useful for constants that wouldn't otherwise be a valid identifier, and for writing subroutines that are parsed as a bare identifier like a constant would be.
constant term:<> = …
sub term:<foo> () {…}
foo;
foo(); # ERROR: Undeclared routine: foo used at line …
foo 1; # ERROR: Two terms in a rowAs to mixing variable names up with subtraction, you put spaces in your math formulas? someVar-anotherVar*thirdVar is pretty unpleasant to read, so not being able to do that is not much of a problem.
Perl6's relationship to sigils (like $) is a bit weird at first, but is very consistent and "fits lightly under your hands" in practice. Suffice to say, sigils indicate context and constrain the type of data you can put in a container. If you want to refer directly to a value, you use a sigil-less variable:
my \the-great-answer = 42;
See the docs on varibles if you want more information: https://docs.perl6.org/language/variables map({ $_ %% 2 ?? $_ !! 2**(n-1) })
Ternaries in Perl 6 are done with ?? and !!, not with ?? and ::Fortunately the error messages are very good.
But I don't think the point is well made with a contrived whiteboard-interview style problem.
I'd be glad to pay per puzzle or a subscription to get faster feedback.
Please, exercism. Take my money.
Also, clicking "explore languages" at the bottom of the blog does nothing.
I would guess the design choice on the front page change on reloads to try to surface something potentially interesting to everyone, but I am not affiliated with them/have no additional insight. I can see how it would be frustrating.
They must have removed the link you are referencing, because I don't see it now. Clicking it from the front page works (probably because it is an anchor link).
Feel free to open an issue at https://github.com/exercism/exercism for the random language order. If there's consensus then it's an easy one to change.
So in my opinion, the moral of the story isn't simply "design with intent", it's "get your code reviewed".
In a perfect world, readability would be one criteria during reviews, unfortunately it is often overlooked.
let 2**64==0