[Swift-devel] Join function?

Justin M Wozniak wozniak at mcs.anl.gov
Tue Apr 3 13:57:30 CDT 2012


The existing outline is at:

https://sites.google.com/site/swiftdevel/internals/builtins

 	Justin

On Tue, 3 Apr 2012, Michael Wilde wrote:

> Best way to help is to create a developer note in the swiftdevel site describing what you know about how to do this, with an existing example.
>
> Thanks,
>
> - Mike
>
>
> ----- Original Message -----
>> From: "Jonathan Monette" <jonmon at mcs.anl.gov>
>> To: "Michael Wilde" <wilde at mcs.anl.gov>
>> Cc: "David Kelly" <davidk at ci.uchicago.edu>, "swift-devel at ci.uchicago.edu Devel" <swift-devel at ci.uchicago.edu>
>> Sent: Tuesday, April 3, 2012 1:42:47 PM
>> Subject: Re: [Swift-devel] Join function?
>> I was just looking into how hard it would be to add an @join function
>> to Swift that does what David describes. I do not think it will be too
>> difficult. So if David wants to try I can help if he would like.
>>
>> On Apr 3, 2012, at 1:40 PM, Michael Wilde wrote:
>>
>>> You might be able to write strjoin() as a recursive Swift function.
>>> It would also be a good exercise for you to add it as a new
>>> primitive, David - as we are rather scanty n string and math
>>> functions.
>>>
>>> - Mike
>>>
>>> ----- Original Message -----
>>>> From: "David Kelly" <davidk at ci.uchicago.edu>
>>>> To: "Jonathan Monette" <jonmon at mcs.anl.gov>
>>>> Cc: "swift-devel at ci.uchicago.edu Devel"
>>>> <swift-devel at ci.uchicago.edu>
>>>> Sent: Tuesday, April 3, 2012 1:33:06 PM
>>>> Subject: Re: [Swift-devel] Join function?
>>>> I think that would work, but it requires knowing the number of
>>>> elements.
>>>>
>>>> ----- Original Message -----
>>>>> From: "Jonathan Monette" <jonmon at mcs.anl.gov>
>>>>> To: "David Kelly" <davidk at ci.uchicago.edu>
>>>>> Cc: "swift-devel at ci.uchicago.edu Devel"
>>>>> <swift-devel at ci.uchicago.edu>
>>>>> Sent: Tuesday, April 3, 2012 1:21:32 PM
>>>>> Subject: Re: [Swift-devel] Join function?
>>>>> So @strcat(a[0],":", a[1], ":", a[2], ":", a[3]); does not work?
>>>>> That
>>>>> is the only swift way I can think of to make it work. The only
>>>>> other
>>>>> approach is to use an app call to a perl/python script.
>>>>>
>>>>> On Apr 3, 2012, at 1:02 PM, David Kelly wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Is there a way to concatenate all elements of an array into a
>>>>>> single
>>>>>> string? I would also like to define a separator between elements.
>>>>>> I
>>>>>> was thinking of something similar to Perl's join function.
>>>>>>
>>>>>> If I have:
>>>>>>
>>>>>> string a[];
>>>>>> a[0] = "this";
>>>>>> a[1] = "is";
>>>>>> a[2] = "a";
>>>>>> a[3] = "test";
>>>>>>
>>>>>> How can I get it into "this is a test" or "this:is:a:test"?
>>>>>> @strcat
>>>>>> returns a reference. I can tracef with %q and get
>>>>>> "[this,is,a,test]", but it doesn't give me any control over the
>>>>>> formatting as far as I know.
>>>>>>
>>>>>> I could call a shell script to do this, just wondering if there
>>>>>> was
>>>>>> another way.
>>>>>>
>>>>>> David
>>>>>> _______________________________________________
>>>>>> Swift-devel mailing list
>>>>>> Swift-devel at ci.uchicago.edu
>>>>>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>>>> _______________________________________________
>>>> Swift-devel mailing list
>>>> Swift-devel at ci.uchicago.edu
>>>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>>>
>>> --
>>> Michael Wilde
>>> Computation Institute, University of Chicago
>>> Mathematics and Computer Science Division
>>> Argonne National Laboratory
>>>
>
>

-- 
Justin M Wozniak



More information about the Swift-devel mailing list