Re: [q-lang-users] where
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-10-07 19:39:14
|
Eddie Rucker wrote: > Given the following script > > // strip character C from the left and right sides of a string > strip C "" = ""; > strip C S = strip C $ sub S 0 (N-1) if (S!N = C) where N = #S-1; > = strip C $ sub S 1 N if (S!0 = C) where N = #S-1; > = S otherwise; > > Is it possible to have another type of local variable defined at the end > of a list of equations that would apply to all of them? No. I actually thought about this problem before. As local variables are maintained on the expression stack, it probably wouldn't be that difficult to modify the VM to handle such shared qualifiers (as long as they share the same left-hand side). But I haven't been able to come up with a good syntax to support that in the language. So the solution is indeed to use case or if-then-else in such situations instead. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |