Hacker Newsnew | past | comments | ask | show | jobs | submit | icedog's commentslogin

If anybody is interested in F#, look for a nearby meetup group to join. The SF F# group is pretty active and Mathias Brandewinder's hacker dojos are absolutely awesome!

[0] http://www.meetup.com/sfsharp/


You must not be familiar with the knapsack problem.


Perhaps you aren't? Unlike struct packing, the knapsack problem has a fixed upper limit. There's no limit on number of struct fields, and indeed, every solution consists of all of them.


I'm not saying it's exactly the knapsack problem, but it's quite related. Ordering from largest to smallest does not yield the optimal solution - period.


The article says throughout that sorting the fields in order of decreasing alignment requirement (i.e., size) minimizes slop. The proof for this is pretty straightforward. The article also discusses why you might not do this (e.g., structures might try to match layout of memory mapped devices).

Rudeness is a choice you make, by the way. You can change your behavior.


Besides the arrow keys, you can move forwards or backwards by clicking on the left or right edges of a slide.


The left and right buttons also do the trick.


You can also click on the vertical area between slides to go forward/back.


Also known as "easter egg navigation."


It's a tool for giving presentations, not necessarily for reading them.

But I've just sent a change to add some help text to these pages: https://go-review.googlesource.com/4910

edit: The change is now live. No more easter egg navigation. Yay!


This is better described as a 'publish-subscribe pattern using web sockets'. To be brutally honest (take this as constructive criticism), the addition of the HTTP endpoint isn't very interesting either. Implementing all this takes perhaps less than 100 lines of code.

Furthermore, your site is susceptible to XSS

curl http://web.sockethook.io/hook/foo --data "foo=<script>alert('hello')</script>"


We fixed the XSS issue. Having said that, this site is just to demonstrate that you can use any standard web socket client (including the one in your browser); normally you would build the XSS mitigation into the client app if necessary.

What scenario do you have in mind for a "pub-sub pattern using WS"?

It might not be the scenario we were shooting for. The HTTP endpoint was an important requirement. We needed a way to receive HTTP POST calls in an app which wasn't accessible from the web (i.e. no incoming HTTP, but we could make an outbound WS call). Something like Runscope's Passageway (https://www.runscope.com/docs/passageway) would have been our first choice, but it wasn't easy to bake it into the app itself.


Fastmail was once owned by Opera but bought itself to be independent again. I reckon they wouldn't be interested in being owned by another corporation, especially Yahoo.


We talked about this in the office a few weeks ago. The conclusion that we came to is that we're pretty happy with our current situation so any buyout would have to have a fairly enormous amount of cash attached :)


Took me 4.5 minutes, 103 requests, 13.1 MB transferred data.

Going to "Online Store" was also ~4MB more and 25 seconds...


I disagree that it maps most directly to the problem statement. You're performing a common factor computation in your mind, which may be more difficult given numbers other than 3 and 5. In my opinion, pattern matching offers the most direct solution and comes with an abundance of compiler optimizations. Here's an example in Rust...

        for i in range(1i, 101) {  
            match (i % 3, i % 5) {  
                (0, 0) => println!("Fizzbuzz"),  
                (0, _) => println!("Fizz"),  
                (_, 0) => println!("Buzz"),  
                _ => println!("{}", i),  
            }  
        }


> I disagree that it maps most directly to the problem statement. You're performing a common factor computation in your mind, which may be more difficult given numbers other than 3 and 5.

Well, sure, explicitly calling out i % 15 rather than (i % 3) && (i % 5) or the equivalent has that problem.

> In my opinion, pattern matching offers the most direct solution and comes with an abundance of compiler optimizations.

Pattern matching is not available in many languages, but, sure, where its available, its a great choice. Note that this still has a distinct case for the case where both % 3 and % 5 are true, rather than just testing those cases independently and sequentially and concatenating, so I think it falls into the general class of solutions I was describing.


I'll take an extra branch over concatenation and dealing with new line chars any day.


The solution in Haskell is quite clean, I believe.

  fizzBuzz n 
     | n `mod` 15 == 0 = "FizzBuzz"
     | n `mod` 3  == 0 = "Fizz"
     | n `mod` 5  == 0 = "Buzz"
     | otherwise       = show n

  main = mapM_ (print . fizzBuzz) [1..100]
I agree with you about generalizing pattern matching for less simple cases. Your example brought to mind view patterns, about which Oliver O'Charles had a nice writeup recently [1]. Nifty little extension.

[1] https://ocharles.org.uk/blog/posts/2014-12-02-view-patterns....


Using F# pattern matching:

    let buzzer number =
       match number with
       | i when i % 3 = 0 && i % 5 = 0 -> "FizzBuzz"
       | i when i % 3 = 0 -> "Fizz"
       | i when i % 5 = 0 -> "Buzz"
       | i -> (sprintf "%i" i)

    for i = 1 to 100 do
        printfn "%s" (buzzer i)


If only rust had (optional only, please) fall through on matches, then you could skip a whole line :D


I'm an F# developer, but still decided to not use F# to build an android app. Dealing with the UI libraries like support.v4 was just too painful from a functional perspective. If you don't need any object oriented dependencies, then it's smooth sailing.


F# is not meant for implementing the complete app anyway. Just use it for business logic where it makes sense.


I've only heard that in context of A: missing tooling, B: Microsoft, in their quest to make customers feel C# is still the real language and F#'s just some science toy. I've used F# for a Web UI via WebSharper and it was lovely. It's just a poor reflection on the state of UI kits if they don't work with F#.


"It's just a poor reflection on the state of UI kits if they don't work with F#." - well at least they don't start using lower-case names randomly.


Interesting that one of those presenters is named Howard Payne. Along with Payne being an elevator company, Howard Payne is the name of the antagonist in 'Speed', who hacks an elevator...


I get the impression that that is not actually his name. ;)

I believe this is his twitter account: https://twitter.com/SgtHowardPayne


Ahhh, that explains it. Thanks for the detective work.



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

Search: