Timeline for Vigenere cipher exercise in Haskell
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 25, 2017 at 12:14 | history | edited | Zeta | CC BY-SA 3.0 |
herp derp, switched lines
|
Apr 25, 2017 at 10:28 | vote | accept | razvanc | ||
Apr 25, 2017 at 10:28 | comment | added | razvanc |
Nice explanation! I got some time to go over this again. You've got a bug :) cryptZip' f (k:ks) ms should switch places with cryptZip' f ks ms . Actually my initial complexity stemmed from the fact that I didn't know (still don't know a bunch of) about cycle & other useful functions & the fact that I wanted to use shift generically so I can unShift just by providing the 'inverse'. With shift :: Int -> Char -> Maybe Char you could just negate the first parameter for unShift . But I do like generics and your answer is definitely the one :). Thanks for your time!
|
|
Apr 24, 2017 at 16:26 | comment | added | razvanc | Let us continue this discussion in chat. | |
Apr 24, 2017 at 16:21 | comment | added | Zeta | In that case, feel free to add beginner to your question. | |
Apr 24, 2017 at 16:20 | comment | added | razvanc | Well I'm not entitled to say it since I'm such a n00b at Haskell but I do get that feeling, yes :) | |
Apr 24, 2017 at 16:18 | comment | added | Zeta | By the way, I wouldn't call Gurkenglas' second solution best practice. It's clever, but rather obfuscated. | |
Apr 24, 2017 at 16:16 | comment | added | razvanc | I'll have to go over your solution again and process it slower :) to fully get the ins-&-outs of it. Thanks for your time :). | |
Apr 24, 2017 at 16:13 | comment | added | Zeta |
@razvanc that's why cryptZip' uses isValid , and the exercise variant uses Char -> Char -> Maybe Char . And yeah, the non-pattern-matching variant is hidden in the exercises in the other question.
|
|
Apr 24, 2017 at 16:12 | history | edited | Zeta | CC BY-SA 3.0 |
added 786 characters in body
|
Apr 24, 2017 at 16:12 | comment | added | razvanc |
I was just about to answer on your other comment :) cause I just went through your other explanation. Only thing I don't like about it really is that pattern matching on ' ' . What if we use TAB or some other symbol? We of course don't want to shift those, that's why I have the zipWith and all that funky !! stuff - which yes, I don't like, but I do like to try reimplementing it with @Gurkenglas' solution to toIdx_ and then I'll just have to experiment some more :). Thanks!
|
|
Apr 24, 2017 at 16:06 | history | answered | Zeta | CC BY-SA 3.0 |