Dear Ashis,

You're right, there is a bug in my code.  But you can rewrite the part that
selects the last 4 characters in a more robust way, like

%% return the last N elements of list L
fun {LastN L N}
   {List.drop L {Max 0 {Length L}-N}}
end

The call to Max ensures that you don't drop anything from the list if its
length is less than or equal to N.  Then the filtering may be fixed:

   OzfFiles = {Filter Files fun {$ F} {LastN F 4}==".ozf" end}

Cheers,
raph

On Thu, Oct 16, 2008 at 11:30 PM, Maity, Ashis K <[EMAIL PROTECTED]>wrote:

>  Raph,
>
>
>
> Thanks so much again. I was able to make my code run barely in some kludge
> using the following snippet before I got your elegant solution. It will
> certainly prove my immaturity in programming in Oz. I am having small
> problem in running your snippet though. I am thinking it is probably
> breaking when file name is less than 4 characters (there are those . and ..
> files in a dir). May be something else. I should be able to debug that
> though (I hope).
>
>
>
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to