Arc Forumnew | comments | leaders | submitlogin
2 points by CatDancer 6112 days ago | link | parent

  (def dl> (dl1 dl2)
    (let (y1 m1 d1 y2 m2 d2) (join dl1 dl2)
      (or (> y1 y2)
      . . .
"with" is a form of "let" that lets you make multiple assignments at once, so you wouldn't need the "join":

  (def dl> (dl1 dl2)
    (with ((y1 m1 d1) dl1 (y2 m2 d2) dl2)
      (or (> y1 y2)
      . . .
you'll notice the extra layer of parentheses, which is how "with" knows that you've stopped defining variables and have started the body.


1 point by brett 6112 days ago | link

Thanks. I'm aware of with, I just thought I'd save some parens. Yours does read a bit easier.

-----

1 point by brett 6112 days ago | link

The other thing I'm noticing is that I've been nesting lets when the second assignment depends on the first. I think I should be using withs which I did not know about.

-----