_vya7's comments

_vya7 | 8 months ago

Tay all over again.

_vya7 | 8 months ago

Ha, anyone remember Microsoft's Tay?

sdegutis | 9 years ago | on: Fourteen Months with Clojure

Your solution doesn't short-circuit when any of the calls fail. It relies on (error) throwing some kind of exception to interrupt control flow and prevent the following lines from executing.

sdegutis | 9 years ago | on: Fourteen Months with Clojure

For the nested if-let mess, I'd probably do something like this:

    (let-every [x (foo)     err "foo failed"
                y (bar x)   err (format "bar %s failed" x)
                z (goo x y) err (format "goo %s %s failed" x y)]
      (qux x y z)
      (handle-error err))
Where `let-every` is a macro that works like let, but stops short on the first nil/false variable, runs only the next symbol binding expression, and then runs the else-clause.

There'd be nothing special about the "err" symbol on each line. It's just the next symbol binding, but on the same line as a convenience, and this means it can reference any previously valid symbol bindings.

Here's a quick & dirty implementation of that macro. I don't have a Clojure interpreter installed, so I don't know if it works.

    (defmacro let-every [bindings if-body else-body]
      (let [pairs      (partition 2 bindings)
            quad-pairs (partition 2 pairs)]
        (loop [quad-pairs quad-pairs]
          (if quad-pairs
            (let [[quad-pair]         quad-pairs
                  [try-pair err-pair] quad-pair
                  [try-sym try-expr]  try-pair
                  [err-sym err-expr]  err-pair]
              `(if-let [~try-sym ~try-expr]
                 (recur (next quad-pairs))
                 `(let [~err-sym ~err-expr]
                    ~else-body)))
            if-body))))
Given the above example, it should expand to this:

    (if-let [x (foo)]
      (if-let [y (bar x)]
        (if-let [z (goo x y)]
          (qux x y z)
          (let [err (format "goo %s %s failed" x y)]
            (handle-error err)))
        (let [err (format "bar %s failed" x)]
          (handle-error err)))
      (let [err "foo failed"]
        (handle-error err)))

sdegutis | 9 years ago | on: Fourteen Months with Clojure

Yeah it's a very real form of lock-in, nothing else really compares to Emacs + Paredit + Cider for productivity. And Emacs isn't great. But when I did Clojure full time for 5 years, I just sucked it up and learned Emacs and got really good at using it. Customizing my init file little bits at a time probably added up to a month's worth of lost productivity. But out of 50 months, 1 month lost to environment setup isn't bad. That's like 2% of the whole time. Or about 48 minutes per week. And the learning curve for me (as a long-time vim user) wasn't as hard as I thought it'd be, especially since knowing bash shortcuts really helped prepare me for the Emacs way. In fact I even took some Emacs knowledge back to the shell, such as how Ctrl-underscore is "undo the last edit to the current command".

_vya7 | 9 years ago | on: Fourteen Months with Clojure

After spending 50 months with Clojure, I can safely say it's my favorite server-side programming language (with Datomic as my favorite database), and the tooling (CIDER + Paredit + Emacs) is really downright amazing in terms of productivity.

sdegutis | 9 years ago | on: Fuchsia: a new operating system

Then what about ChromeOS? Do you think they're trying to build a "full-fledged" OS for the modern era, with safety and security in mind, but not as lightweight as ChromeOS?

sdegutis | 9 years ago | on: Fuchsia: a new operating system

The memory mapping model is really interesting, since it moves a lot of that out of the kernel and into user-space, but it seems like it has more disadvantages than advantages. What am I missing?

sdegutis | 9 years ago | on: About the security content of iOS 10.3

This is pretty terrifying. So many "arbitrary code execution with root privileges" exploits! They may be fixed, but how many more are still only known to malicious third parties?

And without even needing to install anything! "Processing maliciously crafted web content may lead to arbitrary code execution."

sdegutis | 9 years ago | on: Show HN: A Pomodoro app for your menubar/tray

One of my favorite skills & challenges is do things as efficiency as possible, and using Electron for an app like this just strikes me as super-duper wasteful, especially for an app that'll be running all the time. That said, it's probably not going to make that huge of a dent in daily battery life.

sdegutis | 9 years ago | on: Vibrator Maker to Pay Millions Over Claims It Secretly Tracked Use

They never ever adjust the position or color of any comment. They used to, until the day the mods labeled my account a "troll" account a few years ago. Now my posting is rate-limited, and my votes do nothing. Even after changing my behavior on HN, they refused to reverse their decision.

Let that be a warning to everyone here, never to post comments or links the HN mods do not approve of. Their vengeance is moderate and permanent.

page 1