#J, 17 bytes
J, 17 bytes
(#@]$[,1#~<:@[)#]
(...) # ]everything in parens creates the string for J's built in "copy" verb. So, eg, if the left argument is 3, it creates the string3 1 1repeated as needed to equal the number of characters in the right arg], which contains the string. Which is to say,#solves the problem directly, assuming we can give it the correct left argument:4should be4 1 1 1repeated, and so on.- Examining
#@]$[,1#~<:@[, we see it uses J's shape verb$in the middle -- that's the main verb of this phrase... - To the left of
$is#@], meaning the length#of the right arg]. - To the right of
$is[,1#~<:@[, a 5 verb train. The first train executed is... 1#~<:@[, which means 1 copied#~(passive form of copy) one less than<:the left arg[. This result is passed to the final fork:[, ...meaning take the left arg, and append the result we just calculated, which is a string of1s.
#J, 17 bytes
(#@]$[,1#~<:@[)#]
(...) # ]everything in parens creates the string for J's built in "copy" verb. So, eg, if the left argument is 3, it creates the string3 1 1repeated as needed to equal the number of characters in the right arg], which contains the string. Which is to say,#solves the problem directly, assuming we can give it the correct left argument:4should be4 1 1 1repeated, and so on.- Examining
#@]$[,1#~<:@[, we see it uses J's shape verb$in the middle -- that's the main verb of this phrase... - To the left of
$is#@], meaning the length#of the right arg]. - To the right of
$is[,1#~<:@[, a 5 verb train. The first train executed is... 1#~<:@[, which means 1 copied#~(passive form of copy) one less than<:the left arg[. This result is passed to the final fork:[, ...meaning take the left arg, and append the result we just calculated, which is a string of1s.
J, 17 bytes
(#@]$[,1#~<:@[)#]
(...) # ]everything in parens creates the string for J's built in "copy" verb. So, eg, if the left argument is 3, it creates the string3 1 1repeated as needed to equal the number of characters in the right arg], which contains the string. Which is to say,#solves the problem directly, assuming we can give it the correct left argument:4should be4 1 1 1repeated, and so on.- Examining
#@]$[,1#~<:@[, we see it uses J's shape verb$in the middle -- that's the main verb of this phrase... - To the left of
$is#@], meaning the length#of the right arg]. - To the right of
$is[,1#~<:@[, a 5 verb train. The first train executed is... 1#~<:@[, which means 1 copied#~(passive form of copy) one less than<:the left arg[. This result is passed to the final fork:[, ...meaning take the left arg, and append the result we just calculated, which is a string of1s.
#J, 17 bytes
(#@]$[,1#~<:@[)#]
(...) # ]everything in parens creates the string for J's built in "copy" verb. So, eg, if the left argument is 3, it creates the string3 1 1repeated as needed to equal the number of characters in the right arg], which contains the string. Which is to say,#solves the problem directly, assuming we can give it the correct left argument:4should be4 1 1 1repeated, and so on.- Examining
#@]$[,1#~<:@[, we see it uses J's shape verb$in the middle -- that's the main verb of this phrase... - To the left of
$is#@], meaning the length#of the right arg]. - To the right of
$is[,1#~<:@[, a 5 verb train. The first train executed is... 1#~<:@[, which means 1 copied#~(passive form of copy) one less than<:the left arg[. This result is passed to the final fork:[, ...meaning take the left arg, and append the result we just calculated, which is a string of1s.
#J, 17 bytes
(#@]$[,1#~<:@[)#]
(...) # ]everything in parens creates the string for J's built in "copy" verb. So, eg, if the left argument is 3, it creates the string3 1 1repeated as needed to equal the number of characters in the right arg], which contains the string. Which is to say,#solves the problem directly, assuming we can give it the correct left argument:4should be4 1 1 1repeated, and so on.- Examining
#@]$[,1#~<:@[, we see it uses J's shape verb$in the middle -- that's the main verb of this phrase... - To the left of
$is#@], meaning the length#of the right arg]. - To the right of
$is[,1#~<:@[, a 5 verb train. The first train executed is... 1#~<:@[, which means 1 copied#~(passive form of copy) one less than<:the left arg[. This result is passed to the final fork:[, ...meaning take the left arg, and append the result we just calculated, which is a string of1s.