exercism / julia Goto Github PK
View Code? Open in Web Editor NEWExercism exercises in Julia.
Home Page: https://exercism.org/tracks/julia
License: MIT License
Exercism exercises in Julia.
Home Page: https://exercism.org/tracks/julia
License: MIT License
The current example solution doesn't check for RNG-conflicts. Every so often, CI builds fail as a result.
In #2 the idea of an exercise that requires writing a module, with exports, public interface etc. came up. This is quite important for writing reusable Julia code.
Many of the exercises are too simple for requiring this. My initial idea is that an exercise like Binary Search Tree, (Simple) Linked List or List Ops would work well for it. With the v2 progression system, we could add one of them as a core exercise that unlocks the others and then combine them in a way that the user has to write and extend a DataStructures-module. This is an actual Julia package, so it would be a very practical example.
Given an age in seconds, calculate how old someone would be on:
Mercury: orbital period 0.2408467 Earth years
Venus: orbital period 0.61519726 Earth years
Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds
Mars: orbital period 1.8808158 Earth years
Jupiter: orbital period 11.862615 Earth years
Saturn: orbital period 29.447498 Earth years
Uranus: orbital period 84.016846 Earth years
Neptune: orbital period 164.79132 Earth years
So if you were told someone was 1,000,000,000 seconds old, you should be able to say that they're 31.69 Earth-years old.
We have decided to require all file-based tracks to provide stubs for their exercises.
The lack of stub file generates an unnecessary pain point within Exercism, contributing a significant proportion of support requests, making things more complex for our students, and hindering our ability to automatically run test-suites and provide automated analysis of solutions.
We believe that it’s essential to understand error messages, know how to use an IDE, and create files. However, getting this right as you’re just getting used to a language can be a frustrating distraction, as it can often require a lot of knowledge that tends to seep in over time. At the start, it can be challenging to google for all of these details: what file extension to use, what needs to be included, etc. Getting people up to speed with these things are not Exercism’s focus, and we’ve decided that we are better served by removing this source of confusion, letting people get on with actually solving the exercises.
The original discussion for this is at exercism/discussions#238.
Therefore, we’d like this track to provide a stub file for each exercise.
I want to work on this and get this task in the Julia track.
-GCI 2019
N-th Prime was already taken,
isupper(s::AbstractString)
has been deprecated in Julia 0.6 and needs to be replaced by all(isupper, s)
.
See here for a build log to find the affected exercises: https://travis-ci.org/exercism/xjulia/jobs/198586356 (Ignore the custom-set tests failing, that's a different problem and will be adressed by #30)
This would make for a good first patch. If you need further info, please ask!
Exercise's introduction has the following broken links:
blog post
Julia Manual
I'm new to metaprogramming those tips could be very useful.
I'm really confused by this. In this repo all the test code uses use Test
instead of use Base.Test
, but when I download exercises, my runtest.jl
starts with use Base.Test
, and use Base.Test
also shows up in the "Test Suite" section of the exercise on the website.
I'm doing it as a Code-In task :)
https://github.com/exercism/problem-specifications/tree/master/exercises/allergies
Each language track has documentation in the docs/
directory, which gets included on the site
on each track-specific set of pages under /languages.
We've added some general guidelines about how we'd like the track to be documented in exercism/exercism#3315
which can be found at https://github.com/exercism/exercism.io/blob/master/docs/writing-track-documentation.md
Please take a moment to look through the documentation about documentation, and make sure that
the track is following these guidelines. Pay particularly close attention to how to use images
in the markdown files.
Lastly, if you find that the guidelines are confusing or missing important details, then a pull request
would be greatly appreciated.
Note that this is about the exercises (the test suites and code examples), not people's solutions.
If you want to build something using a Raspberry Pi, you'll probably use resistors. For this exercise, you need to know only three things about them:
In resistor-color duo
you decoded the first two colors. For instance: orange-orange got the main value 33
.
The third color stands for how many zeros need to be added to the main value. The main value plus the zeros gives us a value in ohms.
For the exercise it doesn't matter what ohms really are.
For example:
(If Math is your thing, you may want to think of the zeros as exponents of 10. If Math is not your thing, go with the zeros. It really is the same thing, just in plain English instead of Math lingo.)
This exercise is about translating the colors into a label:
"... ohms"
So an input of "orange", "orange", "black"
should return:
"33 ohms"
When we get more than a thousand ohms, we say "kiloohms". That's similar to saying "kilometer" for 1000 meters, and "kilograms" for 1000 grams.
So an input of "orange", "orange", "orange"
should return:
"33 kiloohms"
Implement a test suite that can run both locally and on Travis CI, that verifies that the example code passes the test suite for each exercise.
Things to consider:
If some tests are marked as skipped or pending in some way, then CI should remove these annotations so that all the tests run against the example, not just the first test.
If we need to rewrite the files in any way, we should copy the exercise to a tmp directory first, so that we don't accidentally end up committing changes that are just for continuous integration or testing purposes.
We should make it possible to test just one exercise at a time, because testing everything can take a while, and very often people are just working on one exercise and will only need to run the full test suite before committing the change.
As we move towards the launch of the new version of Exercism we are going to be ramping up on actively recruiting people to help provide feedback.
Our goal is to get to 100%: everyone who submits a solution and wants feedback should get feedback. Good feedback. You can read more about this aspect of the new site here: http://mentoring.exercism.io/
To do this, we're going to need a lot more information about where we can find language enthusiasts.
In other words: where do people care a lot and/or know a lot about Julia?
This is part of the project being tracked in exercism/meta#103
TL;DR: the problem specification for the Bob exercise has been updated. Consider updating the test suite for Bob to match. If you decide not to update the exercise, consider overriding description.md.
Details
The problem description for the Bob exercise lists four conditions:
There's an ambiguity, however, for shouted questions: should they receive the "asking" response or the "shouting" response?
In exercism/problem-specifications#1025 this ambiguity was resolved by adding an additional rule for shouted questions.
If this track uses exercise generators to update test suites based on the canonical-data.json file from problem-specifications, then now would be a good time to regenerate 'bob'. If not, then it will require a manual update to the test case with input "WHAT THE HELL WERE YOU THINKING?".
See the most recent canonical-data.json file for the exact changes.
Remember to regenerate the exercise README after updating the test suite:
configlet generate . --only=bob --spec-path=<path to your local copy of the problem-specifications repository>
You can download the most recent configlet at https://github.com/exercism/configlet/releases/latest if you don't have it.
If, as track maintainers, you decide that you don't want to change the exercise, then please consider copying problem-specifications/exercises/bob/description.md into this track, putting it in exercises/bob/.meta/description.md
and updating the description to match the current implementation. This will let us run the configlet README generation without having to worry about the bob README drifting from the implementation.
For Google Code-In
Some exercise README templates contain links to pages which no longer exist in v2 Exercism.
For example, C++'s README template had a link to /languages/cpp for instructions on running tests. The correct URLs to use can be found in the 'Still stuck?' sidebar of exercise pages on the live site. You'll need to join the track and go to the first exercise to see them.
Please update any broken links in the 'config/exercise_readme.go.tmpl' file, and run 'configlet generate .' to generate new exercise READMEs with the fixes.
Instructions for generating READMEs with configlet can be found at:
https://github.com/exercism/docs/blob/master/language-tracks/exercises/anatomy/readmes.md#generating-a-readme
Instructions for installing configlet can be found at:
https://github.com/exercism/docs/blob/bc29a1884da6c401de6f3f211d03aabe53894318/language-tracks/launch/first-exercise.md#the-configlet-tool
Tracking exercism/exercism#4102
After my failed attempt at pythagorean triplet😞....
This one would be a cakewalk.
https://github.com/exercism/docs/blob/master/contributing/git-basics.md
https://github.com/exercism/docs/blob/master/contributing/pull-request-guidelines.md
(@SleeplessByte I used your guides as starting point, so you perhaps you want to add those links to your tracks' contributing docs, too)
one last thing: on square of sum / sum of squares, one lesson I want to get across there is the use of
÷
instead of/
. Could someone modify the test to check that the result is an int?
Note: the launch checklist has been made obsolete by a brand new Launch Guide: https://github.com/exercism/docs/blob/master/language-tracks/launch/README.md
Let's keep the general discussions around what needs to be done here in this issue, and open new, actionable issues for next steps.
Some tracks have added assertions to the exercise test suites that ensure that the solution has a hard-coded version in it.
In the old version of the site, this was useful, as it let commenters see what version of the test suite the code had been written against, and they wouldn't accidentally tell people that their code was wrong, when really the world had just moved on since it was submitted.
If this track does not have any assertions that track versions in the exercise tests, please close this issue.
If this track does have this bookkeeping code, then please remove it from all the exercises.
See exercism/exercism#4266 for the full explanation of this change.
There are a number of things we're going to want to check before the v2 site goes live. There are notes below that flesh out all the checklist items.
TODO
)core
auto_approve: true
The v2 site has a landing page for each track, which should make people want to join it. If the track page is missing, ping @kytrinyx
to get it added.
If the header of the page starts with TODO
, then submit a pull request to https://github.com/exercism/julia/blob/master/config.json with a blurb
key. Remember to get configlet and run configlet fmt .
from the root of the track before submitting.
If the "About" section feels a bit dry, then submit a pull request to https://github.com/exercism/julia/blob/master/docs/ABOUT.md with suggested tweaks.
In order to work well with the design of the new site, we're restricting the formatting of the ABOUT.md
. It can use:
Additionally:
<br/>
can be used to split a paragraph into lines without spacing between them, however this is discouraged.If the code example is too short or too wide or too long or too uninteresting, submit a pull request to https://github.com/exercism/ocaml/blob/master/docs/SNIPPET.txt with a suggested replacement.
Where the v1 site has a long, linear list of exercises, the v2 site has organized exercises into a small set of required exercises ("core").
If you update the track config, remember to get configlet and run configlet fmt .
from the root of the track before submitting.
Core exercises unlock optional additional exercises, which can be filtered by topic an difficulty, however that will only work if we add topics and difficulties to the exercises in the track config, which is in https://github.com/exercism/julia/blob/master/config.json
We've currently made any hello-world exercises auto-approved in the backend of v2. This means that you don't need mentor approval in order to move forward when you've completed that exercise.
Not all tracks have a hello-world, and some tracks might want to auto approve other (or additional) exercises.
There are no bullet points for this one :)
As we move towards the launch of the new version of Exercism we are going to be ramping up on actively recruiting people to help provide feedback. Our goal is to get to 100%: everyone who submits a solution and wants feedback should get feedback. Good feedback.
If you're interested in helping mentor the track, check out http://mentoring.exercism.io/
When all of the boxes are ticked off, please close the issue.
Tracking progress in exercism/meta#104
I ran bin/configlet lint .
and it warns that exercise UUIDs must be unique across language tracks. I checked config.json
and yes the listed UUIDs are all inside.
What we need to do, is to replace each affected UUID in config.json
with a new one generated using bin/configlet uuid
.
Currently nothing really breaks from it, and it is a fairly straightforward task. I think it's a good exercise for newcomer to onboard or for Hacktoberfest =P
Any takers who want to clarify about this task, feel free to sound out and we will guide you along =)
Meanwhile, the contributors might want to take note and generate a new UUID for new exercise contributed from now on.
Given a number n, determine what the nth prime is.
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself.
In the upcoming release of Configlet v3.8.0, the lint command will now verify that locked exercises meet the unlocked_by criteria, as defined by the track configuration spec:
Before cutting a release of Configlet I am opening issues on all tracks found to contain one or more unlocked_by violations so that maintainers of the track can validate and remedy the violations.
-> The exercise 'etl' is being unlocked by a non-core exercise. Non-core exercises can only be unlocked by core exercises.
-> The exercise 'isbn-verifier' is being unlocked by a non-core exercise. Non-core exercises can only be unlocked by core exercises.
This exercise uses types and will need to be updated to the new type/struct system in v0.6
The tests for the grain problem do not properly check whether the solution has accounted for the fact that 64th place causes an overflow. The user should use an Int128 or UInt128 type. I adjusted the tests as follows:
...
@testset "On squares" begin
@testset "On square $s" for s = 1:64
@test on_square(s) == Int128(2)^(s-1)
@test total_after(s) == Int128(2)^s - 1
end
end
@testset "Overflow Test" begin
@test total_after(64) > total_after(30)
end
Having said that, I think you should change the tests to not give away the answer. You don't need to check every square. Just the first few, and the last few. The canonical-data.json file does something like this rather than the exhaustive check used here.
I will be working on https://github.com/exercism/problem-specifications/tree/master/exercises/minesweeper as a part of my Google Code-in task.
Currently there is no way for Travis to test an example solution against @test_skip
-tests. This would be very useful to have for exercises with language specific or bonus exercises such as #44.
@kytrinyx Could you install the femtocleaner app for this repo, please? I don't have the permissions to do it.
It's a bot that cleans up Julia code and deals with a lot of upgrades/deprecations between versions. It saves a lot of time when migrating to a newer Julia version.
It is a solution for the nth-prime exercise, although I don't know how to use a testing file. Should I use
Jupiter Notebook? Anyways, there the solution is there
The exercise Gigasecond is really boring as it is right now, all of the submitted solutions look exactly the same.
It could be made more interesting by requiring the user to create a new GigaSecond
type that is compatible to Dates.Second
, Dates.Year
etc.
This post is kept largely language-agnostic so that other tracks can use the exercise if they want. The implementation details for the Julia exercise can be found in a PR once the general exercise idea has been refined.
The exercise idea is based on the article Google Interview Problems: Ratio Finder by Alex Golec (scroll down to "The Question" to find the problem).
General idea: Given a list of conversion rates between different units, find a way to convert between them.
In the post, he uses distances as an example. The solver has to convert 1 hand
to light years
given the following conversion rates:
1 hand = 4 inch
4 inches = 1/3 feet
1/3 feet = 6.3125e-5 american miles
6.3125e-5 american miles = 1.0737e-17 light years
His solution builds a graph from the given conversions and a search algorithm to find the conversion rate. For more details and an example implementation in Python, I suggest reading the post.
In an exercism adaptation of this problem, we could also use different kinds of units, e.g. mass or currency rates (the latter is also mentioned in the article). A few story ideas that immediately came to my mind:
miles
or yards
and need to figure out what they mean.cups
, mugs
or oz
.Distance would have the advantage that there's a handy video guide the readme could link to and that there is a huge amount of obscure and less obscure ways to represent distances.
One important question: Is this exercise about modelling the problem, i.e. recognising to use a graph to represent the conversions, or implementing a solution, i.e. writing the search algorithm and graph?
In the first case, it's probably helpful to mention that the students are encouraged to use relevant libraries to solve this exercise. In the second case, the exercise description should contain more information on how to approach the problem. Of course, forcing a certain way isn't necessary, but it may influence how the description is written.
Tests
There are a number of edge cases to consider when solving the exercise and creating a test suite:
This is meant as a base to start the discussion, so feel free to take apart everything and perhaps we end up with a completely different, but better, exercise idea :)
From the instruction to regenerate exercise READMEs, it seems to me that the following
bin/configlet generate .
should be an idempotent operation. However, this is not the case, and many exercise READMEs will be changed upon running this command on the current state of this repo.
This means that if we are creating a new exercise, we have to always run
bin/configlet generate . --only <stub>
which is ok but defeat the purpose of the simpler version.
Per the discussion in exercism/discussions#128 we
will be installing the probot/stale integration on the Exercism organization on
April 10th, 2017.
By default, probot will comment on issues that are older than 60 days, warning
that they are stale. If there is no movement in 7 days, the bot will close the issue.
By default, anything with the labels security
or pinned
will not be closed by
probot.
If you wish to override these settings, create a .github/stale.yml file as described
in https://github.com/probot/stale#usage, and make sure that it is merged
before April 10th.
If the defaults are fine for this repository, then there is nothing further to do.
You may close this issue.
Currently the custom set exercise is completely broken for Julia v0.6. I will fix it when a v0.6 RC is released in order to avoid duplicate work.
We’ve recently started a project to find the best way to design our tracks, in order to optimize the learning experience of students.
As a first step, we’ll be examining the ways in which languages are unique and the ways in which they are similar. For this, we’d really like to use the knowledge of everyone involved in the Exercism community (students, mentors, maintainers) to answer the following questions:
Could you spare 5 minutes to help us by answering these questions? It would greatly help us improve the experience students have learning Julia :)
Note: this issue is not meant as a discussion, just as a place for people to post their own, personal experiences.
Want to keep your thoughts private but still help? Feel free to email me at [email protected]
Thank you!
Hi all. I am currently in the process of implementing the exercise "reverse-string" but will take a while to do soon. Meanwhile, I would like to open this issue so that whoever is contributing to Julia's exercism track at the moment will know and hopefully not duplicate the work I am doing. Thanks.
Some of the scripts have dependencies. Environment files would make it easier to get everything running
Many people use the Julia REPL or Jupyter notebooks for prototyping or quick development. Typical exercism exercises are well suited for this workflow. Currently this workflow requires some manual work.
I'm thinking it could be useful to have a package that allows one to solve exercises without leaving the REPL, like this:
using Exercism
Exercism.fetch("bob") # load the exercise and display the skeleton & readme
bob(s) = ...
Exercism.test() # run the tests as usual
bob(s) = ... # fix some errors
Exercism.test() # all tests pass
Exercism.submit() # submit solution online
Exercism.fetch() # load next exercise, clear the workspace
A simple prototype could work by just calling the cli commands via run()
. A more advanced version could call the go binary directly so that installation of the cli client isn't required anymore.
Thoughts? Would you use it?
testing the bot
There are many exercises that still need to be added to the Julia track. If you want to work on one, you can leave a comment here to "claim" it or submit an empty WIP Pull Request. More info is also available in the README of this repo. If you have any questions, don't hesitate to ask! :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.