Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
Understood. Sent from Outlook Mobile On Tue, Dec 15, 2015 at 2:19 PM -0800, "Kelly Keenan" wrote: Hi Gage, I’d like to invite you to read through our Code of Conduct for the Swift community. While something may seem like a joke to you, it

Re: [swift-users] Swift BMI

2015-12-15 Thread Kelly Keenan via swift-users
Hi Gage, I’d like to invite you to read through our Code of Conduct for the Swift community. While something may seem like a joke to you, it is not always the case for everyone. Please be mindful of this in the code that you write as well as the c

Re: [swift-users] Using Swift for interpreted shell scripts?

2015-12-15 Thread John Regner via swift-users
Check out this talk from Ayaka on just this topic! https://realm.io/news/swift-scripting/ > On Dec 15, 2015, at 12:37 PM, @lbutlr via swift-users > wrote: > >> On Dec 15, 2015, at 1:28 PM, Jens Alfke wrote: >> Swift doesn’t seem like a good fit for the kinds of tasks people write >> shell-sc

Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
Also, another goal of doing it was to see if I could using a class. Which worked. I apologize for the delay, apparently as a Junior our HS does not trust us with EMAIL which of all things kids probably don't use for messaging. Sent from Outlook Mobile On Tue, Dec 15, 2015 at 12:35 PM -0800,

Re: [swift-users] Using Swift for interpreted shell scripts?

2015-12-15 Thread @lbutlr via swift-users
On Dec 15, 2015, at 1:28 PM, Jens Alfke wrote: > Swift doesn’t seem like a good fit for the kinds of tasks people write > shell-scripts for. It’s a system/app programming language, like C/C++. > Scripting languages have extremely dynamic typing, super-high-level APIs, and > no separate compile/

Re: [swift-users] Swift BMI

2015-12-15 Thread Gage Morgan via swift-users
I understand that mine is a bit more complicated than it needs to be. It works, that's good enough for me. It gives proper values. I knew SOMEONE would have an issue with the "breaking machine," and I realized it could not be reached before typing it. I put it in there as a joke, nothing more (I

Re: [swift-users] Using Swift for interpreted shell scripts?

2015-12-15 Thread Jens Alfke via swift-users
Swift doesn’t seem like a good fit for the kinds of tasks people write shell-scripts for. It’s a system/app programming language, like C/C++. Scripting languages have extremely dynamic typing, super-high-level APIs, and no separate compile/link stage. There’s no reason you couldn’t convert some

Re: [swift-users] Using Swift for interpreted shell scripts?

2015-12-15 Thread Erica Sadun via swift-users
I've given up on it. I find it far easier to just write a command-line app with Xcode's source support -- E > On Dec 15, 2015, at 12:45 PM, @lbutlr via swift-users > wrote: > > Are there any resources on using swift for shell scripting? > > I’m interested in trying my hand at Swift by convert

[swift-users] Using Swift for interpreted shell scripts?

2015-12-15 Thread @lbutlr via swift-users
Are there any resources on using swift for shell scripting? I’m interested in trying my hand at Swift by converting existing bash scripts into swift since bash is mostly what I am writing currently, so I figure this will at least get me started with syntax and such. ZZ -- The Steve is seen, r

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
And, of course, this is a perfect opportunity to use Swift tuple returns and eliminate the side-effect of printing the numeric value: http://swiftstub.com/176972405 -- E, whose kids have a snow day this morning in case you can't tell > On Dec 15, 2015, at 7:20 AM, Erica Sadun wrote: > > In f

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
In fact, there's no really good reason to use any construct, whether struct, class, or enum, for this at all since the BMI isn't a "thing" per se. A global function might be a better fit. http://swiftstub.com/443052056 -- E > On Dec 15, 2015, at 7:10 AM, Eimantas Vaiciunas via swift-users >

Re: [swift-users] Swift BMI

2015-12-15 Thread Eimantas Vaiciunas via swift-users
I exchanged a class to an enum since the BMI values are a finite set. This eliminates a need for valid value check since the switch that is used to initialise the enum value is exhaustive. http://swiftstub.com/242291010/ On Tue, Dec 15, 2015 at 3:30 PM, Erica Sadun via swift-users < swift-users@s

Re: [swift-users] For loop question?

2015-12-15 Thread Erica Sadun via swift-users
Let me add that stride offers two variations: "to" and "through", which you can see here: http://swiftstub.com/102043338 The to variation documentation states: /// Return the sequence of values (`self`, `self + stride`, `self + /// stride + stride`, ... *last*) where *last* is the last

Re: [swift-users] Swift BMI

2015-12-15 Thread Erica Sadun via swift-users
Leaving aside typos, any discussion about the merits of BMI, and the intemperate language in the code, you do a few things that could be improved upon language-wise. Of these, the most egregious is the final "break the machine" else statement that can never be reached. The following example doe

Re: [swift-users] Here's a multi-platform OpenGL loader for Swift.

2015-12-15 Thread David Turnbull via swift-users
On Mon, Dec 14, 2015 at 9:22 AM, Joe Groff wrote: > I think the unsafeBitCast is fundamentally necessary here > It's all generated code from a canonical XML source so really not at all unsafe. Certainly no more unsafe than fixing up a C header file that doesn't quite work with Swift. -david (ht

Re: [swift-users] memory requirements for building swift on linux?

2015-12-15 Thread Luca Finzi Contini via swift-users
Hi, I have tried to build the swift ecosystem on an Ubuntu 15.10 machine loaded with 16GB of RAM and 16GB of swap space. What happens is that if you run the "utils/build-script -t" command as suggested, this will use all processors available to speedup the build BUT it will also try to perform para

Re: [swift-users] For loop question?

2015-12-15 Thread Jacob Bandes-Storch via swift-users
You can use `stride`: for i in 0.stride(to: 10, by: 2) { print("i is \(i)") } On Tue, Dec 15, 2015 at 12:08 AM, Eirny Kwon via swift-users < swift-users@swift.org> wrote: > for loop is working > > for var i = 0; i < 10; i += 2 { > > print("i is \(i)") > > } > > > On December 15, 2015 at

Re: [swift-users] For loop question?

2015-12-15 Thread Eirny Kwon via swift-users
for loop is working for var i = 0; i < 10; i += 2 {     print("i is \(i)") } On December 15, 2015 at 5:05:41 PM, cooper liu via swift-users (swift-users@swift.org) wrote: Hi, If the c style for loop was removed,how to implement the following code beautifully: For(var i=0; i < 10; i+=2) Since t

[swift-users] For loop question?

2015-12-15 Thread cooper liu via swift-users
Hi,If the c style for loop was removed,how to implement the following code beautifully:For(var i=0; i < 10; i+=2)Since the range operator ... doesn't support step other than 1, and it doesn't support end value < start value. Thanks! ___ swift-users mai