Last active
February 7, 2017 00:23
-
-
Save adamdicarlo/d9608355dbe0092a8c506baeee79e07b to your computer and use it in GitHub Desktop.
Example of JavaScript generated from a bit of Elm code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _adamdicarlo$elm_wordy$Wordy$eligibleWord = F2( | |
function (word, foundWords) { | |
return !A2(_elm_lang$core$List$member, word, foundWords); | |
}); | |
var _adamdicarlo$elm_wordy$Wordy$findUnselectedLetter = F2( | |
function (letters, sought) { | |
var predicate = function (_p0) { | |
var _p1 = _p0; | |
return _elm_lang$core$Native_Utils.eq(_p1._0, sought) && (!_p1._1); | |
}; | |
return A2(_elm_community$list_extra$List_Extra$findIndex, predicate, letters); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Wordy exposing (main) | |
import List.Extra exposing (findIndex) | |
type Letter | |
= Letter Char Bool | |
eligibleWord : String -> List String -> Bool | |
eligibleWord word foundWords = | |
not (List.member word foundWords) | |
findUnselectedLetter : List Letter -> Char -> Maybe Int | |
findUnselectedLetter letters sought = | |
let | |
predicate (Letter ch selected) = | |
ch == sought && not selected | |
in | |
findIndex predicate letters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment