drKreso

- friends
390 link karma
43 comment karma
send messageredditor for
what's this?

TROPHY CASE


  • One-Year Club

    Verified Email

One angle on why it's useful to write tests. (classical link bait) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

I found the "compile-time" safety to be false guard. I rarely get bugs for showing string in the middle of calculation. Logical errors OTOH are much more frequent. Maybe in Haskell it means more, but for .NET or Java it's just false sense of security if you ask me. As for tests I think they help out for 1. designing the classes 2. someone elses code 3. your code after 3 months 4. hard code that needs changing, but a lot depends on it (you have coded documentation for it in the form of runnable tests, do you don't need to remember it all)

One angle on why it's useful to write tests. (classical link bait) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

I am not sure I understand. (As for unit testing it's Kent Beck/Smalltalk stuff. Ruby has a lot of Alan Kays ideas from Smalltalk so I think culturally it's a good fit.)

What to test? by drKresoin programming

[–]drKreso[S] 1 point2 points ago

LOL, I bet you have some war stories to back this up... maybe even like this http://www.youtube.com/watch?v=kYUrqdUyEpI

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

In Ruby block is not list comprehension as far as I understand it. Monads - I wish I could understand them :) I did try with limited success on linq but it is still a big ball of mud in my head (Trying to read practical haskell also... a sad story of a man (me) vs. technology :))

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

In a lot of common cases, list comprehensions will look better/similar to Ruby. There’s one problem: List comprehensions are a special-purpose feature, and you can’t use the same mechanisms for building your own domain languages(for instance RSpec).

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 1 point2 points ago

lol

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 1 point2 points ago

I didn't know I could do that ;)

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 1 point2 points ago

It is not just the functional part it is the whole look&feel that I like. This is highly personal of course. I would also qualify Cojure (or any Lisp) for a real functional programming without th erm... interesting syntactic choices. Actually CL has no syntactic choices, it is the syntax-sugar-less and simple :)

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 2 points3 points ago

Wow, thanks for the answer I make sure to check this out. Thanks for the insights.

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 1 point2 points ago

It is kind of messy I agree. It took me a while to get it. Lambda procs and Procs procs are subtlely different. Generaly I think you always use lambda (1.9 has -> literal) because it behaves "nicer", and Proc is left for legacy reasons. Block is "uninitialized" Proc so not many surprises there.... All in all it's it not perfect by any means, but language is rather nice.

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 1 point2 points ago

Thanks. It is explicit, I have to give you that. Colleague of mine is hard-core Pytonista. I have a mixed feelings, but it does seem pragmatic. One thing that he likes about Ruby are blocks, and all-around better support for anonymous functions.

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

List comprehension to the rescue... could you post an example with something more complex. I suppose you need function if its more that one row?

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 2 points3 points ago

I would love to see some code/hear experiences. Lisp is intimidating me, but Clojure seems like a syntax-sugared enough version :)

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 0 points1 point ago

Literal for list in Ruby is same as the Python, except there is no distinction between tuple and list, so I actually find Ruby approach tiny bit simpler.

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 2 points3 points ago

Wow, this looks intimidating :) It think perl has some baggage along with the indisputable power.

Small Example of Ruby Elegance (for Non Rubists) by drKresoin programming

[–]drKreso[S] 5 points6 points ago

Clojure is good stuff!

view more: next