[Swift-user] (no subject)
Michael Wilde
wilde at mcs.anl.gov
Wed Jun 3 14:48:21 CDT 2009
Also, I should clarify: the message:
"Compile error in procedure invocation at line 11: Wrong type for
parameter number 0, expected file, got file[]"
is really referring to the expression in the assignment statement
*within* the foreach.
Its complaining that you passed an object of data type "file[]" - i.e.,
"array of file" to a procedure whose corresponding argument was declared
as expecting an object of data type "file" - i.e., a single scalar
object of type "file".
The ability to pass an entire file[] array is a cool feature of Swift,
but not what you wanted to do in this case.
- Mike
On 6/3/09 2:40 PM, Michael Wilde wrote:
> (Erin, please use good subject lines when sending to the list, as it
> makes it easier to manage and find discussion threads)
>
> The line:
>
> foreach ix in frame {
> output[ix] = rotate(frame, 180); output[ix] = rotate(frame, 180);
>
> should be:
>
> foreach ix,i in frame {
> output[i] = rotate(ix, 180);
>
> or the inner statement can be:
> output[i] = rotate(frame[i], 180);
>
> Not sure, but you might be able to use simple_mapper for input mapping
> as well. I'll leave you to experiment with that aspect for now.
>
> - Mike
>
>
> On 6/3/09 2:11 PM, Hodgess, Erin wrote:
>> Hi Swift Users:
>>
>> I'm trying to collect all of the files with the extension ".jpg",
>> rotate them 180 degrees, and produce output of "hoot.xxx.jpeg".
>>
>> here is my swift file and my error message. I've tried lots of things
>> with files and foreach, but I can't make any sense out of this.
>>
>> Any suggestions, please?
>>
>>
>>
>> [erin at tp-login2 swift1]$ cat rot2.swift
>> type file;
>>
>> app (file o) rotate(file s, int angle) {
>> convert "-rotate" angle @filename(s) @filename(o);
>> }
>>
>> file frame[] <filesys_mapper; pattern="*.jpg">;
>> file output[] <simple_mapper;suffix=".jpeg",prefix="hoot.">;
>>
>> foreach ix in frame {
>> output[ix] = rotate(frame, 180);
>> } [erin at tp-login2 swift1]$
>> [erin at tp-login2 swift1]$ swift -tc.file tc.data rot2.swift
>> Could not start execution.
>> Compile error in foreach statement at line 10: Compile error
>> in procedure invocation at line 11: Wrong type for parameter number 0,
>> expected file, got file[]
>>
>>
>> Thanks,
>> Erin
>>
>> Erin M. Hodgess, PhD
>> Associate Professor
>> Department of Computer and Mathematical Sciences
>> University of Houston - Downtown
>> mailto: hodgesse at uhd.edu
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Swift-user mailing list
>> Swift-user at ci.uchicago.edu
>> http://mail.ci.uchicago.edu/mailman/listinfo/swift-user
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-user
More information about the Swift-user
mailing list