# Some CLP(FD) shenanigans with indexing predicates

**URL:** <https://swi-prolog.discourse.group/t/some-clp-fd-shenanigans-with-indexing-predicates/3343>\
**Category:** Nice to know\
**Tags:** clpfd\
**Created:** [December 5, 2020, 6:23pm UTC](https://swi-prolog.discourse.group/t/some-clp-fd-shenanigans-with-indexing-predicates/3343 "2020-12-05T18:23:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmbientTea](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ambienttea/32/954_2.png) [@AmbientTea](https://swi-prolog.discourse.group/u/AmbientTea)\
**Post date:** [December 5, 2020, 6:23pm UTC](https://swi-prolog.discourse.group/t/some-clp-fd-shenanigans-with-indexing-predicates/3343/1 "2020-12-05T18:23:13Z")

</div>

Hello,  
I’ve had this idea that I wanted to explore for a little while and today I wrote a little note with examples showing how little changes it takes to make `length` and `nth` work nicely with clp(fd) to handle some interesting queries:

> **[Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.](https://www.notion.so/ambienttea/Constraint-conscious-indexing-predicates-542c59da1aaa406ea3ee79b6e4d48d53)**
>
> A new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team

Hope some of you find it interesting.
