mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-09-11 07:15:45 +03:00
Allow for to be on the left side of a list comprehension
This commit is contained in:
parent
417a3f6f0d
commit
51d47a726f
@ -1,10 +1,8 @@
|
||||
## Kind 1.0.107
|
||||
## Kind 1.0.108
|
||||
|
||||
- Mapped list comprehension syntax
|
||||
- Allow "for" to be on the left side of a list comprehension
|
||||
|
||||
[map x when Nat.is_even(x) in [0 to 10]: x * 2]
|
||||
|
||||
as an alternative to the "for" list comprehension
|
||||
[for x in [0 to 10] where Nat.is_even(x): x * 2]
|
||||
|
||||
## Kind 1.0.104
|
||||
|
||||
|
@ -36,15 +36,15 @@ Kind.Parser.comprehension: Parser<Kind.Term>
|
||||
Kind.Parser.comprehension.mapped: Parser<Kind.Term>
|
||||
Parser {
|
||||
Kind.Parser.text("[")
|
||||
Kind.Parser.text("map")
|
||||
Kind.Parser.text("for")
|
||||
get elem = Kind.Parser.name1
|
||||
Kind.Parser.text("in")
|
||||
get list = Kind.Parser.term
|
||||
get cond = Parser.maybe!(Parser {
|
||||
Kind.Parser.text("when")
|
||||
Kind.Parser.text("where")
|
||||
get cond = Kind.Parser.term
|
||||
return cond
|
||||
})
|
||||
Kind.Parser.text("in")
|
||||
get list = Kind.Parser.term
|
||||
Kind.Parser.text(":")
|
||||
get loop = Kind.Parser.term
|
||||
Kind.Parser.text("]")
|
||||
|
@ -1,4 +1,3 @@
|
||||
Test: _
|
||||
List.show!(Nat.show,
|
||||
[map x when Nat.is_even(x) in [0 to 10]: x * 2]
|
||||
)
|
||||
let list = [for x in [0 to 10] where Nat.is_even(x): x * 2]
|
||||
List.show!(Nat.show, list)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kind-lang",
|
||||
"version": "1.0.107",
|
||||
"version": "1.0.108",
|
||||
"description": "Kind-Lang in JavaScript",
|
||||
"main": "src/kind.js",
|
||||
"scripts": {
|
||||
|
@ -23388,7 +23388,7 @@ module.exports = (function() {
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7368 = self.err;
|
||||
var _reply$21 = Kind$Parser$text$("map", _reply$pst$15);
|
||||
var _reply$21 = Kind$Parser$text$("for", _reply$pst$15);
|
||||
var self = _reply$21;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
@ -23457,171 +23457,171 @@ module.exports = (function() {
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7399 = self.err;
|
||||
var _reply$49 = Parser$maybe$((_pst$49 => {
|
||||
var self = _pst$49;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7402 = self.err;
|
||||
var _reply$55 = Kind$Parser$text$("when", _pst$49);
|
||||
var self = _reply$55;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7404 = self.err;
|
||||
var self = $7402;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7406 = self.value;
|
||||
var $7407 = Parser$Reply$error$(Parser$Error$combine$($7406, $7404));
|
||||
var $7405 = $7407;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7408 = Parser$Reply$error$($7404);
|
||||
var $7405 = $7408;
|
||||
break;
|
||||
};
|
||||
var $7403 = $7405;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7409 = self.pst;
|
||||
var self = $7409;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7411 = self.err;
|
||||
var $7412 = self.nam;
|
||||
var $7413 = self.ini;
|
||||
var $7414 = self.idx;
|
||||
var $7415 = self.str;
|
||||
var _reply$pst$63 = Parser$State$new$(Parser$Error$maybe_combine$($7402, $7411), $7412, $7413, $7414, $7415);
|
||||
var self = _reply$pst$63;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7417 = self.err;
|
||||
var _reply$69 = Kind$Parser$term(_reply$pst$63);
|
||||
var self = _reply$69;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7419 = self.err;
|
||||
var self = $7417;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7421 = self.value;
|
||||
var $7422 = Parser$Reply$error$(Parser$Error$combine$($7421, $7419));
|
||||
var $7420 = $7422;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7423 = Parser$Reply$error$($7419);
|
||||
var $7420 = $7423;
|
||||
break;
|
||||
};
|
||||
var $7418 = $7420;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7424 = self.pst;
|
||||
var $7425 = self.val;
|
||||
var self = $7424;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7427 = self.err;
|
||||
var $7428 = self.nam;
|
||||
var $7429 = self.ini;
|
||||
var $7430 = self.idx;
|
||||
var $7431 = self.str;
|
||||
var _reply$pst$77 = Parser$State$new$(Parser$Error$maybe_combine$($7417, $7427), $7428, $7429, $7430, $7431);
|
||||
var $7432 = Parser$Reply$value$(_reply$pst$77, $7425);
|
||||
var $7426 = $7432;
|
||||
break;
|
||||
};
|
||||
var $7418 = $7426;
|
||||
break;
|
||||
};
|
||||
var $7416 = $7418;
|
||||
break;
|
||||
};
|
||||
var $7410 = $7416;
|
||||
break;
|
||||
};
|
||||
var $7403 = $7410;
|
||||
break;
|
||||
};
|
||||
var $7401 = $7403;
|
||||
break;
|
||||
};
|
||||
return $7401;
|
||||
}), _reply$pst$43);
|
||||
var _reply$49 = Kind$Parser$text$("in", _reply$pst$43);
|
||||
var self = _reply$49;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7433 = self.err;
|
||||
var $7401 = self.err;
|
||||
var self = $7399;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7435 = self.value;
|
||||
var $7436 = Parser$Reply$error$(Parser$Error$combine$($7435, $7433));
|
||||
var $7434 = $7436;
|
||||
var $7403 = self.value;
|
||||
var $7404 = Parser$Reply$error$(Parser$Error$combine$($7403, $7401));
|
||||
var $7402 = $7404;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7437 = Parser$Reply$error$($7433);
|
||||
var $7434 = $7437;
|
||||
var $7405 = Parser$Reply$error$($7401);
|
||||
var $7402 = $7405;
|
||||
break;
|
||||
};
|
||||
var $7400 = $7434;
|
||||
var $7400 = $7402;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7438 = self.pst;
|
||||
var $7439 = self.val;
|
||||
var self = $7438;
|
||||
var $7406 = self.pst;
|
||||
var self = $7406;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7441 = self.err;
|
||||
var $7442 = self.nam;
|
||||
var $7443 = self.ini;
|
||||
var $7444 = self.idx;
|
||||
var $7445 = self.str;
|
||||
var _reply$pst$57 = Parser$State$new$(Parser$Error$maybe_combine$($7399, $7441), $7442, $7443, $7444, $7445);
|
||||
var $7408 = self.err;
|
||||
var $7409 = self.nam;
|
||||
var $7410 = self.ini;
|
||||
var $7411 = self.idx;
|
||||
var $7412 = self.str;
|
||||
var _reply$pst$57 = Parser$State$new$(Parser$Error$maybe_combine$($7399, $7408), $7409, $7410, $7411, $7412);
|
||||
var self = _reply$pst$57;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7447 = self.err;
|
||||
var _reply$63 = Kind$Parser$text$("in", _reply$pst$57);
|
||||
var $7414 = self.err;
|
||||
var _reply$63 = Kind$Parser$term(_reply$pst$57);
|
||||
var self = _reply$63;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7449 = self.err;
|
||||
var self = $7447;
|
||||
var $7416 = self.err;
|
||||
var self = $7414;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7451 = self.value;
|
||||
var $7452 = Parser$Reply$error$(Parser$Error$combine$($7451, $7449));
|
||||
var $7450 = $7452;
|
||||
var $7418 = self.value;
|
||||
var $7419 = Parser$Reply$error$(Parser$Error$combine$($7418, $7416));
|
||||
var $7417 = $7419;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7453 = Parser$Reply$error$($7449);
|
||||
var $7450 = $7453;
|
||||
var $7420 = Parser$Reply$error$($7416);
|
||||
var $7417 = $7420;
|
||||
break;
|
||||
};
|
||||
var $7448 = $7450;
|
||||
var $7415 = $7417;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7454 = self.pst;
|
||||
var self = $7454;
|
||||
var $7421 = self.pst;
|
||||
var $7422 = self.val;
|
||||
var self = $7421;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7456 = self.err;
|
||||
var $7457 = self.nam;
|
||||
var $7458 = self.ini;
|
||||
var $7459 = self.idx;
|
||||
var $7460 = self.str;
|
||||
var _reply$pst$71 = Parser$State$new$(Parser$Error$maybe_combine$($7447, $7456), $7457, $7458, $7459, $7460);
|
||||
var $7424 = self.err;
|
||||
var $7425 = self.nam;
|
||||
var $7426 = self.ini;
|
||||
var $7427 = self.idx;
|
||||
var $7428 = self.str;
|
||||
var _reply$pst$71 = Parser$State$new$(Parser$Error$maybe_combine$($7414, $7424), $7425, $7426, $7427, $7428);
|
||||
var self = _reply$pst$71;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7462 = self.err;
|
||||
var _reply$77 = Kind$Parser$term(_reply$pst$71);
|
||||
var $7430 = self.err;
|
||||
var _reply$77 = Parser$maybe$((_pst$77 => {
|
||||
var self = _pst$77;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7433 = self.err;
|
||||
var _reply$83 = Kind$Parser$text$("where", _pst$77);
|
||||
var self = _reply$83;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7435 = self.err;
|
||||
var self = $7433;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7437 = self.value;
|
||||
var $7438 = Parser$Reply$error$(Parser$Error$combine$($7437, $7435));
|
||||
var $7436 = $7438;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7439 = Parser$Reply$error$($7435);
|
||||
var $7436 = $7439;
|
||||
break;
|
||||
};
|
||||
var $7434 = $7436;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7440 = self.pst;
|
||||
var self = $7440;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7442 = self.err;
|
||||
var $7443 = self.nam;
|
||||
var $7444 = self.ini;
|
||||
var $7445 = self.idx;
|
||||
var $7446 = self.str;
|
||||
var _reply$pst$91 = Parser$State$new$(Parser$Error$maybe_combine$($7433, $7442), $7443, $7444, $7445, $7446);
|
||||
var self = _reply$pst$91;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7448 = self.err;
|
||||
var _reply$97 = Kind$Parser$term(_reply$pst$91);
|
||||
var self = _reply$97;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7450 = self.err;
|
||||
var self = $7448;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7452 = self.value;
|
||||
var $7453 = Parser$Reply$error$(Parser$Error$combine$($7452, $7450));
|
||||
var $7451 = $7453;
|
||||
break;
|
||||
case 'Maybe.none':
|
||||
var $7454 = Parser$Reply$error$($7450);
|
||||
var $7451 = $7454;
|
||||
break;
|
||||
};
|
||||
var $7449 = $7451;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7455 = self.pst;
|
||||
var $7456 = self.val;
|
||||
var self = $7455;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
var $7458 = self.err;
|
||||
var $7459 = self.nam;
|
||||
var $7460 = self.ini;
|
||||
var $7461 = self.idx;
|
||||
var $7462 = self.str;
|
||||
var _reply$pst$105 = Parser$State$new$(Parser$Error$maybe_combine$($7448, $7458), $7459, $7460, $7461, $7462);
|
||||
var $7463 = Parser$Reply$value$(_reply$pst$105, $7456);
|
||||
var $7457 = $7463;
|
||||
break;
|
||||
};
|
||||
var $7449 = $7457;
|
||||
break;
|
||||
};
|
||||
var $7447 = $7449;
|
||||
break;
|
||||
};
|
||||
var $7441 = $7447;
|
||||
break;
|
||||
};
|
||||
var $7434 = $7441;
|
||||
break;
|
||||
};
|
||||
var $7432 = $7434;
|
||||
break;
|
||||
};
|
||||
return $7432;
|
||||
}), _reply$pst$71);
|
||||
var self = _reply$77;
|
||||
switch (self._) {
|
||||
case 'Parser.Reply.error':
|
||||
var $7464 = self.err;
|
||||
var self = $7462;
|
||||
var self = $7430;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7466 = self.value;
|
||||
@ -23633,7 +23633,7 @@ module.exports = (function() {
|
||||
var $7465 = $7468;
|
||||
break;
|
||||
};
|
||||
var $7463 = $7465;
|
||||
var $7431 = $7465;
|
||||
break;
|
||||
case 'Parser.Reply.value':
|
||||
var $7469 = self.pst;
|
||||
@ -23646,7 +23646,7 @@ module.exports = (function() {
|
||||
var $7474 = self.ini;
|
||||
var $7475 = self.idx;
|
||||
var $7476 = self.str;
|
||||
var _reply$pst$85 = Parser$State$new$(Parser$Error$maybe_combine$($7462, $7472), $7473, $7474, $7475, $7476);
|
||||
var _reply$pst$85 = Parser$State$new$(Parser$Error$maybe_combine$($7430, $7472), $7473, $7474, $7475, $7476);
|
||||
var self = _reply$pst$85;
|
||||
switch (self._) {
|
||||
case 'Parser.State.new':
|
||||
@ -23759,7 +23759,7 @@ module.exports = (function() {
|
||||
}));
|
||||
var _term$132 = Kind$Term$app$(_term$130, _lamb$131);
|
||||
var _term$133 = Kind$Term$app$(_term$132, (() => {
|
||||
var self = $7439;
|
||||
var self = $7470;
|
||||
switch (self._) {
|
||||
case 'Maybe.some':
|
||||
var $7525 = self.value;
|
||||
@ -23769,11 +23769,11 @@ module.exports = (function() {
|
||||
var $7527 = $7525;
|
||||
return $7527;
|
||||
})));
|
||||
var _filt$137 = Kind$Term$app$(_filt$136, $7470);
|
||||
var _filt$137 = Kind$Term$app$(_filt$136, $7422);
|
||||
var $7526 = _filt$137;
|
||||
return $7526;
|
||||
case 'Maybe.none':
|
||||
var $7528 = $7470;
|
||||
var $7528 = $7422;
|
||||
return $7528;
|
||||
};
|
||||
})());
|
||||
@ -23808,25 +23808,25 @@ module.exports = (function() {
|
||||
var $7471 = $7477;
|
||||
break;
|
||||
};
|
||||
var $7463 = $7471;
|
||||
var $7431 = $7471;
|
||||
break;
|
||||
};
|
||||
var $7461 = $7463;
|
||||
var $7429 = $7431;
|
||||
break;
|
||||
};
|
||||
var $7455 = $7461;
|
||||
var $7423 = $7429;
|
||||
break;
|
||||
};
|
||||
var $7448 = $7455;
|
||||
var $7415 = $7423;
|
||||
break;
|
||||
};
|
||||
var $7446 = $7448;
|
||||
var $7413 = $7415;
|
||||
break;
|
||||
};
|
||||
var $7440 = $7446;
|
||||
var $7407 = $7413;
|
||||
break;
|
||||
};
|
||||
var $7400 = $7440;
|
||||
var $7400 = $7407;
|
||||
break;
|
||||
};
|
||||
var $7398 = $7400;
|
||||
|
Loading…
Reference in New Issue
Block a user