5 Fixed bug when x == -7
source | link

Swift 2.2, 334342 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -9:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if( a>b){t=a;a=b;b=t};for i in a...b{if( i==7 && a != 7){s.append(k)};s.append(i);if( -i==7) && b != -7{s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift SandboxTest this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -9 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if( a > b){
        t = a
        a = b
        b = t
    }

    for i in a...b{
        if( i == 7 && a != 7){s.append(k)}
        s.append(i)
        if( -i == 7) && b != -7{s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}

Swift 2.2, 334 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -9:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -9 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}

Swift 2.2, 342 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -9:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if a>b{t=a;a=b;b=t};for i in a...b{if i==7 && a != 7{s.append(k)};s.append(i);if -i==7 && b != -7{s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -9 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if a > b{
        t = a
        a = b
        b = t
    }

    for i in a...b{
        if i == 7 && a != 7{s.append(k)}
        s.append(i)
        if -i == 7 && b != -7{s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}
4 But that if statement does nothing....
source | link

Swift 2.2, 358334 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -119:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};if -a==11{s.append(x)};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift SandboxTest this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -119 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }
    //"a== -11" has to be used instead of "a==-11", so using "-a==11" instead saves a byte
    if -a == 11{s.append(x)}

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}

Swift 2.2, 358 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -11:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};if -a==11{s.append(x)};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -11 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }
    //"a== -11" has to be used instead of "a==-11", so using "-a==11" instead saves a byte
    if -a == 11{s.append(x)}

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}

Swift 2.2, 334 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -9:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift Sandbox

Ungolfed

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -9 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}
    Post Undeleted by Jojodmo
3 added 91 characters in body
source | link

Brb, making this work :)

Swift 32.2, 270358 Bytes

func a(x:String,y:String){var s="";let a=Int(x) ?? (x=="bleen" ?(x==y ? -9:7):-6);if Int(x)==nil{s+="\(x) "};let b=Int(y) ?? (y=="bleen" ?6:-6);for i in a...b{s+=(i==7 && a != 7 ?"bleen \(i) ":(-i==7 ?"\(i) -bleen ":"\(i) "))};if Int(y)==nil&&b>0{s+=y};print(x==y ?x:s)}
func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -11:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};if -a==11{s.append(x)};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift SandboxTest this using IBM's Swift Sandbox

func a(inputOne: String, inputTwo: String){
    var str = ""

    let a = Int(inputOne) ?? (inputOne == "bleen" ? (x == y ? -9 : 7) : -6)
    if Int(inputOne) == nil{
        str+="\(inputOne) "
    }

    let b = Int(inputTwo) ?? (inputTwo == "bleen" ? 6 : -6)

    for i in a...b{
        str+=(
            i == 7 && a != 7 ?
            "bleen \(i) " :
            (
                 -i == 7 ? 
                 "\(i) -bleen " :
                 "\(i) "
            )
        )
    }

    if Int(inputTwo) == nil && b > 0{
        str+=inputTwo
    }

    print(inputOne == inputTwo ? inputOne : str)
}
func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -11 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }
    //"a== -11" has to be used instead of "a==-11", so using "-a==11" instead saves a byte
    if -a == 11{s.append(x)}

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}

Brb, making this work :)

Swift 3, 270 Bytes

func a(x:String,y:String){var s="";let a=Int(x) ?? (x=="bleen" ?(x==y ? -9:7):-6);if Int(x)==nil{s+="\(x) "};let b=Int(y) ?? (y=="bleen" ?6:-6);for i in a...b{s+=(i==7 && a != 7 ?"bleen \(i) ":(-i==7 ?"\(i) -bleen ":"\(i) "))};if Int(y)==nil&&b>0{s+=y};print(x==y ?x:s)}

Test this using IBM's Swift Sandbox

func a(inputOne: String, inputTwo: String){
    var str = ""

    let a = Int(inputOne) ?? (inputOne == "bleen" ? (x == y ? -9 : 7) : -6)
    if Int(inputOne) == nil{
        str+="\(inputOne) "
    }

    let b = Int(inputTwo) ?? (inputTwo == "bleen" ? 6 : -6)

    for i in a...b{
        str+=(
            i == 7 && a != 7 ?
            "bleen \(i) " :
            (
                 -i == 7 ? 
                 "\(i) -bleen " :
                 "\(i) "
            )
        )
    }

    if Int(inputTwo) == nil && b > 0{
        str+=inputTwo
    }

    print(inputOne == inputTwo ? inputOne : str)
}

Swift 2.2, 358 Bytes

func a(x:String,y:String){var k="bleen",a=Int(x) ?? (x==k ?(x==y ? -11:6):-6),b=Int(y) ?? (y==k ?6:-6),t=0,s=[Any](),f=Int(x)==nil ?x:"";if(a>b){t=a;a=b;b=t};if -a==11{s.append(x)};for i in a...b{if(i==7 && a != 7){s.append(k)};s.append(i);if(-i==7){s.append("-"+k)}};for v in t==0 ?s:s.reverse(){f+=" \(v)"};if Int(y)==nil&&b>0{f+=" \(y)"};print(x==y ?x:f)}

Test this using IBM's Swift Sandbox

func bleen(x: String, y: String){
    var k = "bleen",
        a = Int(x) ?? (x == k ? (x == y ? -11 : 6) : -6),
        b = Int(y) ?? (y == k ? 6: -6),
        t = 0,
        s = [Any](),
        f = Int(x) == nil ? x : ""

    if(a > b){
        t = a
        a = b
        b = t
    }
    //"a== -11" has to be used instead of "a==-11", so using "-a==11" instead saves a byte
    if -a == 11{s.append(x)}

    for i in a...b{
        if(i == 7 && a != 7){s.append(k)}
        s.append(i)
        if(-i == 7){s.append("-" + k)}
    }

    if Int(y) == nil && b > 0{s.append(y)}

    for v in t == 0 ? s : s.reverse(){
        f+="\(v) "
    }

    print(x == y ? x : f)
}
    Post Deleted by Jojodmo
2 added 42 characters in body
source | link
1
source | link