Skip to content

Instantly share code, notes, and snippets.

@manuscrypt
Last active July 25, 2016 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuscrypt/a3a97d55f682b32bf6ceb6cda3317208 to your computer and use it in GitHub Desktop.
Save manuscrypt/a3a97d55f682b32bf6ceb6cda3317208 to your computer and use it in GitHub Desktop.
cleanInput : List TileDef -> String -> String
cleanInput defs str =
let
validLetters =
List.map .letter defs
in
String.toUpper str
|> String.toList
|> List.filter (containsChar validLetters)
|> String.fromList
compiles to
var _user$project$Model$cleanInput = F2(
function (defs, str) {
var validLetters = A2(
_elm_lang$core$List$map,
function (_) {
return _.letter;
},
defs);
return A2(
_user$project$Model$replaceBlanks,
'?',
_elm_lang$core$String$fromList(
A2(
_elm_lang$core$List$filter,
_user$project$Model$containsChar(validLetters),
_elm_lang$core$String$toList(
_elm_lang$core$String$toUpper(
A2(_user$project$Model$replaceBlanks, ' ', str))))));
});
cleanInput2 : List TileDef -> String -> String
cleanInput2 defs str =
let
isValid =
containsChar <|
List.map .letter defs
in
String.toUpper str
|> String.toList
|> List.filter isValid
|> String.fromList
compiles to
var _user$project$Model$cleanInput2 = F2(
function (defs, str) {
var isValid = _user$project$Model$containsChar(
A2(
_elm_lang$core$List$map,
function (_) {
return _.letter;
},
defs));
return _elm_lang$core$String$fromList(
A2(
_elm_lang$core$List$filter,
isValid,
_elm_lang$core$String$toList(
_elm_lang$core$String$toUpper(str))));
});
------------------------------------------------
cleanInput : List TileDef -> String -> String
cleanInput defs =
let
validLetters =
List.map .letter defs
in
String.toUpper
>> String.toList
>> List.filter (containsChar validLetters)
>> String.fromList
compiles to
var _user$project$Main$cleanInput = function (defs) {
var validLetters = A2(
_elm_lang$core$List$map,
function (_) {
return _.letter;
},
defs);
return function (_p0) {
return _elm_lang$core$String$fromList(
A2(
_elm_lang$core$List$filter,
_user$project$Main$containsChar(validLetters),
_elm_lang$core$String$toList(
_elm_lang$core$String$toUpper(_p0))));
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment