Off Topic > Off Topic

Programming Megathread

Pages: << < (184/241) > >>

Foxscotch:

in other news, wtf

using System;

namespace Program {
  class Program {
    static void Main(String[] args) {
      Console.WriteLine(String.Join(" ", args[0].Split(',').Reverse()));
    }
  }
}

error



using System;
using System.Linq;

namespace Program {
  class Program {
    static void Main(String[] args) {
      Console.WriteLine(String.Join(" ", args[0].Split(',').Reverse()));
    }
  }
}

no error

apparently System.Linq extends the Array class somehow or something. but what if I don't wanna have a using directive? then wtf do I do to get the same functionality
why.......

McJob:

According the MSDN, there are multiple versions of Reverse(); the one that uses Linq is this one:

Enumerable

But there are two other variants:

Arrays
Lists

I am particularly curious as to why args[0].Split(','), which should return a standard character array, is trying to use the Enumerable variant.

Foxscotch:

well,
uh
Array and List don't have Reverse method overrides that take no arguments, so error. IEnumerable's Reverse does, so no error. I don't have any trouble with that, the problem I am having is just with using it, without using using. idk how System.Linq achieves adding those overrides but honestly I don't really care, because I'm never going to try something quite that stupid
presumably Array and List both implement IEnumerable so the method works with the return values there regardless

Ipquarx:

torquescript is weird
so you guys know about Quines?
Well, with an extremely weird little quirk of Torque, making a quine is very easy. 40 characters easy.

%a="aaaaaaaaaa";%a=%a@%a@%a@%a;echo(*0);

If you put that in the console, it'll output that code. If you replace echo with eval, it'll just outright stop responding because it gets stuck in an infinite loop. I have no idea why it works either.

Metario:


--- Quote from: Ipquarx on September 17, 2016, 01:49:23 AM ---torquescript is weird
so you guys know about Quines?
Well, with an extremely weird little quirk of Torque, making a quine is very easy. 40 characters easy.

%a="aaaaaaaaaa";%a=%a@%a@%a@%a;echo(*0);

If you put that in the console, it'll output that code. If you replace echo with eval, it'll just outright stop responding because it gets stuck in an infinite loop. I have no idea why it works either.

--- End quote ---
whaaaaaaaaaaaaaaaaaa

Pages: << < (184/241) > >>

Go to full version