# Syntax errors for a user defined function

**URL:** <https://discourse.mc-stan.org/t/syntax-errors-for-a-user-defined-function/21601>\
**Category:** Modeling\
**Created:** [March 30, 2021, 4:56pm UTC](https://discourse.mc-stan.org/t/syntax-errors-for-a-user-defined-function/21601 "2021-03-30T16:56:03Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![martinmodrak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/martinmodrak/32/133_2.png) [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Post date:** [April 6, 2021, 9:10pm UTC](https://discourse.mc-stan.org/t/syntax-errors-for-a-user-defined-function/21601/9 "2021-04-06T21:10:56Z")

</div>

> [@zcai](#):
>
> Do you think 2.26 has reverse() function in it? If so I could just update my version, since I’ve tried cmdstan and reverse() function worked :)

Cmdstan should also be on 2.26, so it should work.

The code looks good at first glance, so maybe it is just older version of rstan not recognizing `sort_desc`. However, it looks like you throw away some values for `cvxy` that you compute in the loop - i.e. `cvxy[lx + 2]` and above is never used, so if you don’t use it you may as well not compute it all and save some performance.

---

_[View the full topic](https://discourse.mc-stan.org/t/syntax-errors-for-a-user-defined-function/21601)._
