Problem with declaring lists by means of the syntax size: ... fill_with: ... ?

20 views
Skip to first unread message

Thomas Elskens

unread,
Mar 11, 2014, 2:20:33 PM3/11/14
to gama-p...@googlegroups.com
Hello,

According to the manuel, it should be possible to declare lists in this fashion :

matrix<int> m size: {10,10} fill_with: 1;
list
<string> l size: 20 fill_with: "";

However, when I try to imitate this syntax in my own code, as follows :

action cycle_crossover(list<retailer> parent1, list<retailer> parent2)
{
list<retailer> offspring size: length(parent1) fill_with: first(parent1) ;
...}

I get this error :
"-Unknow facet size 
-Missing facet value
-Unknow facet fill_with"

Is there a means to use this syntax nevertheless ? It's much more clear than its equivalent :
list<retailer> offspring <- nil ;
loop times: length(parent1)
{
add item: first(parent1) to: offspring ;
}


Thanks a lot,

Thomas Elskens

Alexis Drogoul

unread,
Mar 11, 2014, 2:56:12 PM3/11/14
to gama-p...@googlegroups.com
Hi,

I agree that this is a bit confusing — but these facets are only available when you declare attributes, not temporary variables…. Maybe you can raise an issue about this, so that we harmonize these declarations…


Alexis
> --
> You received this message because you are subscribed to the Google Groups "GAMA" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
> To post to this group, send email to gama-p...@googlegroups.com.
> Visit this group at http://groups.google.com/group/gama-platform.
> For more options, visit https://groups.google.com/d/optout.

--
Senior Researcher, UMI UMMISCO 209, IRD & UPMC, France.
Invited Researcher, DREAM, Can Tho University, Viet Nam.
--
alexis....@gmail.com | http://tiny.cc/liqemw
[Vietnam] +84915088155 [France] +33608698845
--
GAMA: https://code.google.com/p/gama-platform/

Thomas Elskens

unread,
Mar 11, 2014, 4:54:36 PM3/11/14
to gama-p...@googlegroups.com

I rechecked the manual and this limitation is indeed spelled out : my mistake. 

I followed your advice and filed an enhancement request (issue 849). 

Thanks for the very rapid response,

Thomas
Reply all
Reply to author
Forward
0 new messages