Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, you could edit machine code directly, or do the next best thing and write in assembler:

    cmp eax, 100
    jle LESSTHAN
    mv 10, edx
    ret
  LESSTHAN:
    mv 5, edx
    ret
I doubt that's what the author had in mind, though.


I'm surprised the author didn't write a shorter C example:

    return price > 100 ? 10 : 5;


That produces a different AST than the if/else because it's an expression. :)


Every LISP statement is an expression too. So if you were trying to match them, you'd use the ternary.


Actually LLVM assembly might be a better choice these days.


A real programmer would write :

83 f8 64 7e 06 ba 0a 00 00 00 c3 ba 05 00 00 00 c3

Or even :

10000011 11111000 01100100 01111110 00000110 10111010 00001010 00000000 00000000 00000000 11000011 10111010 00000101 00000000 00000000 00000000 11000011

I'd do better still, but I lost my butterfly somewhere.


A real programmer would hand assemble a LISP interpreter and then pass it the LISP source. Come on.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: