Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 4077 days ago | link | parent

Ah, I thought of one reason:

  (if (pos 1 '(1 2 3))
    ..)
pos can return 0 on success. We need to be able to distinguish that from nil for failure.

So it turns out that empty string or empty table actually have a stronger case for being false than 0 does.



2 points by rocketnia 4077 days ago | link

If you're talking about treating 0 as falsy, then why not redesign 'pos in the process? I would happily use a 'pos that worked like this:

  > (pos 1 '(1 2 3))
  (0)

-----

2 points by rocketnia 4076 days ago | link

Oh, there's also the issue with 'find. It's already cumbersome to search a list of booleans for false and a list of lists for an empty list, and now it would be difficult to search a list of numbers for zero.

Of course, we could just do the same thing as 'pos:

  > (find 0 '(1 2 0 3))
  (0)

-----