Mitch Schwartz

Realm of Existence

Age: 31

Apr
26
comment Watson-Crick palindromes
Or maybe this plays better to the intuition: Would you expect 1 + 5.div 3 to be valid syntax? It is comparable to s == s.reverse.tr 'ACGT','TGCA' (notice where I added spaces).
Apr
26
comment Watson-Crick palindromes
Parentheses after a method call (here we are looking at tr) can only be omitted under certain circumstances. Maybe it would help you to consider why 1.==1 && 2==2 is valid syntax (and evaluates to false) while 1==1 && 2.==2 is a syntax error. I don't claim to have deep knowledge of Ruby parsing, but I also don't think that it is very surprising or strange in this case. Informally, I'd say you can omit the parentheses when (1) the method is being called without arguments, or (2) the method is not "in the middle" of an expression that could have things to the right of it.
Apr
26
comment Watson-Crick palindromes
You suspected correctly. :) It's just a plain old method call.
Apr
26
comment Watson-Crick palindromes
Do the true and false values need to be "consistent"? I.e., only one true output and only one false output. (As opposed to e.g. returning the input string for true, and nil for false.)
Apr
26
comment Watson-Crick palindromes
Are you sure you don't want to figure it out on your own?
Apr
25
comment Watson-Crick palindromes
->s{s.==s.reverse.tr'ACGT','TGCA'} is a byte shorter
Apr
2
awarded Constituent
Mar
30
awarded Caucus
Mar
1
revised Highly composite numbers
added 8 characters in body
Mar
1
revised Highly composite numbers
added 9 characters in body
Mar
1
revised Highly composite numbers
deleted 229 characters in body
Mar
1
revised Highly composite numbers
added 8 characters in body
Mar
1
revised Highly composite numbers
deleted 110 characters in body
Mar
1
revised Highly composite numbers
[Edit removed during grace period]
Mar
1
answered Highly composite numbers
Feb
22
awarded Critic
Jan
16
awarded Nice Answer
Jan
12
awarded Critic
Jan
12
comment An optimization version of the Hadamard problem
@Lembik If I had an idea, I would have written it in the answer.
Jan
3
comment Golf you a quine for great good!
(Put another way, the 394-byte program ending with \xe2\x86\x92 is not a quine, but it prints the 392-byte quine ending with \x1a.)
1 2 3 4 5