Yeah, that version is considerably more concise as well. My version is the
"how you would fix the thing you were trying to do" version :)

On Mon, Nov 7, 2016 at 3:27 PM, Steven G. Johnson <stevenj....@gmail.com>
wrote:

> On Monday, November 7, 2016 at 3:17:54 PM UTC-5, Jacob Yates wrote:
>>
>> I know ^ is an exponent. The whole function is meant to xor strings the
>> strings end up being the variables s and t
>>
>
> By "xor the strings", I think you mean "xor the bytes"?   Note that chr
> and ord in Python only work for ASCII characters, so I guess you are only
> interested in ASCII data?   In that case, I would do:
>
> xorstrings(s::String, t::String) = String(s.data $ t.data)
>
> (requires Julia 0.5).   You will have to think carefully about whether you
> want to handle non-ASCII Unicode strings and what you want to do in that
> case.  (The above code will hande non-ASCII data by xor-ing their UTF-8
> representations.  It's not clear whether this is what you want.)
>

Reply via email to