Code Monkey home page Code Monkey logo

practiceproblems's Introduction

Practice Problems

Automatic Validation of APL Practice Problems

problems.tryapl.org

Problem descriptions for each set are in /_psets/ Test cases for each set are in /testcases/

The left menu is automatically generated using Jekyll/Liquid and JavaScript in /_includes/navbar.html. See CONTRIBUTING.md for details.

Notice something wrong? Report a bug
Have an idea for a feature? Submit a feature request
Have an idea for a new practice problem? Suggest a new Practice Problem

Run locally

  1. Install Ruby
  2. Install Jekyll
  3. Clone or download this repository
  4. Run /serve.bat on Microsoft Windows or /serve.sh on Linux and macOS

practiceproblems's People

Contributors

abrudz avatar bpbecker avatar bubbler-4 avatar dependabot[bot] avatar jasonrivers avatar oliverbazin avatar rikedyp avatar rodrigogiraoserrao avatar xpqz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

practiceproblems's Issues

2015:9 is gives internal error

Describe the bug
2015:9 gives "Internal error – No result was provided when the context expected one "

To Reproduce
Steps to reproduce the behavior:

  1. Go to 2015:9
  2. Enter anything into the input box
  3. Open console and enter debug=true
  4. Submit and see error ¯315 Internal error – No result was provided when the context expected one

[email protected]

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

2016 p2 says argument is numeric vector, not including scalars

Describe the bug

Task states:

Write a function that takes a numeric vector as its right argument and returns the median of the array. 

but the last example is:

your_function 7 
7

Expected behavior

Either change the task description to include ...or numeric scalar, or change the last example so that the right argument is a vector:

    your_function ,7 
    7

The answer checking does not seem to work for most problems

Describe the bug
test button for problem solution is unresponsive, for most problems

Desktop (please complete the following information):

  • OS: Debian 12
  • Browser: Firefox

Otherwise, thanks for the cool website. It is helping me to learn APL

2018 P1 output format under-specified

For P1 from 2018, "Oh Say Can You See", the output is defined as

[...] an integer representing the number of skyscrapers that can be seen.

However, the test cases expect a 1-item vector.
I would like to know if the output should have been specified as a 1-item vector, or if the validator should be lenient (and how lenient) before committing a fix in a PR.

Problem descriptions show badly on mobile

Opening the website on mobile devices we see the problem descriptions get squashed horizontally, making them take too much vertical space.

To Reproduce
Open problems.tryapl.org on a mobile device.

Screenshots
Screenshot_2020-09-15-17-17-43-157_com android chrome

Smartphone

  • Device: MI 8
  • OS: Android 10;
  • Browser Chrome 85.0
    (And also on an iPhone 6, Safari)

2016 p4: example incorrect

Describe the bug

Second example claims that:

'Dyalog' your_function 'APL'   
DAaPlLog

This is incorrect (it can be seen that the result lacks the y in Dyalog). It should be DAyPaLlog

Too much output when using quad ⎕

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://problems.tryapl.org/
  2. Scroll down to sample problem input
  3. Try {⎕←'ok'}¨

We should probably suppress ⎕ and ⍞ output if possible, but it's low priority (anyone who knows what ⎕ and ⍞ do should be able to figure out what's going on)

Ctrl+Enter to validate solution

Describe the solution you'd like
Ctrl+Enter should have the same effect as clicking the run button in a question.

A feature that is common on many runner websites and is purely for convenience.

2017 P7: bad test for 'T'

Describe the bug
One of the tests results in the following:

Result should have been (1) with ('T') as right argument 

which is clearly at odds with the example text for

your_function 'G'
0 0 1 0

To Reproduce
Steps to reproduce the behavior:

Try {+/(,⍵)=⍤1 0⊢'ACGT'}

Expected behavior

The correct result is 0 0 0 1 for a right argument of T.

Desktop (please complete the following information):

  • OS: MacOS 11.6 Big Sur
  • Browser: Firefox
  • Version: 92.0

2020 p10 claims solution is correct even if it fails on the example data

Describe the bug

2020 p10:

{¯11¨}

passes with flying colours, but does not give the expected result for the last example:

      {¯11¨},'A' │
└─┘

Expected behavior

Either the solution is incorrect, or the example text is wrong, or a test case is missing.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Firefox
  • Version: 89.0.2

2014 problem 6: test case broken

Describe the bug

Message:

Result should have been (1 9 2⍴2 1 3 2 4 3 5 4 6 5 7 4 8 3 9 2 10 1) with (2⍴5) as right argument 

is the wrong shape, given instruction returns a 2 column matrix. Shape should be 9 2.

To Reproduce

Steps to reproduce the behavior -- I tried {{⍺,≢⍵}⌸∊⊃∘.+/⍳¨,⍵}

Expected behavior

The dfn {{⍺,≢⍵}⌸∊⊃∘.+/⍳¨,⍵} produces the correct result shape for a right arg of 5 5:

      {{,}.+/¨,} 5 5───┐
 2 1│
│ 3 2│
│ 4 3│
│ 5 4│
│ 6 5│
│ 7 4│
│ 8 3│
│ 9 2│
│10 1│
└~───┘

Suggestion for practice/problems

The main web page has a clickable legend at the top of the page so that APL characters can easily be entered

-but- that legend is too far from the location where the characters are pasted in...

I'd suggest repeating that legend just above the area at the bottom of the page where user's can test their solution.

image

2014 Problem 4: empty cases should return empty char vector, not ⍬

Describe the bug

A vector with only spaces should not return an empty numeric vector, but an empty char vector

To Reproduce
Steps to reproduce the behavior:

E.g. APL Cart's ' '∘(1↓,(/⍨)1(⊢∨⌽)0,≠) results in:

Passed all basic tests – for extra points, consider cases like ('') as right argument which should give (⍬)

Expected behavior

For the empty cases, '' and ' ' , the expected result should be 0⍴'', not 0⍴0.

2018 Problem 3: reference solution fails

Describe the bug

The reference solution to 2018/3 fails with the following error:

Internal error – reference solution caused DOMAIN ERROR with (⍬) as right argument 

(for any input).

The reference solution appears to be:

{{('*')}(,.+)/¨}

which indeed fails for :

      {{('*')}(,.+)/¨} 
DOMAIN ERROR
      {{('*')}(,.+)/¨}

I'd propose an alternative solution:

      {{('*'/)}+/¨,}
0  *

2016 P1 says "rows" where it should be "cols"

Describe the bug

In the examples it is claimed that:

your_function 5 3⍴⍳15     ⍝ and average the rows of a matrix

7 8 9

A 5×3 matrix has 5 rows. The comment should say

⍝ and averages the cols of a matrix

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.