exercism / lua Goto Github PK
View Code? Open in Web Editor NEWExercism exercises in Lua.
Home Page: https://exercism.org/tracks/lua
License: MIT License
Exercism exercises in Lua.
Home Page: https://exercism.org/tracks/lua
License: MIT License
This appears to be due to a point update (5.3.3 => 5.3.4) changing a check around __tostring
.
function createStar()
local starL = buildOutline..
local starImg = getStarImage...
return starImg, starL
end
From issue exercism/exercism#1867
Wikipedia says the Hamming distance is not defined for strings of different length.
I am not saying the problems cannot be different, but for such a well-defined concept it would make sense to stick to one definition, especially when the READMEs provide so little information about what is expected from the implementation.
Let's clean this up so that we're using the official definition.
We recently rewrote the test suite for Bowling. Since this track implements Bowling, please take a look at the new canonical_data.json file and see if your track should update its implementation or tests.
The new test suite reorders tests so that students can get to green quickly. It also reduces the number of tests so that students can focus on solving the interesting edge cases.
More details on this change are available in this issue
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/lua/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/lua/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/lua/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
Right now all of the icons used for the language tracks (which can be seen at http://exercism.io/languages) are stored in the exercism/exercism.io repository in public/img/tracks/
. It would make a lot more sense to keep these images along with all of the other language-specific stuff in each individual language track repository.
There's a pull request that is adding support for serving up the track icon from the x-api, which deals with language-specific stuff.
In order to support this change, each track will need to
img/
at the root of this repository if it doesn't already exist, thenimg/
directory, and importantlyicon.png
In other words, at the end of it you should have the following file:
./img/icon.png
See exercism/exercism#2925 for more details.
We recently rewrote the test suite for Custom Set. Since this track implements Custom Set, please take a look at the new custom_set.json file and see if your track should update its implementation or tests.
The new test suite reorders tests so that students can get to green quickly. It also reduces the number of tests so that students can focus on solving the interesting edge cases.
More details on this change are available in the pull request
The README for Pythagorean Triplets describes, like the Project Euler challenge, a task whereby submitters should find all pythagorean triplets who's components sum to 100.
The specs themselves challenge submitters to implement is_triplet
and triplets_with
. Furthermore, while it's fairly clear what the sum
component is in triplets_with
, it is not clear what max_factor
is.
I believe we should change either the README or the specs so that they describe the same problem. I would suggest, since this is an "easy" challenge that the README's challenge be the truth, since in my opinion the specs border on being a "medium" challenge.
I'm happy to make this change myself via a PR if you agree that the challenge is inconsistent and we have agreed upon the README or specs being correct.
I've used Sarah Sharp's FOSS Heartbeat project to generate stats for each of the language track repositories, as well as the x-common repository.
The Exercism heartbeat data is published here: https://exercism.github.io/heartbeat/
When looking at the data, please disregard any activity from me (kytrinyx
), as I would like to get the language tracks to a point where they are entirely maintained by the community.
Please take a look at the heartbeat data for this track, and answer the following questions:
I've made up the following scale:
It would also be useful to know if there a lot of activity on the track, or just the occasional issue or comment.
Please report the current status of the track, including your best guess on the above scale, back to the top-level issue in the discussions repository: exercism/discussions#97
See issue exercism/exercism#2092 for an overview of operation welcome contributors.
Provide instructions on how to contribute patches to the exercism test suites
and examples: dependencies, running the tests, what gets tested on Travis-CI,
etc.
The contributing document
in the x-api repository describes how all the language tracks are put
together, as well as details about the common metadata, and high-level
information about contributing to existing problems, or adding new problems.
The README here should be language-specific, and can point to the contributing
guide for more context.
From the OpenHatch guide:
Here are common elements of setting up a development environment you’ll want your guide to address:
Preparing their computer
Make sure they’re familiar with their operating system’s tools, such as the terminal/command prompt. You can do this by linking to a tutorial and asking contributors to make sure they understand it. There are usually great tutorials already out there - OpenHatch’s command line tutorial can be found here.
If contributors need to set up a virtual environment, access a virtual machine, or download a specific development kit, give them instructions on how to do so.
List any dependencies needed to run your project, and how to install them. If there are good installation guides for those dependencies, link to them.Downloading the source
Give detailed instructions on how to download the source of the project, including common missteps or obstacles.How to view/test changes
Give instructions on how to view and test the changes they’ve made. This may vary depending on what they’ve changed, but do your best to cover common changes. This can be as simple as viewing an html document in a browser, but may be more complicated.Installation will often differ depending on the operating system of the contributor. You will probably need to create separate instructions in various parts of your guide for Windows, Mac and Linux users. If you only want to support development on a single operating system, make sure that is clear to users, ideally in the top-level documentation.
Failure → ./grains_spec.lua @ 28
grains square 64
./grains_spec.lua:29: Expected objects to be equal.
Passed in:
(number) -9223372036854775808
Expected:
(number) 9223372036854775808.0
stack traceback:
./grains_spec.lua:29: in function <./grains_spec.lua:28>
Failure → ./grains_spec.lua @ 32
grains total
./grains_spec.lua:33: Expected objects to be equal.
Passed in:
(number) -1
Expected:
(number) 18446744073709551616.0
stack traceback:
./grains_spec.lua:33: in function <./grains_spec.lua:32>
This may be related to the recently-released Lua 5.3.3. Since Travis only specifies 5.3, the particular point release that we get is probably based upon the latest that hererocks
supports.
A duration of a gigasecond should be measured in seconds, not
days.
The gigasecond
problem has been implemented in a number of languages,
and this issue has been generated for each of these language tracks.
This may already be fixed in this track, if so, please make a note of it
and close the issue.
There has been some discussion about whether or not gigaseconds should
take daylight savings time into account, and the conclusion was "no", since
not all locations observe daylight savings time.
This may or may not be appropriate in this language. See exercism/docs#54 for details.
Right now all tests are named *_test.lua
which requires users to invoke busted *_test.lua
. If we changed all of the test files to *_spec.lua
, then we'd only need to instruct users to invoke busted .
.
I think we should rename the test files. I'm happy to change all of these if everyone's in agreement.
Note that this would make resolving #19 trivial.
Could word-count just expect counts as numbers? I don't see the point of converting them to strings.
I was going to update the README to cover setting up a dev environment for Linux & Windows, but then realised that that would mean the installation instructions would be repeated in 3 separate places; in SETUP.md, INSTALLATION.md and then in the README, meaning that if there were ever any changes then they would need to be updated in all of these places.
Would it be better to only have the installation instructions in INSTALLATION.md and then reference them (at http://exercism.io/languages/lua/installing) from the README and SETUP files? This would also remove the repetition of having extensive installation instructions in the README of each exercise, which shouldn't really be necessary past the first exercise.
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 Lua?
This is part of the project being tracked in exercism/meta#103
Please check if there's a test that states that a triangle with sides 2, 4, 2 is invalid. The triangle inequality states that for any triangle, the sum of the lengths of any two sides must be greater than or equal to the length of the remaining side. If this doesn't affect this track, go ahead and just close the issue.
We should have separate tests for:
If the test suite for binary has test cases that cover these edge cases, this issue can safely be closed.
The word multibillionaire is too long for the scrabble board. Oxyphenbutazone, on the other hand, is legal.
Please verify that there is no test for multibillionaire in the scrabble-score in this track. If the word is included in the test data, then it should be replaced with oxyphenbutazone. Remember to check the case (if the original is uppercase, then the replacement also should be).
If multibillionaire isn't used, then this issue can safely be closed.
Busted expects a file structure like:
├── raindrops
│ ├── raindrops.lua
│ ├── README.md
│ └── spec
│ └── raindrops_spec.lua
Where the specs are is a spec
folder. So when you run busted
it will find the specs, else you will have to run busted .
Can the files come packaged like this?
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.
In exercism/problem-specifications#1501, bracket-push was renamed to matching-brackets in problem-specifications, therefore it is recommended that this track (which has the bracket-push exercise) also renames it.
The reasons for this recommendation:
If this track decides to follow this recommendation, here are some things that may need a change:
If you're not sure what needs to change, feel free to examine PRs to other tracks by looking at any PRs linked to exercism/problem-specifications#1501.
If this track instead decides that accepting this recommendation is a bad idea for the track, then this issue should be closed upon making that decision, and none of the above steps should be taken.
./docs/INSTALLATION.md
has instructions for Mac OS X only.
Many exercism users are on Windows. One took the time to send an email requesting these install instructions. (see exercism/exercism#1878).
Please add instructions for installing lua tooling via Chocolatey.
The JSON file containing canonical inputs/outputs for the Clock exercise has gotten new data.
There are two situations that the original data didn't account for:
If this track has a generator for the Clock exercise, go ahead and regenerate it now. If it doesn't, then please verify the implementation of the test suite against the new data. If any cases are missing, they should be added.
I made a really stupid choice a while back to commit the cross-compiled
binaries for configlet (the tool that sanity-checks the config.json
against the implemented problems) into the repository itself.
Those binaries are HUGE, and every time they change the entire 4 or 5 megs get
recommitted. This means that cloning the repository takes a ridiculously long
time.
I've added a script that can be run on travis to grab the latest release from
the configlet repository (bin/fetch-configlet), and travis is set up to run
this now instead of using the committed binary.
I would really like to thoroughly delete the binaries from the entire git
history, but this will break all the existing clones and forks.
The commands I would run are:
# ensure this happens on an up-to-date master
git checkout master && git fetch origin && git reset --hard origin/master
# delete from history
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch bin/configlet-*' --prune-empty
# clean up
rm -rf .git/refs/original/
git reflog expire --all
git gc --aggressive --prune
# push up the new master, force override existing master branch
git push -fu origin master
If we do this everyone who has a fork will need to make sure that their master
is reset to the new upstream master:
git checkout master
git fetch upstream master
git reset --hard upstream/master
git push -fu origin master
We can at-mention (@) all the contributors and everyone who has a fork here in this
issue if we decide to do it.
The important question though, is: Is it worth doing?
Do you have any other suggestions of how to make sure this doesn't confuse people and break their
repository if we do proceed with this change?
Hello, as part of exercism/problem-specifications#198 we'd like to make the sum of multiples exercise less confusing. Currently, the README specifies that if no multiples are given it should default to 3 and 5.
We'd like to remove this default, so that a list of multiples will always be specified by the caller. This makes the behavior explicit, avoiding surprising behavior and simplifying the problem.
Please make sure this track's tests for the sum-of-multiples problem do not expect such a default. Any tests that want to test behavior for multiples of [3, 5] should explicitly pass [3, 5] as the list of multiples.
After all tracks have completed this change, then exercism/problem-specifications#209 can be merged to remove the defaults from the README.
The reason we'd like this change to happen before changing the README is that it was very confusing for students to figure out the default behavior. It wasn't clear from simply looking at the tests that the default should be 3 and 5, as seen in exercism/exercism#2654, so some had to resort to looking at the example solutions (which aren't served by exercism fetch
, so they have to find it on GitHub). It was added to the README to fix this confusion, but now we'd like to be explicit so we can remove the default line from the README.
You can find the common test data at https://github.com/exercism/x-common/blob/master/sum-of-multiples.json, in case that is helpful.
The problems api (x-api) now supports having exercises collected in a subdirectory
named exercises
.
That is to say that instead of having a mix of bin
, docs
, and individual exercises,
we can have bin
, docs
, and exercises
in the root of the repository, and all
the exercises collected in a subdirectory.
In other words, instead of this:
x{TRACK_ID}/
├── LICENSE
├── README.md
├── bin
│ └── fetch-configlet
├── bowling
│ ├── bowling_test.ext
│ └── example.ext
├── clock
│ ├── clock_test.ext
│ └── example.ext
├── config.json
└── docs
│ ├── ABOUT.md
│ └── img
... etc
we can have something like this:
x{TRACK_ID}/
├── LICENSE
├── README.md
├── bin
│ └── fetch-configlet
├── config.json
├── docs
│ ├── ABOUT.md
│ └── img
├── exercises
│ ├── bowling
│ │ ├── bowling_test.ext
│ │ └── example.ext
│ └── clock
│ ├── clock_test.ext
│ └── example.ext
... etc
This has already been deployed to production, so it's safe to make this change whenever you have time.
The primary nucleobases are cytosine (DNA and RNA), guanine (DNA and RNA), adenine (DNA and RNA), thymine (DNA) and uracil (RNA), abbreviated as C, G, A, T, and U, respectively. Because A, G, C, and T appear in the DNA, these molecules are called DNA-bases; A, G, C, and U are called RNA-bases. - Wikipedia
In other words, we should rename the values in the RNA transcription problem to reflect the following:
cytidine
-> cytosine
guanosine
-> guanine
adenosine
-> adenine
thymidine
-> thymine
uridine
-> uracil
We have found that the Pangram tests miss edge cases allowing students to pass all of the current tests with an incorrect implementation.
To cover these cases we have added new tests to the Pangram test set. Those new tests were added in this commit
Since this track implements Pangram, please take a look at the new pangram.json file and see if your track should update its tests.
If you do need to update your tests, please refer to this issue in your PR. That helps us see which tracks still need to update their tests.
If your track is already up to date, go ahead and close this issue.
More details on this change are available in x-common issue 222.
Thank you for your help!
Right now the TracedArray
in the binary search exercise checks how many times the array is accessed, not how many unique elements are accessed. This causes the solution to store a local just to make the tests happy. If the TracedArray
implementation is changed to track unique accesses then there will be more flexibility in the solution without allowing incorrect solutions.
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.
Has there been any previous discussion about test versioning and/or stub files for xlua?
Is there a stance either way for either of these?
See Pull Request
In the README for the Lua hamming exercise, the user is told to run tests with this command: busted bob_test.lua
. That is probably a copy/paste error from the Bob exercise. It's not a huge deal and most people no doubt figure it out quickly, but I think it's still worth correcting. I would submit a patch, but the README itself doesn't seem to be stored here with the exercise. Where are they stored?
It's surprising to me that count('U') should return 0 rather than throw an error. The README doesn't mention U specifically and doesn't suggest this special case to me.
I'm getting the following error:
757: unexpected token at 'Puma caught this error: target of
repeat operator is not specified: /*spec[.]lua$/ (RegexpError)
The regexp should probably be ".*spec[.]lua$"
(starting with a "."
).
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.
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
@kytrinyx we're still having issues getting the test suite for Lua exercises. How can I help to debug this?
For example:
http://exercism.io/exercises/lua/allergies
We recently rewrote the test suite for the Luhn exercise. Since this track implements Luhn, please take a look at the new canonical_data.json file and see if your track should update its implementation or tests.
Details on the test changes and the motivation can be found in the PR.
Tracking of these changes is being done at the tracking issue.
I can't remember the history of this, but we ended up with a weird non-biological thing in the RNA transcription exercise, where some test suites also have tests for transcribing from RNA back to DNA. This makes no sense.
If this track does have tests for the reverse transcription, we should remove them, and also simplify the reference solution to match.
If this track doesn't have any tests for RNA->DNA transcription, then this issue can be closed.
There was some confusion in this exercise due to the ambiguous use of the term consecutive in the README. This could be taken to mean contiguous, as in consecutive by position, or as in consecutive numerically. The the README has been fixed (exercism/problem-specifications#200).
Please verify that the exercise is implemented in this track correctly (that it finds series of contiguous numbers, not series of numbers that follow each other consecutively).
If it helps, the canonical inputs/outputs for the exercise can be found here:
https://github.com/exercism/x-common/blob/master/largest-series-product.json
If everything is fine, go ahead and just close this issue. If there's something to be done, then please describe the steps needed in order to close the issue.
In order to reduce the amount of code required to pass incremental tests (assuming that users pass tests starting from the top), the order of the tests was modified slightly.
Since this track implements Custom Set, please take a look at the new custom-set.json file and see if your track should update its tests.
If you do need to update your tests, please refer to this issue in your PR. That helps us see which tracks still need to update their tests.
If your track is already up to date, go ahead and close this issue.
More details on this change are available in exercism/problem-specifications#257.
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.
The old help site was deprecated in December 2015. We now have content that is displayed on the main exercism.io website, under each individual language on http://exercism.io/languages.
The content itself is maintained along with the language track itself, under the docs/
directory.
We decided on this approach since the maintainers of each individual language track are in the best position to review documentation about the language itself or the language track on Exercism.
Please verify that nothing in docs/
refers to the help.exercism.io site. It should instead point to http://exercism.io/languages/:track_id (at the moment the various tabs are not linkable, unfortunately, we may need to reorganize the pages in order to fix that).
Also, some language tracks reference help.exercism.io
in the SETUP.md file, which gets included into the README of every single exercise in the track.
We may also have referenced non-track-specific content that lived on help.exercism.io. This content has probably been migrated to the Contributing Guide of the x-common repository. If it has not been migrated, it would be a great help if you opened an issue in x-common so that we can remedy the situation. If possible, please link to the old article in the deprecated help repository.
If nothing in this repository references help.exercism.io, then this can safely be closed.
For the past three years, the ordering of exercises has been done based on gut feelings and wild guesses. As a result, the progression of the exercises has been somewhat haphazard.
In the past few months maintainers of several tracks have invested a great deal of time in analyzing what concepts various exercises require, and then reordering the tracks as a result of that analysis.
It would be useful to bake this data into the track configuration so that we can adjust it over time as we learn more about each exercise.
To this end, we've decided to add a new key exercises in the config.json file, and deprecate the problems
key.
See exercism/discussions#60 for details about this decision.
Note that we will not be removing the problems
key at this time, as this would break the website and a number of tools.
The process for deprecating the old problems
array will be:
In the new format, each exercise is a JSON object with three properties:
The difficulty rating can be a very rough estimate.
The topics array can be empty if this analysis has not yet been done.
Example:
"exercises": [
{
"slug": "hello-world" ,
"difficulty": 1,
"topics": [
"control-flow (if-statements)",
"optional values",
"text formatting"
]
},
{
"difficulty": 3,
"slug": "anagram",
"topics": [
"strings",
"filtering"
]
},
{
"difficulty": 10,
"slug": "forth",
"topics": [
"parsing",
"transforming",
"stacks"
]
}
]
It may be worth making the change in several passes:
If you're curious, you can look at it at github.com/exercism/blazon -- it's for when we add new shared json data
for an exercise, or when we want to submit an issue to all of the active tracks.
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.