K (oK), (削除) 47 (削除ここまで) 42(削除) 42 (削除ここまで) 41 bytes
f:{[a]ii{$[y;o[x;y-1]+o[x-1;x-y];a x]}'i:!#a:x}
A function taking an array of numbers. -5 thanks to ngn. -1 thanks to Razetime.
{[a] // A function taking an argument a, returning...
{ // A function, returning
$[ // A switch statemnet
y; // If y (second arg) is nonzero
o[x;y-1]+o[x-1;x-y]; // Do a recursive call
a x // Else index x into a
]
}'i: // Call with the first argument as both arguments
'!#a:x} // Map this over a range of the same length as the input, which we also assign to a for later use
K (oK), (削除) 47 (削除ここまで) 42 bytes
f:{[a]i{$[y;o[x;y-1]+o[x-1;x-y];a x]}'i:!#a}
A function taking an array of numbers. -5 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // A function, returning
$[ // A switch statemnet
y; // If y (second arg) is nonzero
o[x;y-1]+o[x-1;x-y]; // Do a recursive call
a x // Else index x into a
]
}'i: // Call with the first argument as both arguments
'!#a} // Map this over a range of the same length as a
K (oK), (削除) 47 (削除ここまで) (削除) 42 (削除ここまで) 41 bytes
f:{i{$[y;o[x;y-1]+o[x-1;x-y];a x]}'i:!#a:x}
A function taking an array of numbers. -5 thanks to ngn. -1 thanks to Razetime.
{ // A function returning...
{ // A function, returning
$[ // A switch statemnet
y; // If y (second arg) is nonzero
o[x;y-1]+o[x-1;x-y]; // Do a recursive call
a x // Else index x into a
]
}'i: // Call with the first argument as both arguments
'!#a:x} // Map this over a range of the same length as the input, which we also assign to a for later use
K (oK), (削除) 47 (削除ここまで) 4542 bytes
{[a]f:{[a]i{$[y;o[x;y-1]+o[x-1;x-y];a x]}/2#x}''i:!#a}
A function taking an array of numbers. -25 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // An anonymous function, returning..
{ // An anonymousA function, returning...
$[ // Switch statement
A switch statemnet
y; // If y (second argumentarg), then...
is nonzero
o[x;y-1]+o[x-1;x-y]; // RecursiveDo call
a recursive call
a x // Else index x into a
] // End switch statement
}2円#x'i: // Call this function with the first inputargument as arg,both twicearguments
}'!#a} // Map this to...
!#a //over 0...len(a)
} range of the same //length Closeas functiona
K (oK), (削除) 47 (削除ここまで) 45 bytes
{[a]{{$[y;o[x;y-1]+o[x-1;x-y];a x]}/2#x}'!#a}
A function taking an array of numbers. -2 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // An anonymous function, returning..
{ // An anonymous function, returning...
$[ // Switch statement
y; // If y (second argument), then...
o[x;y-1]+o[x-1;x-y]; // Recursive call
a x // Else index into a
] // End switch statement
}2円#x // Call this function with first input as arg, twice
}' // Map this to...
!#a // 0...len(a)
} // Close function
K (oK), (削除) 47 (削除ここまで) 42 bytes
f:{[a]i{$[y;o[x;y-1]+o[x-1;x-y];a x]}'i:!#a}
A function taking an array of numbers. -5 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // A function, returning
$[ // A switch statemnet
y; // If y (second arg) is nonzero
o[x;y-1]+o[x-1;x-y]; // Do a recursive call
a x // Else index x into a
]
}'i: // Call with the first argument as both arguments
'!#a} // Map this over a range of the same length as a
K (oK), 47(削除) 47 (削除ここまで) 45 bytes
{[a]{{$[y;o[x;y-1]+o[x-1;x-y];a[x]]y];a x]}[x;x]/2#x}'!#a}
A function taking an array of numbers. -2 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // An anonymous function, returning..
{ // An anonymous function, returning...
$[ // Switch statement
y; // If y (second argument), then...
o[x;y-1]+o[x-1;x-y]; // Recursive call
a[x]a x // Else index into a
] // End switch statement
}[x;x]2円#x // Call this function with first input as arg, twice
}' // Map this to...
!#a // 0...len(a)
} // Close function
K (oK), 47 bytes
{[a]{{$[y;o[x;y-1]+o[x-1;x-y];a[x]]}[x;x]}'!#a}
A function taking an array of numbers.
{[a] // A function taking an argument a, returning...
{ // An anonymous function, returning..
{ // An anonymous function, returning...
$[ // Switch statement
y; // If y (second argument), then...
o[x;y-1]+o[x-1;x-y]; // Recursive call
a[x] // Else index into a
] // End switch statement
}[x;x] // Call this function with first input as arg, twice
}' // Map this to...
!#a // 0...len(a)
} // Close function
K (oK), (削除) 47 (削除ここまで) 45 bytes
{[a]{{$[y;o[x;y-1]+o[x-1;x-y];a x]}/2#x}'!#a}
A function taking an array of numbers. -2 thanks to ngn.
{[a] // A function taking an argument a, returning...
{ // An anonymous function, returning..
{ // An anonymous function, returning...
$[ // Switch statement
y; // If y (second argument), then...
o[x;y-1]+o[x-1;x-y]; // Recursive call
a x // Else index into a
] // End switch statement
}2円#x // Call this function with first input as arg, twice
}' // Map this to...
!#a // 0...len(a)
} // Close function