# Understanding few syntax of Julia code

**URL:** <https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514>\
**Category:** General Usage\
**Tags:** question, syntax\
**Created:** [January 18, 2021, 4:28am UTC](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514 "2021-01-18T04:28:12Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Jared\_shay](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@Jared\_shay](https://discourse.julialang.org/u/Jared_shay)\
**Post date:** [January 18, 2021, 11:32pm UTC](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514/23 "2021-01-18T23:32:28Z")

</div>

Thank you very much. Your answer thread is very helpful and informative.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [January 19, 2021, 7:12am UTC](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514/24 "2021-01-19T07:12:45Z")

</div>

> [@Jared\_shay](#):
>
> How could we simplify this in Julia: `K = [( i >= j ? dot(view(X,:,i), view(X,:,j)) : 0.0 )::Float64 for i=1:n, j=1:n]` ?

I don’t know where that code is coming from but it’s the same as

```julia
using LinearAlgebra
K = tril(X' * X)

```

I’m confident that can be directly ported to numpy.

[Previous page](https://discourse.julialang.org/t/understanding-few-syntax-of-julia-code/53514.md?page=1)
