Arc Forumnew | comments | leaders | submitlogin
1 point by drcode 5930 days ago | link | parent

Yup, looks like 'w/res is very close to 'focus.

Your 'best alternative for my example is extremely clever, but doesn't work:

  > (= *list-of-numbers* (6 2 4 5))
  > (best (fn (a b) (and odd.a (> a b))) *list-of-numbers*)

  6
I knew something was wrong with it, but it took me like half an hour to realize the flaw :)

...it can of course be fixed with extra flagging (well, it'll still fail on only lists of even numbers by not returning nil) but then you'll lose the brevity advantage over my solution.



1 point by rincewind 5930 days ago | link

sorry, I hadn't had access to an Arc then.

  (best (fn (a b) (and odd.a (or even.b (> a b)))) '(6 2 4 5))
as mexpr:

  best[[a;b]-> odd[a] and (even[b] or a > b); list[6;2;4;5]];

-----

1 point by drcode 5930 days ago | link

yes, still a pretty good solution.

-----