Hacker News new | past | comments | ask | show | jobs | submit | mthomas's comments login

#3 has a, b and c parts.


I find that both are equally (un)readable. However, for expressions that are that long, I'm inclined to write:

    (setv result (-> (+ 1 3 88) 
                     (/ 2) 
                     (- 8)))


I am not a lisper, but that looks pretty cool. The non-lisp ways of writing that would either require adding parens like GP or writing things like "result /= 2", but that means repeating "result" or whatever variable many times.


This is even better than in-fix notation.


Still being an absolute beginner at lispy syntax, I'll have to ask you the same question though.

While I see the awesomeness in threading macros, I'm usually left pondering a while on where the result actually goes in the next s-expression. How long did it take you to get used to that? Would you prefer someting like `as->` for readability?


I thought it's a simple mnemonic: -> means inserting the form just after the beginning of the next one, while ->> inserts at the end of it.

You most certainly can have explicit variable to thread through expressions, like this:

   (it-> (form1 it) (form2 3 it 4) ...)
where it means "previous expression". I think there's a Clojure library which already implements this. You can use that if you want.


in Clojure this is achieved with `as->`


In Racket we actually have a threading macro with ~>

This:

(- (bytes-ref (string->bytes/utf-8 (symbol->string 'abc)) 1) 2)

Becomes this:

(~> 'abc

    symbol->string

    string->bytes/utf-8

    (bytes-ref 1)

    (- 2))

https://docs.racket-lang.org/threading/index.html


I believe the use of "~>" rather than "->" in Racket was set in #lang rackjure which adds in some of the Clojure syntax to Racket. Also amusing is their explanation:

> For example the threading macros are ~> and ~>> (using ~ instead of -) because Racket already uses -> for contracts. Plus as Danny Yoo pointed out to me, ~ is more "thready".

http://docs.racket-lang.org/rackjure/index.html#%28part._.Ba...

More thready indeed :-p


Emacs 25 has thread-first and thread-last macros in subr-x.el.


Also, I've seen lisps that obviate the need for the outermost parentheses (I think by using significant whitespace). In that case, the above example would have as many parens as the python example (for those who are keeping count).


Indeed, I like that better than either typical prefix or infix nested expressions.

What do you advise in the case the expression tree is a little bit more complex?

For example: (setv result (- (/ (+ 1 3 88) 2) (* 8 (+ 3 2)))


Because the operators all take a list of values it's sometimes convenient to format them like any other long list, with each nested sub-expression on its own line to form a tree:

    (setv result (- (/ (+ 1 3 88)
                       2)
                    (* 8 
                       (+ 3 2)))
Another possibility is to use a (let ...) to give nested values temporary names, like:

    (setv result (let ((first (/ (+ 1 3 88) 2))
                       (second (* 8 (+ 3 2))))
                   (- first second)))
It helps if "first" and "second" have meaningful names like "velocity" or "force" that can describe what they are.


I don't see any clever way to make that more readable. I would have to break it into two subexpressions and then take the difference. i.e.

    (setv e0 (-> (+ 1 3 88) (/ 2)))
    (setv e1 (-> (+ 3 2) (* 8)))
    (setv result (- e0 e1))


BTW doesn't setv support multiple pairs?

    (setv e0 (-> (+ 1 3 88) (/ 2)))
          e1 (-> (+ 3 2) (* 8))
          result (- e0 e1))
like setq and setf in CL.


I wonder what the backup is for when the power fails while several cars are in one shaft.


HSQLDB comes with a command line tool called SqlTool http://hsqldb.org/doc/2.0/util-guide/sqltool-chapt.html

You will have to setup the classpath manually and specify the jdbc driver. It is pretty basic.



The title is misleading. Verizon is buying out Vodafone's part of Verizon Wireless. Verizon Wireless is owned 55/45 by Verizon and Vodafone.


SyntaxError: not a chance


It would be nice if they put a link to the main site from the blog for those who don't know what this is.


https://www.nitrous.io

There are a few links in the post that link to our signup page, but it's tough to see with the dark background. Maybe it's time to change the background color of our blog...


My understanding of hadoop and hdfs is that both input and ourput are to/from disk. Your MR jobs are spun up and pointed to hdfs urls to read input from and they write to hdfs when done. This means that when there is an error, the intermediate computations don't necessarily have to be redone. However there is a trade off.

Additionally, I believe that HDFS keeps 3 copies of the data around on 3 different nodes for redundancy. So there is the overhead of that network traffic.


I did find this (now-fixed) bug/enhancement: https://issues.apache.org/jira/browse/HDFS-2246

Sounds like, with that configuration applied, the in-memory performance difference between Hadoop and Spark should not be nearly as large.


http://www.silentpcreview.com/stop_lcd_whine What happens if you increase the brightness


My monitor brightness is indeed set very low (2/100), but increasing this to 100/100 doesn't change anything (nor does fiddling with the contrast). Don't think it's _purely_ a hardware problem anyway, since a regular terminal doesn't show it; only a terminal in which I'm running over SSH. Thanks for the suggestion, though!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: