# Typed and Untyped Comprehensions

**URL:** <https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108>\
**Category:** General Usage\
**Created:** [September 27, 2017, 9:23am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108 "2017-09-27T09:23:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [September 27, 2017, 9:23am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/1 "2017-09-27T09:23:14Z")

</div>

Hi everyone,

What are typed and untyped comprehensions and what are syntax forms of those?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 27, 2017, 9:25am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/2 "2017-09-27T09:25:26Z")

</div>

Does the info here: [https://docs.julialang.org/en/stable/manual/arrays/#Comprehensions-1](https://docs.julialang.org/en/stable/manual/arrays/#Comprehensions-1) help?

---

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [September 27, 2017, 9:28am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/3 "2017-09-27T09:28:50Z")

</div>

Can there be dictionary based comprehensions?  
is so can you give me an example?

Thanks

---

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [September 27, 2017, 9:31am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/4 "2017-09-27T09:31:12Z")

</div>

```nohighlight
julia> ex = :([x^2 for x in 0:9 if x>5])
:([x ^ 2 for x = 0:9 if x > 5])

julia> ex.head
:comprehension

julia> ex.args
1-element Array{Any,1}:
 :((x ^ 2 for x = 0:9 if x > 5))

julia> ex.args[1]
:((x ^ 2 for x = 0:9 if x > 5))

julia> ex.args[1].head
:generator

julia> ex = :(Int[x^2 for x in 0:9 if x>5])
:(Int[x ^ 2 for x = 0:9 if x > 5])

julia> ex.head
:typed_comprehension

```

I see :compherension and :typed\_compherension can there be any more head symbols related to comprehensions?

How can i learn that?  
Thanks

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 27, 2017, 9:38am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/5 "2017-09-27T09:38:51Z")

</div>

Might be some useful stuff here: [https://docs.julialang.org/en/latest/devdocs/ast/#Bracketed-forms-1](https://docs.julialang.org/en/latest/devdocs/ast/#Bracketed-forms-1)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 27, 2017, 9:52am UTC](https://discourse.julialang.org/t/typed-and-untyped-comprehensions/6108/6 "2017-09-27T09:52:47Z")

</div>

Is `generator` missing from that table, or does it belong elsewhere?
