# Flux.chunk error?

**URL:** <https://discourse.julialang.org/t/flux-chunk-error/37358>\
**Category:** New to Julia\
**Created:** [April 10, 2020, 5:26pm UTC](https://discourse.julialang.org/t/flux-chunk-error/37358 "2020-04-10T17:26:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [April 10, 2020, 5:26pm UTC](https://discourse.julialang.org/t/flux-chunk-error/37358/1 "2020-04-10T17:26:16Z")

</div>

Here is some code:

```julia
chunk[1:20,6)

```

which returns:

```julia
 [1, 2, 3, 4]    
 [5, 6, 7, 8]    
 [9, 10, 11, 12] 
 [13, 14, 15, 16]
 [17, 18, 19, 20]

```

That is only 5 chunks, and I expect 6. Why not return

```julia
[1,2,3,4]
[6,7,8,9]
[11,12,13,14]
[16,17,18,19]
[]

```

The documentation states: returns “n” chunks, but there are no caveats given.

---

<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:** [April 11, 2020, 7:43am UTC](https://discourse.julialang.org/t/flux-chunk-error/37358/2 "2020-04-11T07:43:54Z")

</div>

I think this may be a bug. You may want to report an issue, and possibly provide a PR fixing this (it’s a trivial utility function so this should be easy).

---

<div class="post-metadata">

**Author:** ![erlebach1](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@erlebach1](https://discourse.julialang.org/u/erlebach1)\
**Post date:** [April 11, 2020, 12:24pm UTC](https://discourse.julialang.org/t/flux-chunk-error/37358/3 "2020-04-11T12:24:23Z")

</div>

What would you expect chunk(4,3) to return? There are multiple approaches.  
If 8 chunks are expected, the answer should be [1],[2],[3,4]. However, the last chunk is then larger than the others. I do not Know whether that is expected behavior or not. It is the difference between using floor and ceiling in the definition of the chunk() function.
