« first day (1951 days earlier)      last day (2896 days later) » 

8:01 PM
language design: What if I make it so that iteration is done through Node objects, instead of a global object that changes state?
T getNext() (where T is the type of the current class)
 
@TimmyD "E-I-A-O"
What is System of a Down?
 
System of a Down, sometimes shortened to SOAD or System, is a four-piece Armenian American rock band formed in 1994 in Glendale, California, in the United States. The band currently consists of Serj Tankian (lead vocals, keyboards), Daron Malakian (vocals, guitar), Shavo Odadjian (bass, backing vocals) and John Dolmayan (drums). The band achieved commercial success with the release of five studio albums, three of which debuted at number one on the Billboard 200. System of a Down has been nominated for four Grammy Awards, and their song "B.Y.O.B." won the Best Hard Rock Performance of 2006. The...
 
Nu metal band
 
@TimmyD but but lmgtfy?
 
8:04 PM
@EᴀsᴛᴇʀʟʏIʀᴋ definitely one of the better anagrams I've seen so far :)
 
@MartinEnder are you ever changing your name to an anagram?
 
@El'endiaStarman @PhiNotPi see my above question
 
@EᴀsᴛᴇʀʟʏIʀᴋ no.
 
8:04 PM
why not?
 
0
Q: Scoring tables in Desmos

weatherman115There is not a way to copy-paste tables in Desmos & one of my golfs require a table. How should we score tables?

 
@EᴀsᴛᴇʀʟʏIʀᴋ Eh, it was faster to "wiki soad" and copy-paste
 
@EᴀsᴛᴇʀʟʏIʀᴋ Pro tip: don't use LMGTFY. Link to google directly, like google.com/search?q=Stack+Exchange.
 
@TimmyD okay
@zʏᴀʙiɴ101 no. I wanted to be annoying. teach you.
 
@NathanMerrill How would this work in practice? You still have to have a loop of some kind.
 
8:05 PM
@EᴀsᴛᴇʀʟʏIʀᴋ why would I?
 
@MartinEnder Why not?
And funness.
And to cement your status as the second nicest mod.
 
@El'endiaStarman right, the loop would simply call "getNext()" on the current object to get the next object
 
@EᴀsᴛᴇʀʟʏIʀᴋ Would you like to see the finished product of my memery?
 
> second nicest
ouch
 
8:06 PM
@VTCAKAVSMoACE YUSS. Sorry, read memery as memory.
 
a potential advantage I see is that iterators can be copied nicely
 
@TimmyD Do you doubt Alex is the nicest mod?
 
I think Alex may be the most fun, but I'd definitely peg Martin as nicest.
 
so, if I want two iterators at the same position, I simply store two variables
 
@EᴀsᴛᴇʀʟʏIʀᴋ I only understand you as wanting to be annoying. :P
 
8:07 PM
@TimmyD okay.
 
@TimmyD ouch @Dennis, @Doorknob
 
You don't need to ping doorknob. He is always here.
 
@EᴀsᴛᴇʀʟʏIʀᴋ wings.io
or slither.io
 
8:10 PM
Chat mini-challenge: Given an ASCII printable character as input, output (its char code) * (the digit sum of its char-code). Example, for input A, output 715 (65 * (6+5))
 
@ev3commander same
 
PowerShell, 49 bytes -- ($b=+[char]$args[0])*(([char[]]"$b")-join'+'|iex)
@MartinEnder Well, someone has to be best, and it might as well be the mod currently active in the room you. :D
 
;)
CJam, 9: rci_Ab1b*
 
@El'endiaStarman does that make sense?
 
8:12 PM
yup
 
@NathanMerrill I guess so, yeah.
 
o_O @AlexA. @Dennis why does int(6) = 54 in julia?
 
do you not like it?
 
@VTCAKAVSMoACE Now posted on /r/aSongOfMemesAndRage
 
@TimmyD Julia, 44 36 bytes: n->n*(parse("$n"[1])+parse("$n"[2]))
 
8:14 PM
pyke, 6 bytes .oisi*
 
@EᴀsᴛᴇʀʟʏIʀᴋ Don't use int.
 
Crossed out 44 was unintentional.
 
What version are you using?
 
@AlexA. yeah, figured that out.
@AlexA. the latest one?
 
You should be at least on 0.4.5
 
8:15 PM
yeah, on that
 
int is deprecated in 0.4
 
ohhh int = charpoint?
 
No
 
oh
well parseint is also deprecated
 
anyone recommend a minecraft twitch?
 
8:15 PM
Also don't use parseint
 
I was just thinking that it might be annoying to have to do .getNext() every time, but I think that's true of a lot of other things you're doing in your language, so eh. :P
 
@AlexA. golfiest string to int?
 
parse if the string contains only digits
 
@El'endiaStarman don't you have to do that with normal iterators?
 
Julia, 44 36 bytes: n->n*(parse("$n"[1])+parse("$n"[2]))
@AlexA. any tips?
 
8:16 PM
while(iter.hasNext()){
    obj = iter.getNext()
}
vs
 
@EᴀsᴛᴇʀʟʏIʀᴋ How does that work for 3-digit ASCII code points?
 
Supposed to be n*digitsum(n)
 
while(obj.hasNext()){
   obj = obj.getNext()
}
 
If the code point is 197, your code won't work
 
8:18 PM
Scratch that, n->n*(parseint("$n"[1])+parseint("$n"[2])). Back to 42.
 
@EᴀsᴛᴇʀʟʏIʀᴋ wings.io username?
 
Still doesn't work for >2 digits in the codepoint
 
no account @ev3commander
@AlexA. yeah working on it
 
@NathanMerrill It's relatively rare to have to do it manually in Python. for x in iterator: does iterator.next() for you and breaks on StopIteration.
 
right
 
8:19 PM
i mean nickname
 
I'd have a foreach that would automatically do that for you
 
@ev3commander Riker generally
 
but, if you wanted an iterator object (which you occasionally need), it'd work differently
 
play?
 
sing?
 
8:20 PM
@TimmyD Julia, 27 bytes: c->(i=Int(c))sum(digits(i))
 
Its annoying for me to edit cuz my up arrow key is broken
 
@MartinEnder What does A do? I can't seem to find it on the CJam wiki.
 
Takes a Char
 
@TimmyD it's a predefined variable with value 10
 
@AlexA. damnit
I give up.
 
@MartinEnder Ah, that would be why it's not on the operators page. :D
 
@NathanMerrill Sure, then. Iterators in Pytek will behave similarly too, where you can duplicate them and they don't get exhausted.
 
lower case: operators, upper case: variables
 
@El'endiaStarman pytek iterators will be immutable, then?
 
@NathanMerrill I dunno yet but it'll be a safer bet that they'll be mutable.
 
8:23 PM
well, if they are mutable, then to duplicate them, you'll need to have some sort of clone function
 
Of course. That'll be built-in.
Hmm. It'd be nice to have a dedicated clone operator...maybe something like :=...
 
also, something else to chew on: with immutable iterators, you can modify a list mid iteration. I'm not sure if its a good idea right now, but it does make it possible
at least, with a linked list
with a standard list, its harder
 
@muddyfish Pyke wins
 
yay
 
At least until Jelly comes in with a 2 byte answer
 
8:26 PM
Well, my Pytek interpreter actually has a place where modifying a list mid-iteration is really useful. The modification is an element inserted just ahead of the current element.
 
and most of it was padding anyway. If it was done nicely it would be .oDs*
bye guys!
 
so, its a generator?
 
Err, no it isn't? I'm trying to find the code now.
 
ok, another side question: for iterators, does it make more sense to have a hasNext(), or to have an Optional<T> getNext()?
 
Wow, TIO has radically expanded the number of available languages since I last looked at it.
 
8:31 PM
@TimmyD ssshhhh
@TimmyD yeah. The Julia online is quite helpful.
 
def pPrint(self, opts=[],args=[],code=[],symbols={}):
    output = []

    for k, arg in enumerate(args):
        if "_str_" in dir(arg):
            output.append(arg._str_())
        elif arg.name.startswith("Variable"):
            args.insert(k+1, symbols[-1][arg.id])
        else:
            output.append(str(arg))

    outstr = ' '.join(output)
    osPrint(outstr)
    return po.pString(outstr)
 
@EᴀsᴛᴇʀʟʏIʀᴋ int(6) is 6, but int('6') is 54 (code point of '6').
 
That's the current print function. When I encounter a variable name, I sneakily insert its value into the args list.
 
doesn't that throw an exception?
 
8:38 PM
Nope, it works. :P
 
how does enumerate() not throw a concurrent modification exception?
 
I'll bet enumerate() is a generator. Lemme check.
>>> L = [5, 4, 3, 2, 1]
>>> enumerate(L)
<enumerate object at 0x0354A9E0>
>>> list(enumerate(L))
[(0, 5), (1, 4), (2, 3), (3, 2), (4, 1)]
 
it is, but it should be storing an iterator
huh:
22
Q: Python: Adding element to list while iterating

WesDecI know that it is not allowed to remove elements while iterating a list, but is it allowed to add elements to a python list while iterating. Here is an example: for a in myarr: if somecond(a): myarr.append(newObj()) I have tried this in my code and it seems to works fine, h...

 
A list isn't an iterator, it's an iterable.
 
the OP apparently says that it works
 
8:42 PM
And also, I'm pretty sure I've removed elements while iterating.
>>> L = list(range(10))
>>> for x in L:
	print(x)
	L.remove(x)


0
2
4
6
8
>>> L
[1, 3, 5, 7, 9]
>>> L = list(range(10))
>>> for x in L:
	print(x)
	L.remove(x+1)


0
2
4
6
8
>>> L
[0, 2, 4, 6, 8]
 
woah, iterators are magic
hmm, you can't do it with dictionaries
 
PS C:\Tools\Scripts>  [System.Collections.ArrayList]$a=0..9;foreach($x in $a){$x;$a.Remove($x)}
0
Collection was modified; enumeration operation may not execute.
 
you can update the value of a dictionary
 
:(
 
but if you add/remove from a dictionary, it says "dictionary changed size"
 
8:48 PM
Any suggestions for being less bored?
 
> “I’m bored’ is a useless thing to say. I mean, you live in a great, big, vast world that you’ve seen none percent of. Even the inside of your own mind is endless; it goes on forever, inwardly, do you understand? The fact that you’re alive is amazing, so you don’t get to say ‘I’m bored.” -- Louis C.K.
4
 
@NathanMerrill I'll bet that has something to do with the unorderedness of dictionaries.
 
@LegionMammal978 stop building a giant road
 
sets will likely do it as well
 
8:50 PM
'sup bro
 
@TimmyD Well, too bad, it's called human psychology
 
Yeah, I know.
:D
 
@ev3commander 'sup bro
 
@LegionMammal978 I've posted a couple mini-challenges recently. You could try your hand at those.
 
@EᴀsᴛᴇʀʟʏIʀᴋ Currently trying that (for now); still not working :|
 
8:52 PM
@TimmyD I'm bored
 
@ev3commander Hi bored, I'm TimmyD.
 
@NathanMerrill: Strings don't seem to do either.
>>> S = "hello"
>>> for i, s in enumerate(S):
	print(i,s)
	S += s


0 h
1 e
2 l
3 l
4 o
>>> S
'hellohello'
 
maybe it calls len() on string at the beginning?
 
@LegionMammal978 lmao
Do you play TF2?
 
and then getitem() until it hits the original length?
 
8:54 PM
@EᴀsᴛᴇʀʟʏIʀᴋ Yeah, but I'd have to reboot to play it
 
I think it's that strings are immutable, so when you do S += s, what actually happens is that S gets copied and a new string is stored in S, which is not what's being iterated over.
 
unless string has its own __iter__ impl?
 
^ I found that this morning.
 
?
just checking how big it was in chat
 
8:55 PM
list of io games?
 
ok, I looked, "".__iter__ is defined
but it basically acts like the default iter() implementation anyways
 
@TimmyD Mathematica, 20 bytes: (#-#^(2#2+1))/(#+1)&
@TimmyD K did that
 
(you can iterate over anything that has __getitem__ and __len__)
oh, duh, I know why
 
@LegionMammal978 That's one. I also did a char one, and one that I wound up sandboxing.
 
8:59 PM
because strings are immutable
@El'endiaStarman ^
 
Time to go home :]
 
@Bálint good idea, proposal is way too broad though.
Play TF2 @Poke!
 
Do you mean Overwatch
 
9:14 PM
Can people go and down vote this post? It's incorrect severely.
 
@Poke no
@VTCAKAVSMoACE how?
 
@EᴀsᴛᴇʀʟʏIʀᴋ Compare the figures in the post to the output of that answer.
It's off by .06 for all values.
 
oh yeah
Bye to 1 internet point.
He loses 2 though.
 
For some reason, I can't down vote. .-.
 
Try refreshing.
Happens to me all the time. Literally every day.
 
9:27 PM
what would you do if you were a cow
moo?
 
9:43 PM
monring
 
@El'endiaStarman wizzwizz is mod too
@Quill afternoon
 
Should I flag an answer that does not properly meet the challenge reqs as "not an answer", "very low quality", or not?
 
Very low quality flags are essentially useless. Use NAA or a custom flag reason.
 
10:02 PM
Can mods see who flagged what?
 
@Adnan yes, site mods can see the author of every site flag, and any mod can see the author of any chat flag
 
@Adnan Yes.
 
okay thanks
 
@MartinEnder heh, thanks
 
10:06 PM
@VTCAKAVSMoACE I wouldn't flag it just yet. Current consensus is to give the poster some time to either fix or self-delete his post.
 
@Dennis It's been an hour and I might've already flagged it. >.>
 
@VTCAKAVSMoACE that's alright, the moderators don't need to act immediately on flags... they can give it some time to ferment :p
 
@Dennis TIL that you have won bitcoins on this site haha.
 
@Adnan I guess that makes me a professional coder. :P
 
s/a professional coder/on the government's watch list/
 
10:17 PM
I guess the question is which government's.
 
The Stack Exchange government.
 
Are there sites where you can win code golf prizes?
 
@Adnan Yeah, in anagol you win a place on the leaderboard
 
10:34 PM
@Adnan If you find out how to turn code golfing skills into cash, please let me know.
 
they have tournaments
 
@Dennis Hahaha, will do
 
Any input on this, especially the question at the top?
 
10:47 PM
@Dennis I've seen some challenge which have added "builtins that trivialize the problem are disallowed".
Maybe that's an option.
 
I really want to avoid banning certain capabilities. If I just ban the built-in, someone will subtract the additive inverse. And I don't really want to place restrictions on vectorization. That will be even messier...
 
user image
2
It's some ROM ^
 
It's weird if you want to ban certain builtins
I think the best is to allow everything, but make the Jelly answer non-competing.
The problem is that if another language has the same builtin, it won't be non-competing.
 
M does. Do you know any other language that works like this?
 
Just to confirm, for anonymous functions, do they have to be named? This Nial solution defines op\{$is/[+,tally];^is$*[pass,pass];[1/$(1/),exp$ln,$,sqrt^,/[^,$]]\}, but that is just an operator body. You'd have to assign it a name (e.g. R is op\{$is/[+,t... etc.) to call it (R 1 2 3 4 5).
 
10:58 PM
No, they don't have to be named.
25
A: Should function literals be allowed when a function is asked for?

xfixThis is obviously a named function. def g(h): return h * 2 However, not all functions are named. This is an anonymous function, which is still a function. lambda h: h * 2 You may easily notice that you can assign the function. g = lambda h: h * 2 However, even without this, the functio...

 
@Dennis Not that I know of.
 
@Dennis Hm. So would e.g. (int a, int b)=>a+b; be a valid submission for C#?
 
Probably. I don't see sharp.
 
Huh, still first place?
Also, congrats!
 
11:06 PM
Hahahahahaha
get rekt
 
Honestly surprised, because I have been comparatively inactive lately.
 
Chat mini challenge: given a list of positive integers (with duplicates), output the most frequent integer.
E.g. [1, 2, 3, 4, 5, 3] > 3
(and there is only one most frequent integer)
 
Probably beatable, but I like the approach. Jelly, 8 bytes: œ-Q$ÐĿFṪ
 
Nice :)
 
Less interesting, but shorter. Jelly, 7 bytes: ðċЀMṪị
 
11:17 PM
Pyth: h.M/QZ for 6
 
I wanted to post this on main, but I'm worried if it's to trivial or not.
 
Ruby: ->a{a.max_by{|x|a.count x}}
 
20
Q: Mode (most common element) of a list

garg10mayWrite a snippet to calculate the mode (most common number) of a list of positive integers. For example, the mode of d = [4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8] is 1, because it occurs the maximum of 5 times. You may assume that the list is stored in a variable such as d and has a unique m...

 
Oh :(
 
Ah, I see Martin posted the same Ruby solution with different variable names. :P
 
11:21 PM
Can't the Octave/Matlab answer be shortend to mode?
or isn't that allowed
 
11:33 PM
I'm no Octave expert, but I don't think mode evaluate to a function.
Assuming the question even allows functions (it asks for snippets and predates our defaults), @mode should work.
Left a comment.
 
11:52 PM
That might be the best thing to do.
 
On the answer, I mean. The OP accepted an unnamed function, so I guess they're fine.
 
Oh
Yeah, that won't be a problem then.
 

« first day (1951 days earlier)      last day (2896 days later) »