Skip to main content
Commonmark migration
Source Link

#Octave, 55 bytes, 10 numbers, cracked

Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

added 6 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I asked about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflowstackoverflow.

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

#Octave, 55 bytes, 10 numbers, cracked

(o__(O_o_(@(__o)o__-O}_)_(0<O,{_(_o_O-1)+1_@(_1}_)(__o_

_ is the unknown character.

###Solution

(o=@(O,o)(@(O,o)o{2-O}())(0<O,{@()o(O-1)+1,@()1}))(0,o) %then changing the very last 0 to 1,2,3 e.t.c.

Given x, this does recursively calculate x+1. It is mainly composed of two anonymous functions. One provides an if statement to anchor the recursion:

if_ = @( boolean, outcomes) outcomes{ 2 - boolean}();

This is just abusing the fact that a boolean values evaluates to 0 or 1. This function accepts a boolean value, and a cell array of two functions, and evaluates one or the other of these two functiosn depending on the boolean value. The second part is the actual recursion:

plus_one = @(n,f) if_(0<n ,{@()f(n-1)+1, @()1})

As an anyonmous function is anonymous, you cannot directly access it from itsefl. That why we need a second argument f first. Later we will provide a handle to the function instelf as a second argument, so a final function would looks like so:

plus_one_final = @(n)plus_one(n,plus_one);

So in this notation my submission becomes:

(plus_one=@(n,f)(@(boolean,outcomes)outcomes{2-boolean}())(0<n,{@()f(n-1)+1,@()1}))(n,f)

I about recursion anchors for anonymous functions in MATLAB a while ago on stackoverflow.

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link
Loading
added 189 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249
Loading
added 189 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249
Loading
added 189 characters in body
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249
Loading
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249
Loading