how to use list syntax with defaults

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to use list syntax with defaults

Nick Stokes
[newbie alert]

I am attempting to parse comma separated integers, with possible blanks.  For instance, "1,2,,3,,-1" should be parsed as {1,2,n,3,n,-1}  where is n is some constant I provide.

It seems I could do 

(int_ | eps) % ','

which works when n == 0.  However, I am unable to customize for arbitrary n.  For instance, 

(int_ | eps[_val = 3]) % ','

does not work.  "Does not work" meaning, the compiler generates an error novel.  I refrain from pasting all that here, as most likely what I am trying is in correct. 

What would be the right way? 

Thanks,
Nick







------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: how to use list syntax with defaults

TONGARI J
2015-04-28 20:34 GMT+08:00 Nick Stokes <[hidden email]>:
[newbie alert]

I am attempting to parse comma separated integers, with possible blanks.  For instance, "1,2,,3,,-1" should be parsed as {1,2,n,3,n,-1}  where is n is some constant I provide.

It seems I could do 

(int_ | eps) % ','

which works when n == 0.  However, I am unable to customize for arbitrary n.  For instance, 

(int_ | eps[_val = 3]) % ','

does not work.  "Does not work" meaning, the compiler generates an error novel.  I refrain from pasting all that here, as most likely what I am trying is in correct. 

What would be the right way? 

Try:
(int_ | attr(3)]) % ','

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: how to use list syntax with defaults

Nick Stokes
Excellent, thanks! 

On Tue, Apr 28, 2015 at 9:56 AM, TONGARI J <[hidden email]> wrote:
2015-04-28 20:34 GMT+08:00 Nick Stokes <[hidden email]>:
[newbie alert]

I am attempting to parse comma separated integers, with possible blanks.  For instance, "1,2,,3,,-1" should be parsed as {1,2,n,3,n,-1}  where is n is some constant I provide.

It seems I could do 

(int_ | eps) % ','

which works when n == 0.  However, I am unable to customize for arbitrary n.  For instance, 

(int_ | eps[_val = 3]) % ','

does not work.  "Does not work" meaning, the compiler generates an error novel.  I refrain from pasting all that here, as most likely what I am trying is in correct. 

What would be the right way? 

Try:
(int_ | attr(3)]) % ','

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general



------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general