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

Standard ML program. I fear it does not contribute much to the conversation but I cannot abstain from calling attention to my favourite pragmatic programming language that is presently on what seems to be a neverending life support.

  structure I = Int
  structure S = String
  structure SU = Substring
  structure SC = StringCvt
  
  infix 5 >>
  fun (x >> y) f = if x = y then () else (f x; ((x + 1) >> y) f)
  
  val printRow =
  let
      val p0 = SC.padLeft #"0" val ps = SC.padLeft #" "
      val td = I.fmt SC.DEC val tx = I.fmt SC.HEX
      val to = I.fmt SC.OCT val tb = I.fmt SC.BIN
      val desc = fn
            0 => "NUL" | 1 => "SOH" | 2 => "STX" | 3 => "ETX" | 4 => "EOT" | 5 => "ENQ"
          | 6 => "ACK" | 7 => "BEL" | 8 => "BS" | 9 => "HT" | 10 => "LF" | 11 => "VT"
          | 12 => "FF" | 13 => "CR" | 14 => "SO" | 15 => "SI" | 16 => "DLE" | 17 => "DC1"
          | 18 => "DC2" | 19 => "DC3" | 20 => "DC4" | 21 => "NAK" | 22 => "SYN" | 23 => "ETB"
          | 24 => "CAN" | 25 => "EM" | 26 => "SUB" | 27 => "ESC" | 28 => "FS" | 29 => "GS"
          | 30 => "RS" | 31 => "US" | 32 => "SPC" | 127 => "DEL" | n => str (chr n)
  in
      fn n => print (S.concatWith " " [ps 3 (td n), p0 2 (tx n), p0 7 (tb n), p0 3 (to n), desc n] ^ "\n")
  end
  
  val spec =
  let
      val scan = fn rad => fn sl => SC.scanString (I.scan rad) (implode sl)
  in
      fn str => valOf (case explode str of
        #"0" :: #"x" :: hex => scan SC.HEX hex
      | #"0" :: #"o" :: oct => scan SC.OCT oct
      | #"0" :: #"b" :: bin => scan SC.BIN bin
      | dec => scan SC.DEC dec)
  end
  
  val () = case CommandLine.arguments () of
        [] => (0 >> 128) printRow
      | [req] => printRow (spec req)
      | _ => raise Fail "arguments"


> [ a = b ] && echo "Oops!" || echo "Expected; phew!"

Not to be taken as a general rule though. I might be mistaken but I think that bash would parse the line as:

  ([ a = b ] && echo "Oops!") || echo "Expected; phew!"
so if the command sequence after `&&` fails, then the code sequence after `||` is executed anyway:

  illo@joe:~ $ [ "a" == "a" ] && >/dev/full echo "strings match" || echo "strings don't match"
  -bash: echo: write error: No space left on device
  strings don't match
  illo@joe:~ $
This is different from the semantics of the `if` block:

  illo@joe:~ $ if [ "a" == "a" ]; then >/dev/full echo "strings match"; else echo "strings don't match"; fi
  -bash: echo: write error: No space left on device
  illo@joe:~ $


Italian has "ni", a merge of "no" and "sì".


In case anybody wants to hear a different bell, I am probably as wealthy as jack9 and equally happy about my lifestyle, but I love people and I've never lived alone in all my life. My opinion is that it's more a matter of having different social needs and sensitivity, than being economically independent. Or maybe it's what you think of yourself -- I know for a fact that there are always smarter and more interesting and different people out there and I'd love to know them and experience life with them. It's a basic need I feel that doesn't depend on whether I'm able to support myself or not.


Erlang, just for fun:

  grade(#student{work=Work, tried_hard=Tried}) -> grade1(Work, Tried).
  grade1(excellent_work, _) -> 'a+';
  grade1(okay_stuff, yes) -> b;
  grade1(okay_stuff, _) -> 'b-';
  grade1(_, _) -> c.
Edit: formatting.


Or, if we're going to go with Prolog-inspired syntax, then why not Prolog?

    grade(Student, Grade) :-
        worked(Student, Work), work_grade(Work, Student, Grade).
    work_grade('Excellent', _, 'A+').
    work_grade('Okay', Student, 'B') :- tried_hard(Student).
    work_grade('Okay', _, 'B-').
    work_grade(_, _, 'C').
I'm a bit rusty, and I don't have a Prolog interpreter to hand to test, so I might have got some syntax wrong.


In which way a market can truly be split between (ideologically) better and worse players (this is a sincere question, no rethorics)? My point of view is that all the companies involved in this mobile-market dance happened and will happen (sometimes willingly) to turn out evil or good based on what better suits them in a particular point in time. I'm confident it will take just time for Samsung to show they're just a company (no deontology involved). Same goes for Google, HTC, LG, whatever. Apple, they chose the wrong juncture and now are paying that by (deservingly) facing endless bad publicity. So, no, I don't think the "good guys" won (let alone the fact that profit-wise they're actually all winning right now), I can't even think about them being good guys... just companies.


Well, this is hair-splitting, but I'll bite. A company can be considered (by me) a "good-guy" if:

1 - they do not want to steal from me (by using legal tactics to shut down competitors)

2 - they are not making my life difficult (by actively fighting standardization of protocols/formats)

Bonus points for improving life for everybody by releasing quality open source software (which Apple has done, in a limited way)

I have yet to be disappointed by Google. I am sure I will, sometime in the future, but not yet (lots of open source software, little legal activity - mostly retaliation - data liberation, open formats)

I have systematically been negatively affected by Microsoft (I am still waiting for a universally accepted document format, which Microsoft largely destroyed with their back-room tactics against ODF; I am also fed up that most laptops on the market are only offered with Windows tax - which I attribute to Microsoft abusing their OEM market power)

And Apple has tried to reduce my choice on the Smartphone market (it has failed); they are trying to destroy a truly open applications market on the web (by offering "Apps", same applies to Google, following suit); and they are largely responsible for the trend in locked-in content (iTunes, books, whatever)


Given the web is so wide open and been available for over 20 years to the public, I fail to see how Apple is responsible for this lock-in trend.

Rather Apple has aptly uncovered an untapped desire among the public, which the web failed to provide.

Yes, you can say Apple started it, so they're responsible. But this desire was ready for the pickin's. I don't fault Apple for picking it up. It must have been obvious to them.


Yes, but a 30% cut gives them all incentive in the world to further destroy the open marketplace (html). I do not have evidence that it is happening - but this must be an Apple goal. Simply because of how they are profiting from this arrangement.

Or, to put it another way: the financial incentives for Apple are not at all aligned with my personal interests.

Whereas I can not say the same thing about Google. I do not see how their financial incentives are colliding with my personal interests. Yes, privacy is a concern, but I am not - that I know - affected by that, and there are worse players here (Facebook).

In that light, Apple==bad, Google==good.


So you're claiming that the company who initially pushed web apps as the iPhone API but caved under pressure from developers, the same company who developed webkit. You're claiming this company is trying to destroy the web?

Do you not think that's a little unjustified?


With Google you are the product, with Apple you are the customer. I like Google but I trust Apple.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: