Giter Club home page Giter Club logo

julia's Introduction

Exercism Julia Track

Exercise CI Configlet

Exercism exercises in Julia.

Contributing Guide

Please see the contributing guide.

Please read and adhere to the Code of Conduct.

Code Formatting Guidelines

Your example solutions should adhere to the following guidelines:

  • 4 spaces per indentation level, no tabs
  • use whitespace to make the code more readable
  • no whitespace at the end of a line (trailing whitespace)
  • comments are good, especially when they explain the algorithm
  • use upper camel case convention for type names
  • use lower case for method names, add underscores if necessary

These are based on the General Formatting Guidelines for contributions to the Julia codebase.

julia's People

Contributors

abhishalya avatar alemelis avatar andrej-makarov-skrt avatar angelikatyborska avatar bnandras avatar bovine3dom avatar cmcaine avatar cnot avatar colinleach avatar dependabot[bot] avatar depial avatar ee7 avatar erikschierboom avatar exercism-bot avatar github-actions[bot] avatar glennj avatar golanor avatar ihid avatar kytrinyx avatar logankilpatrick avatar mdvsh avatar miguelraz avatar nywilken avatar saschamann avatar serialhex avatar sj-nosrat avatar teo-shaowei avatar vyu avatar xavdid avatar yctai1994 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

julia's Issues

Add femtocleaner

@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.

sum of squares / square of sums: check type

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?

Exercises that teaches modules

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.

Resistor Color Trio Exercise

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:

  • Each resistor has a resistance value.
  • Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read.
    To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values.
  • Each band acts as a digit of a number. For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15.
    In this exercise, you are going to create a helpful program so that you don't have to remember the values of the bands. The program will take 3 colors as input, and outputs the correct value, in ohms.
    The color bands are encoded as follows:
  • Black: 0
  • Brown: 1
  • Red: 2
  • Orange: 3
  • Yellow: 4
  • Green: 5
  • Blue: 6
  • Violet: 7
  • Grey: 8
  • White: 9

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:

  • orange-orange-black would be 33 and no zeros, which becomes 33 ohms.
  • orange-orange-red would be 33 and 2 zeros, which becomes 3300 ohms.
  • orange-orange-orange would be 33 and 3 zeros, which becomes 33000 ohms.

(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"

Space age

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.

Remove obsolete version tracking assertions in exercises

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.

Generation of exercise READMEs by configlet is not idempotent

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.

grains overflow

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.

Exercism.jl Package to use exercism completely within a Julia REPL/notebook

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?

Implement Continuous Integration

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.

Consider consistency for the exercises

  • Is there a style guide for Julia?
  • Are these styles encouraged or enforced?
  • Are there any conventions that we should adopt on this track for the sake of consistency?
  • Can we enforce these?
  • Is there a linter? Are there many? Should we use one?
  • Is there a common convention for filenames? If not, what should our convention be?

Note that this is about the exercises (the test suites and code examples), not people's solutions.

De-duplicate the exercise UUIDs

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.

Where are the Julia communities and enthusiasts?

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.

  • Is Julia supported by one or more large organizations?
  • Does Julia have an official community manager?
  • Do you know of specific communities (online or offline) that are enthusiastic about Julia? (Chat communities, forums, meetups, student clubs, etc)
  • Are there popular conferences for Julia? (If so, what are some examples?)
  • Are there any organizations who are targeted specifically at getting certain subgroups or demographics interested in Julia? (e.g. kids, teenagers, career changers, people belonging to various groups that are typically underrepresented in tech?)
  • Are there specific groups or programs dedicated to mentoring people in Julia?
  • Are there popular newsletters for Julia?
  • Is Julia taught at programming bootcamps? (If so, what are some examples?)
  • Is Julia taught at universities? (If so, what are some examples?)

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

Ensure Julia track is ready for v2 launch

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.

  • The track has a page on the v2 site: https://v2.exercism.io/tracks/julia
  • The track page has a short description under the name (not starting with TODO)
  • The "About" section is a friendly, colloquial, compelling introduction
  • The "About" section follows the formatting guidelines
  • The code example gives a good taste of the language and fits within the boundaries of the background image
  • There are exercises marked as core
  • Exercises have rough estimates of difficulty
  • Exercises have topics associated with them
  • The first exercise is auto_approve: true

Track landing page

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.

Blurb

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.

About section

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.

Formatting guidelines

In order to work well with the design of the new site, we're restricting the formatting of the ABOUT.md. It can use:

  • Bold
  • Italics
  • Links
  • Bullet lists
  • Number lists

Additionally:

  • Each sentence should be on its own line
  • Paragraphs should be separated by an empty line
  • Explicit <br/> can be used to split a paragraph into lines without spacing between them, however this is discouraged.

Code example

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.

Exercise metadata

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.

Topic and difficulty

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

Auto-approval

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.

Track mentors

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

gigasecond: Making gigasecond more interesting

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.

Verify contents and format of track documentation

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.

Implement missing exercises

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! :)

Fix getting started instructions for julia

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

Nth-prime exercise

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.

Implementing the exercise "reverse-string"

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.

Track configuration contains improperly locked exercises

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:

  • Core exercises can not be unlocked by other exercises.
  • Non-core exercises can only be unlocked by core exercises.

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.

bob: Update to clarify ambiguity regarding shouted questions

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:

  • asking a question
  • shouting
  • remaining silent
  • anything else

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.

What was it like to learn Julia?

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:

  1. How was your experience learning Julia? What was helpful while learning Julia? What did you struggle with? How did you tackle problems?
  2. In what ways did Julia differ from other languages you knew at the time? What was hard to learn? What did you have to unlearn? What syntax did you have to remap? What concepts carried over nicely?

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!

New exercise idea: Unit conversions

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:

  • You're on vacation in a country that uses obscure units such as miles or yards and need to figure out what they mean.
  • You want to translate a cooking recipe and it uses a variety of units for mass/volume, such as 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:

  • Does the solution minimise the amount of conversions needed to reduce rounding errors?
  • The given problem may not have a unique solution.
  • What format are the conversions given in?
  • How to handle rounding errors in the test cases?
  • How are missing conversions handled?

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 :)

Override probot/stale defaults, if necessary

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.

Create stub files for all exercises

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.

  • If this track already provides stub files for all exercises, please close this issue.
  • If this track already has an open issue for creating stubs, then my apologies. Please close one as a duplicate.
  • Otherwise, please respond to this issue with useful details about what needs to be done to complete this task in this track so that people who are not familiar with the track may easily contribute.

nth-prime exercise

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

Still getting `Base.Test` in test code.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.