# GSoC: Linked List || Blog post by Chetan Karwa || #12

**URL:** <https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700>\
**Category:** GSoC-2021\
**Created:** [August 13, 2021, 8:29pm UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700 "2021-08-13T20:29:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chetan\_Karwa](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@Chetan\_Karwa](https://fortran-lang.discourse.group/u/Chetan_Karwa)\
**Post date:** [August 13, 2021, 8:29pm UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700/1 "2021-08-13T20:29:33Z")

</div>

Greetings Everyone,

Progress in the past week:

- Fixed the issue with concat and slice as APIs.
- Implemented the absorb API
- Made a progress report for my project. Request everyone to suggest changes in the report. ([link](https://docs.google.com/document/d/1e3V9uRmJcjO55sTd9339i4dR8UGUH_EUPRaS5M1KfZY/edit?usp=sharing))

Plans for the coming week:

- Properly comment the whole code for better understanding.
- Bring in my code into the forked repository of stdlib.

The approach for out of index range input in get() and insert() APIs can be handled by using modulo of the input index.  
For instance, if in get() API input index is 12 and the size of the list is 7 then the function returns the item stored at the index 5 (12%7). I ask for other’s views regarding the same.

Thank you.

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [August 14, 2021, 2:02pm UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700/2 "2021-08-14T14:02:55Z")

</div>

> [@Chetan\_Karwa](#):
>
> For instance, if in get() API input index is 12 and the size of the list is 7 then the function returns the item stored at the index 5 (12%7). I ask for other’s views regarding the same.

That sounds like a very surprising behavior. I imagine it would lead to very strange and possibly difficult to find bugs.

---

<div class="post-metadata">

**Author:** ![simong](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@simong](https://fortran-lang.discourse.group/u/simong)\
**Post date:** [August 15, 2021, 1:06pm UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700/3 "2021-08-15T13:06:21Z")

</div>

+1  
If we want to handle out-of-range indices so that they’re never errors I’d suggest that anything \> len(list) appends and anything less than 1 prepends. It is possible that some application will want the modulo behaviour but this is a library component so I’d suggest leaving the weird and unusual to the application.

---

<div class="post-metadata">

**Author:** ![Chetan\_Karwa](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@Chetan\_Karwa](https://fortran-lang.discourse.group/u/Chetan_Karwa)\
**Post date:** [August 16, 2021, 7:15pm UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700/4 "2021-08-16T19:15:19Z")

</div>

It does add a complex behaviour to the API. Therefore, I will keep the API as it is now i.e.

> anything \> len(list) appends and anything less than 1 prepends

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [August 17, 2021, 8:16am UTC](https://fortran-lang.discourse.group/t/gsoc-linked-list-blog-post-by-chetan-karwa-12/1700/5 "2021-08-17T08:16:32Z")

</div>

In general: the API should not present any surprises. A bit boring perhaps, but it makes life much easier for the user 🙂
