@MyWrathAcademia you have to write a full program (i.e. the class, static void Main, reading input & calling the function). (for aesthetics, you can use the header/footer; the code run in the end is just the concatenation of the three); also, unless in is some special thing in C#, your answer must either be a function/lambda taking the input as an argument, or read it from stdin by itself
But I still can't get the code to run successfully.
I'm not sure what the following means:
> also, unless in is some special thing in C#, your answer must either be a function/lambda taking the input as an argument, or read it from stdin by itself
i think this should work, but it seems to output nothing: https://tio.run/##bZFda8IwFIbv@ysOhdEEXXC4i7FOYZMpMmEDhV2UXnT1tA3WxJ1Ei5T@dpd27APxMuc575O8JDXXqZGnvZEqh@XRWNyG3v@TmOiyxNRKrYyYoUKS6dnGQqrPs9H8NfQeu9CDseRAFI8hUzCCkxyNpZiR3u@ejoyVfDSuCe2eFJRiuSulZQEEPBrEYcPFSi@ksYyLqabnJC0Yy9tAdxc7JASmck6FFSwtYbJ9J2mRWC5e8ChWJLesZWmRUBTXQRT0gzhoeM8Xpc59zutMu5TTtqoDSAU5N5XoLK4VsgMPm4afQi9TnemnTO1HFSa2QIphsidCZcH13t3D3XDq9z0/@khog7iLYSpNAY4jGXDDC1DTuoOI39RYnW627YqN4W0OvaG4ub2QKzE54J/090G3g6u2skoRdAaUuFprtO4Pce03PDx9AQ
@MyWrathAcademia they should be just where you wrote them. but Console.WriteLine(File.ReadAllLines("barkeep.log")); doesn't seem to output anything either
i'm stupid, foreach (var c in File.ReadAllLines("barkeep.log")) Console.WriteLine(c); works. i don't know C# much :/
@MyWrathAcademia you do need to use a lambda (as i did - i=>i.GroupBy…) by CGCCs rules
so something like this: https://tio.run/##bZBPSwMxEMXv/RRDQDahNSh6EGsLKlZED6KCh2UPMZ1ug7tJmaQtsuxnr8la/xR7zLx5vzcv2h9qbzaXOhhnL3wgY8u8GMPMwgg2ZjQ28pbccnH1wXklRuOGMCzJQiWfF5UJPINM5EfFsBXyxT0YH7iQE0c3Ss85L5Nh6SOSrxSBX0emxTU8B0JVv5IJSLyU9/ghX8jUPGl6rigvmizPBlmRtaLPZOVKJkQzc9EVsQm1AmOhFH4tO8qDschXYti2YjPszWxH@i7TsHyNKsyRCrheEqENELBenMPZyYQNeix/U/SOuChgYvwcoo7kIQ73iI6mnYj4pfrg9HudVkIBj3fQP5HHp3t8FaoV/kJ/Djo9OkiVrUZwMyAVa00xoA44Za2IXb5KQ9faqhpT8d1226DumwbA/lz0Pdqmdc9WQNMDuHbWuwr/fF@C99k5i6EAO7E6ZU5M3H5CNb2sqrTvO4MQe0i6Q/yfx3G7@QQ
@dzaima Yes everything works, thanks a lot. Today is my first time doing a challenge on code golf, what are these rules? Are you saying that code gulf will not accept the following solution?
input.GroupBy((l)=>{return l.Split(' ')[0];}).ToList().ForEach((g)=>{using(var sw = new StreamWriter(g.Key.Trim(new char[]{'[',']'})+".log")){foreach(var v in g)sw.WriteLine(v);}});
Does expect the input to be stored in the input variable.
Much better, @dzaima thanks
@dzaima your correction is a lambda expression:
i=>i.GroupBy((l)=>{return l.Split(' ')[0];}).ToList().ForEach((g)=>{using(var sw = new StreamWriter(g.Key.Trim(new char[]{'[',']'})+".log")){foreach(var v in g)sw.WriteLine(v);}})
@dzaima So this is acceptable for a code golf answer?
@MyWrathAcademia Java, JS, ±Python, APL (+ my 2 golflangs) but i've stopped mostly golfing/participating in SE (also TNB is a better place for discussion)