"Mark Le Noury" <23*6*4*
5@s*u*e*t*u*a*e*u*a*> wrote:
> "Joshua Noble" <22*6*9*
8@s*u*e*t*u*a*e*u*a*> wrote:
>
> > "Mark Le Noury" <23*6*4*
5@s*u*e*t*u*a*e*u*a*> wrote:
> >
> > > That would be hard to do without building a full-blown syntax parser, how would you figure out how many parameters are in this function call:
> > >
> > > function_name((x+1)-2, function2((a-1),b))
> >
> > I'm not sure if it is necessary but it does sound like fun (if you're me anyway).
> >
> > You could check the number of arguments by counting the number of commas and the number of open brackets without a closing bracket. If number of open brackets is 1, then count the commas, otherwise ignore the commas. E.g. the number of commas counted in the above expression would be 1, so there are 2 parameters total.
>
>
>
> what happens when the function takes a string as a parameter and the string contains bracket and commas? e.g. call_function("This will break, your idea (maybe?)")
Yes, that would break my cool idea. However, we can still fix it, just keep track of the quotes too. If we saw a quote ignore everything until we see another quote.
Unfortunately, ml only supports real numbers, which makes me sad as this circumstance will never occur.