Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing the road to v3 of Exercism for the elm track #280

Closed
mpizenberg opened this issue Nov 2, 2019 · 5 comments
Closed

Preparing the road to v3 of Exercism for the elm track #280

mpizenberg opened this issue Nov 2, 2019 · 5 comments

Comments

@mpizenberg
Copy link
Member

Hi there, Exercism is currently trying to redesign tracks in order to improve both students and mentors experience. More info on v3 is also available in this Github issue: exercism/exercism#5088

Part of the update consists in building concept exercises. We will get more info about that from the Exercism team later.

And part of the update consists in automating feedback to students for solutions that are similar to ones that already got approved feedback. This will be done with "representers": exercism/exercism#5079.

Concretely, that means that we should try to generate some kind of normalized representation of the submitted code. In practice, according to tests in the ruby track, using the code AST with names somewhat normalized seems to help already quite a lot. It feels like a fun project if you like program analysis but is a bit outside of my programming skills.

So I'm making a meta issue to basically try to gather ideas and energy of people that might enjoy working on this!

@mpizenberg
Copy link
Member Author

ping @leojpod

@kephas
Copy link

kephas commented May 31, 2020

Could we maybe brainstorm among maintainers/mentors for FP languages and possibly also separately for languages with partial application?

Obviously the Elm and Haskell tracks would have lots of concepts in common. F# and OCaml share a lot of features with them too.

As for FP in general, Clojure and Elixir would fit too, at least.

@mpizenberg
Copy link
Member Author

mpizenberg commented May 31, 2020

I haven't been following much for the past two months but last time I discussed with @ceddlyburge , we had gathered the concepts at the end of this message. I don't know how much of this could be done in common with Haskell and others but minimizing work would be great!

Personally, I've been spending time on improving the tests situation for Elm, to improve the online editor and I don't think that can be of use for the other languages.

Regarding work on normalized representation, I haven't thought about it much so I've no idea of what could be shared there.

Concepts

Basics

  • imports: being able to import other modules such as Dict or Set
  • Exposing: to expose the functions to test
  • Functions: define functions, define anonymous / inline functions, _, recursion

Computation

  • mathematical operators (+, -, ^, // etc)
  • mathematical functions (modBy, remainderBy, round, logBase etc)
  • let expressions: define local variables and functions
  • Conditions (if expressions)
  • Pattern matching (case expression, _)
  • Comparisons (==, /=, > etc)
  • Boolean operators (&&, ||, `not)
  • Function composition with << and >>
  • Chaining computation: using piping (|>, |<)
  • Partial application: combined with chaining of computation
  • Point free style
  • Using brackets to turn operators in to functions, such as (==)
  • compare (LT, GT, EQ)

Types

  • Type annotations: define the types of functions, pass functions as parameters
  • type alias: to define the Grade, Student and School types
  • Union / sum / custom types (to define RemarkCategory)

Data structures

  • List (literals [], filter, map, filterMap, foldl, foldr, ::,reverse, indexedMap, range, sort, product, singleton, sum, length, take, drop, dropWhile, concatMap, maximum)
  • List.Extra (maximumWith, groupsOfWithStep)
  • Tuple (literals, type definition, first, second, pair)
  • Set (fromList, size)
  • Dict (update, empty, fromList, get)

Dealing with uncertainty and errors

  • Maybe (Just, Nothing, withDefault, map, andThen)
  • Result (Ok, Err, andThen, map, withDefault)

Text manipulation

  • String (literals "str", concatenation with operator (++), trim, trimRight, endsWith, toUpper, toLower, any, all, left, concat, toList, fromList, fromChar, fromInt, right, split, ++, join, indexes, filter, isEmpty, dropLeft, dropRight, map, padRight, replace, reverse, toInt, cons, uncons)
  • Char (literals 'a', isAlpha, isDigit, toCode, fromCode, isAlphaNum)
  • Parser (Step, Loop, Done, |=, |., run, oneOf, succeed, int, getChompedString, chompIf, keyword, loop, map, spaces, symbol, token)
  • Regex (fromString, split, never)

Numbers

  • Float
  • Int
  • Conversions (toFloat, round)

Time

  • Posix time

Binary manipulation

  • Bitwise (and)

@ceddlyburge
Copy link
Contributor

Hi, most of my open source time is on the train to work, which obviously isn't happening at the moment, so I am not doing much. I think I agreed with @mpizenberg that I would create a dependency graph of the concepts, probably as a mermaid / markdown diagram. I think we should then implement the simplest one and then use this as the initial use case for the representer. Presumably the elm compiler (written in Haskell) already creates an AST from the code which will hopefully do most of the work. I don't currently know Haskell though. There is also the elm-in-elm compiler which is written in Elm and so might make things easier, but is not as mature. Another option is to use elm-format I think, and then analyse the string, although this would only be practical for very simple things.

@mpizenberg
Copy link
Member Author

This issue is getting outdated so I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants