# Behaviour of |\> transpose applied to BitVector

**URL:** https://discourse.julialang.org/t/behaviour-of-transpose-applied-to-bitvector/92362
**Category:** New to Julia
**Created:** [December 31, 2022, 3:59pm UTC](https://discourse.julialang.org/t/behaviour-of-transpose-applied-to-bitvector/92362 "2022-12-31T15:59:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Max\_Beez](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)
#### Post date: [December 31, 2022, 3:59pm UTC](https://discourse.julialang.org/t/behaviour-of-transpose-applied-to-bitvector/92362/1 "2022-12-31T15:59:25Z")

</div>

Inputing `1:3 .== 1:3 ` will return a BitVector of the form `1 1 1` as a column vector

If we set `A = 1:3 .== 1:3` and take `transpose(A)` we get the typical transpose i.e. given as a row vector.

However, if we input `1:3 .== 1:3 |> transpose` we receive a 3x3 matrix with ones along the diagonal. I understand why there is 1’s along the diagonal and 0’s elsewhere, but I’m curious why the difference in return evaluation.

I am curious as to why this is if someone could explain?

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [December 31, 2022, 4:06pm UTC](https://discourse.julialang.org/t/behaviour-of-transpose-applied-to-bitvector/92362/2 "2022-12-31T16:06:30Z")

</div>

I’m not at a computer so I can’t check, but I suspect this is due to `|>` having higher [precedence](https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity) than `==`. The broadcast then expands the singleton dimensions, resulting in a matrix.

You can check with `Meta.@parse` what ends up plugged into where.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 31, 2022, 5:01pm UTC](https://discourse.julialang.org/t/behaviour-of-transpose-applied-to-bitvector/92362/3 "2022-12-31T17:01:25Z")

</div>

> [@Sukera](#):
>
> I suspect this is due to `|>` having higher [precedence](https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity) than `==`.

Right.

```julia
julia> dump(:(1:3 .== 1:3 |> transpose))
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol .==
    2: Expr
      head: Symbol call
      args: Array{Any}((3,))
        1: Symbol :
        2: Int64 1
        3: Int64 3
    3: Expr
      head: Symbol call
      args: Array{Any}((3,))
        1: Symbol |>
        2: Expr
          head: Symbol call
          args: Array{Any}((3,))
            1: Symbol :
            2: Int64 1
            3: Int64 3
        3: Symbol transpose

```

What you want is `(1:3 .== 1:3) |> transpose`
