tag:blogger.com,1999:blog-12467669.post464169659023237382..comments2023-04-29T07:23:25.825-04:00Comments on Jay Fields' Thoughts: Readable Clojure Without a Java Equivalent?Jayhttp://www.blogger.com/profile/14491442812573747680noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-12467669.post-30796532694702305862011-03-26T06:58:13.624-04:002011-03-26T06:58:13.624-04:00I don't think of "taking the maximum of n...I don't think of "taking the maximum of new availabity and 0" (whatever permutation). I think "reduce available quantity, but not below zero".<br /><br />def fill_with amount<br /> @available -= amount<br /> if @available < 0<br /> @available = 0<br /> end<br />end<br /><br />When I do that, I suddenly wonder where the overflow goes.Keronoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-12965376600591331702011-03-25T21:39:17.584-04:002011-03-25T21:39:17.584-04:00I'm impressed with Clojure, and have written s...I'm impressed with Clojure, and have written some small things in it, but have yet to really dig in and write something serious in Clojure. But I've been off and on programming in Scheme, CL, and a couple of obscure Lisp dialects for well over 10 years now. I don't find the prefix notation all that unnatural. For some things it is less natural, but for others it is more. Basically, you get used to it. I do find the Clojure pipelining operators hard to read but I imagine that's also something you get used to.<br /><br />I do find a reasonable amount of Lisp unnecessarily hard to read, often for the same reason I find a lot of code written in infix notation hard to read. People don't bundle things up and give them names to the degree I would like. I think that is a larger factor in readability than almost anything else (assuming you aren't doing anything insane.)<br /><br />Anyway, nice post. Thanks!Tagore Smithnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-48767788527921475742011-03-25T06:09:03.076-04:002011-03-25T06:09:03.076-04:00Love this post, especially how you drill into all ...Love this post, especially how you drill into all the different ways to express the quantity-setting example. Thanks!Brian Oxleyhttps://www.blogger.com/profile/06617364377560752378noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-61007161893639954632011-03-25T03:45:45.016-04:002011-03-25T03:45:45.016-04:00Please ignore my previous comment. It's too ea...Please ignore my previous comment. It's too early in the morning here for me to think properly. Great post - thanks for sharingf :-)Chrishttps://www.blogger.com/profile/08701786708024961223noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-61328802423418831882011-03-25T03:43:09.063-04:002011-03-25T03:43:09.063-04:00This comment has been removed by the author.Chrishttps://www.blogger.com/profile/08701786708024961223noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-7518471107789321372011-03-25T02:47:46.778-04:002011-03-25T02:47:46.778-04:00Try ruby ;)
def on_fill(fill_quantity)
@quantit...Try ruby ;)<br /><br />def on_fill(fill_quantity)<br /> @quantity = [@quantity - fill_quantity, 0].max<br />endAnonymousnoreply@blogger.com