HNHacker News
TopNewBestAskShowJobs

alco

100 karma · joined July 13, 2013

Innovate!
submissionscomments
alco··on Chain, the Blockchain API for developers
Why is it not open source? I smell lock in.
alco··on N2O: Erlang Web Framework
No. The reason people use text based formats is so that they could be read by humans without additional tools. Compression reduces the size but it's not reasonable to claim it works better then a binary format designed for light footprint.
alco··on OS X Command Line Utilities
Quicksilver is similar to Alfred in intent and quite featureful/customizable. It is open source. https://github.com/quicksilver/Quicksilver
alco··on MirageOS: A Unikernel For The Xen Hypervisor
I'm afraid that going in the direction of using single-language platforms only draws us further for having a standard way of managing them.
alco··on The homogenization of scientific computing (2013)
Python is good for scientific computing. But this is one person's experience. Users of other languages may sleep calm.
alco··on MirageOS: A Unikernel For The Xen Hypervisor
You mean a pseudo-shell? Because when you're running OCaml on top of a hypervisor, there is no OS and shell in the traditional meaning of those words. So nothing to connect to.
alco··on MirageOS: A Unikernel For The Xen Hypervisor
That is partly true. But if there is nothing to hack into, there will also be nothing to log in to for an admin or an ops person.

In the case of Erlang, for instance, it provides a built-in remote shell which allows one to connect to a running Erlang process, get multitude of information about the VM, loaded code, etc.

As long as there is a convenient way to maintain a running system, that same way can be used for hacking.

alco··on MirageOS: A Unikernel For The Xen Hypervisor
Also http://corp.galois.com/halvm.

Those three have in common the trait that they support single language runtime: Erlang for Erlang on Xen, OCaml for MirageOS, and Haskell for HaLVM.

alco··on Ramsey Nasser's Arabic programming language artwork
Is that fifty-one or fifteen?
alco··on Pattern Matching – Make the Compiler Work for You
What I mean is that it's not possible in a dynamically typed language to enforce at compile time enumeration of all possible cases for a variable, the type of which will be known at run time.
alco··on Pattern Matching – Make the Compiler Work for You
There are no enums in Erlang and Elixir. If you have a case expression and there is no match with the given value, you'll get a run time error. This is deliberate and is part of the general approach to error handling in those languages.

Statically typed languages like Haskell and Rust require the programmer to list all possible cases when matching on a value.

alco··on Raindrop.io – Smart Bookmarks
So I've been using this service since this post on HN and I got a lot of "Link not recognized" bookmarks. I don't really understand the point of this.

http://raindrop.io/collection/51838

alco··on Elixir v0.13.0 released, hex.pm and ElixirConf announced
Sure. I just wanted to stress the point that macros are local in their scope. It's nothing like monkey-patching in Ruby where importing a module can change all divisions from floats to rational numbers.
alco··on Elixir v0.13.0 released, hex.pm and ElixirConf announced
Regarding your point about cleaning up other people's macros.

In Elixir macros are imported into local scope only when the user explicitly asks for it. Most libraries provide a `__using___` macro that can modify current scope.

For instance, `use ExUnit.Case` allows you to write tests like this

    test "my test case" do
      assert funcall() == "value"
    end
instead of this

    require ExUnit.Case
    ExUnit.Case.test "my test case" do
      ExUnit.Assertions.assert funcall() == "value"
    end
So it basically imports a bunch of stuff for you, but only when you call `use ExUnit.Case`.

The consensus in the community right now is to not get carried away with macros and DSLs. Even if your library provides a DSL, it should be based on a functional API that is mostly usable without macros.

And lastly, remember that `use`, `require`, and `import` modify only the current lexical scope. I wrote this macro[1] that replaces the built-in `|>` operator with a version that prints its output to the console. You can `use PipeInspect` inside one function and only that function's body will get the overriden implementation of `|>`.

Cheers.

[1]: https://gist.github.com/alco/9956215

alco··on Elixir v0.13.0 released, hex.pm and ElixirConf announced
There's also Racket[1] and Rust[2].

[1]: http://queue.acm.org/detail.cfm?id=2068896 [2]: http://static.rust-lang.org/doc/0.10/guide-macros.html

alco··on Elixir v0.13.0 released, hex.pm and ElixirConf announced
I agree with all of the above.

I would just like to add that in Elixir meta-programming does not always have to deal with macros.

For example, this program

    somelist = ... # any kind of data,
                   # could be loaded from file
    defmodule M do
      for {name, value} <- somelist do
        def lookup(unquote(name)), do: unquote(value)
      end
    end
generates a set of functions from arbitrary input. This feature alone greatly improves productivity in certain use cases.

While it is true that Erlang's parse transforms are more powerful by default, nothing would stop a willing heart from implementing token-level macros for Elixir. It would be a separate program that would parse source code before passing it on to the Elixir compiler.

But given the straightforwardness of code generation in Elixir (as exemplified by the code above), coming up with such a program might prove to be even easier for the user than dealing with parse transforms in Erlang. This is a speculation on my part, so it'd be curious to see if anyone goes in this direction in the future.

alco··on The crushing lameness of April Fools Day on the Internet.
Is it so difficult for you to spend one day in a year away from the Internet to avoid the "lameness" that irritates you?
alco··on Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)? (2013)
As the answer on stackoverflow mentions, there is -ffast-math option to gcc that tells the compiler to treat fp operations as associative. I've done some testing:

  $ clang -v
  clang version 3.3 (tags/RELEASE_33/final)
  Target: x86_64-apple-darwin12.4.0

  double pow(double);
  
        LLVM bitcode                   Assembly

  // a*a*a*a*a*a                 
  %1 = fmul double %a, %a       |  movaps %xmm0, %xmm1
  %2 = fmul double %1, %a       |  mulsd  %xmm1, %xmm1
  %3 = fmul double %2, %a       |  mulsd  %xmm0, %xmm1
  %4 = fmul double %3, %a       |  mulsd  %xmm0, %xmm1
  %5 = fmul double %4, %a       |  mulsd  %xmm0, %xmm1
  ret double %5                 |  mulsd  %xmm0, %xmm1
                                |  movaps %xmm1, %xmm0

  // a*a*a*a*a*a -ffast-math    
  %1 = fmul fast double %a, %a  |  mulsd  %xmm0, %xmm0
  %2 = fmul fast double %1, %1  |  movaps %xmm0, %xmm1
  %3 = fmul fast double %1, %2  |  mulsd  %xmm1, %xmm1
  ret double %3                 |  mulsd  %xmm0, %xmm1
                                |  movaps %xmm1, %xmm0

  // (a*a*a)*(a*a*a)            
  %1 = fmul fast double %a, %a  |  movaps %xmm0, %xmm1
  %2 = fmul fast double %1, %a  |  mulsd  %xmm0, %xmm0
  %3 = fmul fast double %2, %2  |  mulsd  %xmm1, %xmm0
  ret double %3                 |  mulsd  %xmm0, %xmm0
alco··on Google I/O 2014
OK, I've scrolled all the way down, seen some nice colors and heard some nice music. But where's the info about Google I/O?

Seriously, I didn't even try to read the text on the page because its overall mood implies the text is not important at all.

This site simply looks like someone's homework rather than an info site for a conference.

alco··on Show HN: 2048 without numbers
Could you point out what is oppressive about Chrome? I don't see any G+ in here.
alco··on A glimpse into a new programming language under development at Microsoft
YAGPL (yet another general-purpose language).

I think we've had enough of those in the past decade. Each one has something new to offer, but at the same time it disperses attention of the programmer crowd and so less effort is put into each language's development.

I think we need to experiment more with single-purpose languages. I'm not saying DSLs because those are mostly embedded syntactic constructs in existing languages. By single-purpose I mean an independent language (not just new syntax, but semantics as well, and possibly new runtime) that does one thing and does it well.

I believe such a language will have much more luck in becoming the single good enough solution for a particular problem (any problem it chooses to address, but only that one). There is really no hope for any general-purpose language to be a good fit for the whole wide spectrum of problems modern computing needs to solve.

alco··on Monty Hall problem explained visually
Still, why? Why open 38 doors? I don't think this emphasizes the difference in probability, it just creates artificial bias.

Let's analyze the classical problem. After you pick a door, one of the remaining two doors is opened.

With more doors (say, 11), it wouldn't make for an interesting show if you opened 9 more doors after the first one. A more reasonable approach would be to open one additional door and let the player choose to switch or stay with their choice each time. But that would only complicate the explanation, of course.

Let's dissect the 11-door case. We will do the following: the player picks a door, then the host a) opens one other door; b) opens 50% of the remaining doors; c) leaves one door closed.

IMO, the (a) case is the closest generalization of the original problem. You have a 1/11 chance to pick the car door on your first try. Then, one other door is opened, and if you switch to another random door, the best case probability of you getting the car is 10/11 * 1/9 = 10/99. This number is slightly bigger than 1/11.

In the (b) case you get a better result when switching, but to me that just looks like adding artificial bias. Obviously, the (c) case looks best because you've removed so much choice by leaving only one other door closed. Adding more doors does one thing: improves the probability of switching. That's good if this is what you're aiming for. But this turns it into a completely different problem.

So, you can see that the result depends on what you want to get. If you try to stay faithful to the original problem statement, adding more doors actually makes the benefit of switching less obvious.

In summary, I'm convinced that 3 is not an accidental number in the original problem statement. Whoever came up with it, they knew how to remove space for speculation by providing the only reasonable thing to do: open 1 door (or 50% of the doors) and leave 1 other door closed.

alco··on Monty Hall problem explained visually
I can't see how your generalization of the problem to more doors is correct.

In the classical problem with 3 doors, if you pick a door with a car, the host will only open 1 other door.

In your demo, if I use 40 doors and pick one, the host opens all other doors but one. Why?

If the one of those 40 I pick has a car, will the host open all remaining doors? That doesn't seem to be the case for the 3-door variant.

alco··on Telegram - secure, free messaging
>Q: How secure is Telegram? >Very secure. [...]

It's just an advertisement like any other. I'm sure the people responsible for the content of the FAQ know their target audience, so they know the wording will work for those whose attention they care about.

It is good that we, technical people, understand how completely worthless those words are. It begs for the "citation needed" label.

The question for me is this: do ordinary people (non-programmers in this case) really believe in most of the things ads tell them?

alco··on Day 21: Docker – The Missing Tutorial
At first, I was confused too. So I asked on the ML. See [1] and continuation in [2]. You could also browse the docker-user list, there are a number of threads asking to clarify various concepts about Docker.

[1]: https://groups.google.com/d/msg/docker-dev/OcpLrYti64Q/Ue6vP... [2]: https://groups.google.com/d/msg/docker-user/4acVRnOd9Dw/RZRc...

alco··on Frontend: The web visual editor
It pains me to see how he repeats the same action for each subtitle-block element, doing the same thing 3 times total. Imagine you had a scrollable area with 20 blocks.

If it's a mockup editor, then it should be easy to customize from JS to make anything useful from the mockup.

If it's a site builder, better add support for templates, so that one would then be able to drag and drop data (e.g. json) onto the canvas and bind it to a template to automatically populate a whole set of elements at once.

P.S. No matter how slick your UI is, if it's not programmable, it's not useful.

alco··on Show HN: Pix.pe – Easily sharable pixel art
Try hitting the Back button in your browser after drawing for a while.
alco··on JetBrains releases open-source Python IDE
Clang is destined to change that.

http://clang.llvm.org/features.html#applications

alco··on Twelve Go Best Practices
You can panic inside Write() and recover at the top of the DumpBinary() function. This has been demonstrated by Rob Pike and Andrew Gerrand in a talk at Google IO.

As long as you don't leak panics outside of your package, it's OK to use them for non-local error returns.

alco··on VLC for iOS Now Available (itunes link)
Thanks!
← PreviousPage 2 of 3Next →