Cleanest functional way to iterate a 2D Grid Co-ordinates in Scala? Announcing the arrival of...
Should I discuss the type of campaign with my players?
What's the purpose of writing one's academic biography in the third person?
Why are there no cargo aircraft with "flying wing" design?
How to react to hostile behavior from a senior developer?
Gordon Ramsay Pudding Recipe
3 doors, three guards, one stone
Novel: non-telepath helps overthrow rule by telepaths
What does the "x" in "x86" represent?
How to call a function with default parameter through a pointer to function that is the return of another function?
How to find out what spells would be useless to a blind NPC spellcaster?
The logistics of corpse disposal
Can a USB port passively 'listen only'?
What causes the vertical darker bands in my photo?
Why are Kinder Surprise Eggs illegal in the USA?
Why light coming from distant stars is not discrete?
What does this icon in iOS Stardew Valley mean?
2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?
Why aren't air breathing engines used as small first stages
How do pianists reach extremely loud dynamics?
What would be the ideal power source for a cybernetic eye?
Sci-Fi book where patients in a coma ward all live in a subconscious world linked together
porting install scripts : can rpm replace apt?
How to find all the available tools in mac terminal?
How to override model in magento2?
Cleanest functional way to iterate a 2D Grid Co-ordinates in Scala?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Replacing a sequence of real numbers with another sequenceis this future map scala syntax good?Test runner for Scala problemsConverting imperative style user input menu to functional programming styleSimple substitution encryption with ScalaBubble sort in ScalaScala Functional Programming ODE SolverString compression algorithm using functional JavaScriptGame of Life with Scala and Functional ProgrammingKMP algorithm in scala
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
Here is my code to iterate over a 2D Grid in Scala
(1 to N) map {
i => (1 to M) map{
j => println(i + " " + j)
}
}
This is a simple alternative to a nested loop for a 2D Grid.
How can I make this more cleaner and functional, the Braces don't feel much functional.
The Aesthetics of the Code still looks pretty for loop like and how can I make this more cleaner.
functional-programming comparative-review scala
$endgroup$
add a comment |
$begingroup$
Here is my code to iterate over a 2D Grid in Scala
(1 to N) map {
i => (1 to M) map{
j => println(i + " " + j)
}
}
This is a simple alternative to a nested loop for a 2D Grid.
How can I make this more cleaner and functional, the Braces don't feel much functional.
The Aesthetics of the Code still looks pretty for loop like and how can I make this more cleaner.
functional-programming comparative-review scala
$endgroup$
add a comment |
$begingroup$
Here is my code to iterate over a 2D Grid in Scala
(1 to N) map {
i => (1 to M) map{
j => println(i + " " + j)
}
}
This is a simple alternative to a nested loop for a 2D Grid.
How can I make this more cleaner and functional, the Braces don't feel much functional.
The Aesthetics of the Code still looks pretty for loop like and how can I make this more cleaner.
functional-programming comparative-review scala
$endgroup$
Here is my code to iterate over a 2D Grid in Scala
(1 to N) map {
i => (1 to M) map{
j => println(i + " " + j)
}
}
This is a simple alternative to a nested loop for a 2D Grid.
How can I make this more cleaner and functional, the Braces don't feel much functional.
The Aesthetics of the Code still looks pretty for loop like and how can I make this more cleaner.
functional-programming comparative-review scala
functional-programming comparative-review scala
asked 3 mins ago
Siddharth SinghSiddharth Singh
62
62
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217603%2fcleanest-functional-way-to-iterate-a-2d-grid-co-ordinates-in-scala%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217603%2fcleanest-functional-way-to-iterate-a-2d-grid-co-ordinates-in-scala%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown