Pancake numbers: Difference between revisions

Content added Content deleted
m (Altered code to be more C++ idiomatic.)
m (→‎{{header|Wren}}: Minor tidy)
Line 1,784: Line 1,784:


Clearly, for non-trivial 'n', the number of flips required for the pancake sorting task will generally be more as no attempt is being made there to minimize the number of flips, just to get the data into sorted order.
Clearly, for non-trivial 'n', the number of flips required for the pancake sorting task will generally be more as no attempt is being made there to minimize the number of flips, just to get the data into sorted order.
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt


var pancake = Fn.new { |n|
var pancake = Fn.new { |n|
Line 1,819: Line 1,819:


Note that map iteration order is undefined in Wren and so the examples are (in effect) randomly chosen from those available.
Note that map iteration order is undefined in Wren and so the examples are (in effect) randomly chosen from those available.
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt


// Converts a string of the form "[1, 2]" into a list: [1, 2]
// Converts a string of the form "[1, 2]" into a list: [1, 2]