Arc Forumnew | comments | leaders | submitlogin
4 points by rocketnia 5063 days ago | link | parent

First off, two bugs: You use 'append rather than 'join, and 'shuffle_numbers will overwrite the global variable 'i since 'i isn't a lexical variable at (= i (- max min)) and (-- i). There might a third bug where you say (~is (caar lst) 'fn), but I'm not sure what your intention is there.

Next, there are some things you can simplify. In shuffle_members, you have "let temp 0 @", which isn't doing much, and you also have "@ arr" at the end, which is unnecessary. Unlike 'let, 'w/table automatically returns the value its variable has at the end of the body. In span_let, there's a place where you check [and (is (type _) 'cons) (is (car _) 'scope)], but FYI, that's exactly what [iscar _ 'scope] does. :) Also, I don't expect you to know this right away, but you can accomplish the decreasing loop using (down i (- max min) 1 ...); 'down is a backwards 'for.

Finally, it's really not a big deal, but these names would be more consistent with Arc:

  binding-function-list*
  span-let
  shuffle-numbers
I think that the scope macro make the code more readable. What do you think?

I don't really think it makes it more readable, but that's only because it introduces new rules I'm not accustomed to. The "let temp 0" line is clearly supposed to wrap the whole area, but I had to open up Arc and check to see whether the 'for loop wrapped the 'loop loop or not. (Your indentation might have been a clue, but I suspected a bug.)

In total, you removed ((()())) and put in (scope @ @ @ @) and some extra rules to worry about. I think that's sort of a net loss. But hey, it could be the basis for a better idea. If it helps you read your code, then I think it's worth it already. ^_^



1 point by fallintothis 5063 days ago | link

that's exactly what [iscar _ 'scope] does.

In vanilla Arc, [caris _ 'scope].

-----

1 point by rocketnia 5062 days ago | link

Typo. XP Thanks.

-----

1 point by ylando 5063 days ago | link

Thanks for your nice responce. It was very helpfull. Append works in jarc but i didn't find any document on this function.

-----