Comments (3)
This was addressed in #670 and can be closed.
data {
real x, y, z;
array[5] int i, j;
}
transformed data {
real a = 5, b = 6;
real c = 5, d, e = 7;
}
You can not do real alpha, beta, gamma[5];
as gamma is of a different type.
You can do
array[5] real alpha, beta, gamma;
from stanc3.
Thanks for creating the issue.
It's been on our to-do list from the get go, but never got transferred
to an issue.
There are two related features, both of which also need issues:
- Allowing compound declaration and assignment where relevant (transformed
data, transformed parameters, generated quantities, local variables, e.g.,
real alpha <- 1;
- Allowing inline local variable declarations, like in C++, e.g.,
beta <- 2;
real alpha; // local variable declaration
alpha <- 3;
- Bob
On Nov 20, 2014, at 11:47 AM, tpapp [email protected] wrote:
Would it be possible to allow multiple declarations on one line, that avoid repeating the var_decl part of the grammar? Eg
real alpha, beta, gamma[5];
real<lower=0> a, b[3, 4];that would be equivalent to
real alpha;
real beta;
real gamma[5];
real<lower=0> a;
real<lower=0> b[3, 4];and similarly for other types.
This would allow more compact code, could factor out common parts. As far as I understand, this would only change the surface syntax (parser) a bit, and would require no change to the internals.
—
Reply to this email directly or view it on GitHub.
from stanc3.
@andrewgelman has been asking for this feature since Stan 1.0. I've even used it to compress slides.
I'm less keen on the idiom myself and we don't use it much in our own C++, but I'm OK with someone adding it to the language.
from stanc3.
Related Issues (20)
- [Build] Investigate Melange as an alternative to Js_of_ocaml
- [BUG] atan2 listed as vectorised in manual, vectorised sigs not in stanc3
- Stan compiler Error when using the normal_cdf function HOT 16
- [BUG] Reporting example where new compiler failed HOT 1
- [BUG] stanc3 v. 2.33.1: build error with OCaml 4.14.1 and JaneStreet 0.16.x: `Error: This expression has type [ `Use_Sys_unix ] This is not a function; it cannot be applied`; `Error: Unbound value Set.Poly.union` HOT 4
- Typechecker: Allow predicate-based typechecking of library functions HOT 3
- [BUG] SoA request is ignored with external c++ HOT 5
- Release support for building against ocaml 5 HOT 9
- [BUG] Github action doesn't build static binary for linux platform
- Improve message and handling of internal compiler errors
- [BUG] Array declaration no longer canonicalizes from deprecated format HOT 1
- Iinformative error message for expired array syntax
- CI: Switch from the ghr script to the github CLI
- Namespacing with external C++ and `--standalone-functions` causes issues HOT 4
- [BUG] Bogus parsing error with Stanc3 JS >= 2.34 - but only with QuickJS HOT 3
- #include support in stancjs HOT 1
- New stan error in R version 4.3.3 HOT 7
- Internal compiler error: TypeError: not a function HOT 2
- Expose built-in constraint transforms as _jacobian functions
- [FR] Add `lower_upper` constrain HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stanc3.