Pancake numbers: Difference between revisions

m
m (Altered code to be more C++ idiomatic.)
m (→‎{{header|Wren}}: Minor tidy)
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.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
var pancake = Fn.new { |n|
Line 1,819:
 
Note that map iteration order is undefined in Wren and so the examples are (in effect) randomly chosen from those available.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
// Converts a string of the form "[1, 2]" into a list: [1, 2]
9,485

edits