HN user

wjbr

18 karma

William Bettridge-Radford

www.williambr.co.uk

Posts0
Comments18
View on HN
No posts found.
Pretty.c 2 years ago

static int pretty_float_equal (float a, float b) { return fabsf(a - b) < FLT_EPSILON; }

Lisp in Space 3 years ago

If the lisp has read macros you can add it yourself.

There's: sweet-expression

https://srfi.schemers.org/srfi-110/srfi-110.html

https://sourceforge.net/p/readable/wiki/Examples/

    define fibfast(n)  ; Typical function notation
      if {n < 2}       ; Indentation, infix {...}
        n              ; Single expr = no new list
        fibup(n 2 1 0) ; Simple function calls

    define fibup(maxnum count n-1 n-2)
      if {maxnum = count}
        {n-1 + n-2}
        fibup maxnum {count + 1} {n-1 + n-2} n-1

    define factorial(n)
      if {n <= 1}
        1
        {n * factorial{n - 1}} ; f{...} => f({...})