Husk, 16(削除) 16 (削除ここまで) 12 bytes
ΘGȯ`J1J'ΘGȯf≠'"s,e10
"()s00
Trees or arbitrarily nested lists are not a thing in Husk, so this builds a string representation of the tree, where a leaf is represented as "()""0" and a node with a Left child L and a right child R is represented as "(L,R)".
Returns the infinite list of Fibonacci trees, which get printed one per line.
Explanation
I've started from what's probably the second shortest way of computing Fibonacci numbers in Husk (the shortest being the builtin İf):
ΘG+10
This puts a 0 at the beginning of the sequence (with Θ), then scans (G) recursively the same list 0 with +, starting from 1 and summing every time the last result to the next element in the list.
With this, we just need to alter the starting values and the + operator to make it compute Fibonacci trees.
The 1 now becomes "()""0" (moved tos0, string representation of the next line so we can reuse it laternumber 0) and the 0 turns into "" automagically, thanks to Husk understanding that the list is now a list of strings rather than numbers. The operator that generates a new tree from the two previous ones isbecomes a bit more complex(but not as complex as I originally made it, thanks Dominic van Essen !):
`J1J'f≠'"s,e Input: left subtree "L", right subtree "R"
, e PutJoin the two trees togethersubtrees in a listpair ["L"("L","R"]"R")
J', s Join the listConvert ofthe stringspair withinto a commastring "L"(\"L\",R"\"R\")"
`JNow we need to remove the extra quotes:
f Flipped join: use this string to join the list
Keep only 1those characters
≠ that "()"
are different
'" Output:than "(L,R)"
Husk, 16 bytes
ΘGȯ`J1J',e10
"()
Trees or arbitrarily nested lists are not a thing in Husk, so this builds a string representation of the tree, where a leaf is represented as "()" and a node with a Left child L and a right child R is represented as "(L,R)".
Returns the infinite list of Fibonacci trees, which get printed one per line.
Explanation
I've started from what's probably the second shortest way of computing Fibonacci numbers in Husk (the shortest being the builtin İf):
ΘG+10
This puts a 0 at the beginning of the sequence (with Θ), then scans (G) recursively the same list 0 with +, starting from 1 and summing every time the last result to the next element in the list.
With this, we just need to alter the starting values and the + operator to make it compute Fibonacci trees.
The 1 now becomes "()" (moved to the next line so we can reuse it later) and the 0 turns into "" automagically thanks to Husk understanding that the list is now a list of strings rather than numbers. The operator that generates a new tree from the two previous ones is a bit more complex:
`J1J',e Input: left subtree "L", right subtree "R"
e Put the two trees together in a list ["L","R"]
J', Join the list of strings with a comma "L,R"
`J Flipped join: use this string to join the list
1 "()"
Output: "(L,R)"
Husk, (削除) 16 (削除ここまで) 12 bytes
ΘGȯf≠'"s,s00
Trees or arbitrarily nested lists are not a thing in Husk, so this builds a string representation of the tree, where a leaf is represented as "0" and a node with a Left child L and a right child R is represented as "(L,R)".
Returns the infinite list of Fibonacci trees, which get printed one per line.
Explanation
I've started from what's probably the second shortest way of computing Fibonacci numbers in Husk (the shortest being the builtin İf):
ΘG+10
This puts a 0 at the beginning of the sequence (with Θ), then scans (G) recursively the same list 0 with +, starting from 1 and summing every time the last result to the next element in the list.
With this, we just need to alter the starting values and the + operator to make it compute Fibonacci trees.
The 1 now becomes "0" (s0, string representation of the number 0) and the 0 turns into "" automagically, thanks to Husk understanding that the list is now a list of strings rather than numbers. The operator that generates a new tree from the two previous ones becomes a bit more complex(but not as complex as I originally made it, thanks Dominic van Essen !):
f≠'"s, Input: left subtree "L", right subtree "R"
, Join the two subtrees in a pair ("L","R")
s Convert the pair into a string "(\"L\",\"R\")"
Now we need to remove the extra quotes:
f Keep only those characters
≠ that are different
'" than "
Husk, 16 bytes
ΘGȯ`J1J',e10
"()
Trees or arbitrarily nested lists are not a thing in Husk, so this builds a string representation of the tree, where a leaf is represented as "()" and a node with a Left child L and a right child R is represented as "(L,R)".
Returns the infinite list of Fibonacci trees, which get printed one per line.
Explanation
I've started from what's probably the second shortest way of computing Fibonacci numbers in Husk (the shortest being the builtin İf):
ΘG+10
This puts a 0 at the beginning of the sequence (with Θ), then scans (G) recursively the same list 0 with +, starting from 1 and summing every time the last result to the next element in the list.
With this, we just need to alter the starting values and the + operator to make it compute Fibonacci trees.
The 1 now becomes "()" (moved to the next line so we can reuse it later) and the 0 turns into "" automagically thanks to Husk understanding that the list is now a list of strings rather than numbers. The operator that generates a new tree from the two previous ones is a bit more complex:
`J1J',e Input: left subtree "L", right subtree "R"
e Put the two trees together in a list ["L","R"]
J', Join the list of strings with a comma "L,R"
`J Flipped join: use this string to join the list
1 "()"
Output: "(L,R)"