Hmm... I think your code using current syntax is actually clearer than the proposed syntax. I definitely don't like adding meaningful comma given the confusion with items... You could replace that with a semi-colon or new line though.
-- M E R Goulding Software development services mergExt - There's an external for that! On 18/02/2013, at 5:13 PM, Geoff Canyon <gcan...@gmail.com> wrote: > Here's an interesting real(ish) world example: > http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/ > > The goal is to find the ten most common words in a text file. > > Donald Knuth wrote something in literate code form, in Pascal. The result > was ten pages of code. In the article, Doug McIlroy wrote it in shell > script as: > > 1 tr -cs A-Za-z '\n' |2 tr A-Z a-z |3 sort |4 uniq -c |5 sort -rn > |6 sed ${1}q > > and called out Knuth on his supposedly more clear, ten-page solution. > > It turns out six lines of transcript accomplishes the same thing: > > repeat for each word w in replacetext(url ("file:" & > filePath),"(?i)[^a-z]"," ") > add 1 to c[w] > end repeat > combine c using cr and comma > sort lines of c descending numeric by item 2 of each > put line 1 to 10 of c > > If anyone can do it more elegantly, I'm curious to know how. But in a > language where we can write our own syntax, this seems likely to be > possible: > > put file filePath with all non-alphabetic characters replaced with space > into fileString > for each unique word w in fileString, put w,the count of w & cr after > countList > put the first 10 lines of countList sorted numeric descending by item 2 > > Maybe that's not clearer, but it should be possible. > > > On Thu, Feb 14, 2013 at 4:14 PM, Geoff Canyon <gcan...@gmail.com> wrote: > >> >> On Thu, Feb 14, 2013 at 2:08 PM, Monte Goulding < >> mo...@sweattechnologies.com> wrote: >> >>> In my example I used "each line OF x" rather than "each line IN x". I >>> often get caught on repeat for each line X IN y when I write OF. Could I >>> add OF to the repeat syntax so it didn't matter? It seems natural to me >>> either way. If not then perhaps our syntax should be: >>> >>> trim each line in X >> >> >> The impression I got was that the new language ability would make it >> fairly simple (or at least possible) to allow for either of or in. I'm >> right there with you -- I don't actually code that often anymore, but >> nearly every time I do, I mix up of and in. In my perfect world the >> prepositions would be interchangeable and likely not significant, so of, >> in, through, across, within, and maybe others. >> >> gc > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode