What was the difference between `channel.from` and...
# nostupidquestions
a
What was the difference between
channel.from
and
channel.of
?
a
channel.from
would take either a bare list of items e.g.
channel.from(1,2,3,4)
or a list
channel.from([1,2,3,4])
and both of these would return the same channel.
channel.of
does not flatten the list out into the individual elements (this is done using
channel.fromList
now).
Copy code
ch_from_bare = channel.from(1,2,3,4)
ch_from_bare.view{v -> "from_bare:${v}"}
from_bare:1
from_bare:2
from_bare:3
from_bare:4


ch_from_list = channel.from([1,2,3,4])
ch_from_list.view{v -> "from_list:${v}"}
from_list:1
from_list:2
from_list:3
from_list:4


ch_of_bare = channel.of(1,2,3,4)
ch_of_bare.view{v -> "of_bare:${v}"}
of_bare:1
of_bare:2
of_bare:3
of_bare:4


ch_of_list = channel.of([1,2,3,4])
ch_of_list.view{v -> "of_list:${v}"}
of_list:[1, 2, 3, 4]
a
Thanks Arthur, I think I follow.
channel.of
treats the list as a single element and
channel.from
iterates through each element of a given list?
a
Yes basically
🙏 1