Avoiding loops and forks 
Author Message
 Avoiding loops and forks

Quote:

> (By the way, to *really* understand this program, we have to
> know some details about how the split_list tool works.  If the
> list has an odd number of elements, which half ends up being
> bigger?  Because that's the one we should use -- instead of
> FIRST LAST :HALVES we might prefer LAST FIRST :HALVES.  For an
> even-size list it's arbitrary which we choose.)

You woundn't have to know. You would only have to explore:

show iota 5
[0 1 2 3 4]

show split_list 2 iota 5
[[0 1 2] [3 4]]

So it should have been "last first" instead
of "first last":

show last first split_list 2 iota 5
2

show map [split_list 2 iota ?] iota 10

[[[] []]
  [[0] []]
  [[0] [1]]
  [[0 1] [2]]
  [[0 1] [2 3]]
  [[0 1 2] [3 4]]
  [[0 1 2] [3 4 5]]
  [[0 1 2 3] [4 5 6]]
  [[0 1 2 3] [4 5 6 7]]
  [[0 1 2 3 4] [5 6 7 8]]]

show map [split_list ? iota 10] [1 2 3 4 5 6 7 8 9 10]

[[[0 1 2 3 4 5 6 7 8 9]]
  [[0 1 2 3 4] [5 6 7 8 9]]
  [[0 1 2 3] [4 5 6] [7 8 9]]
  [[0 1 2] [3 4 5] [6 7] [8 9]]
  [[0 1] [2 3] [4 5] [6 7] [8 9]]
  [[0 1] [2 3] [4 5] [6 7] [8] [9]]
  [[0 1] [2 3] [4 5] [6] [7] [8] [9]]
  [[0 1] [2 3] [4] [5] [6] [7] [8] [9]]
  [[0 1] [2] [3] [4] [5] [6] [7] [8] [9]]
  [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]

Daniel

To unsubscribe from this group, send an email to:

LogoForum messages are archived at:
http://www.*-*-*.com/

Your use of Yahoo! Groups is subject to http://www.*-*-*.com/



Sun, 27 Nov 2005 03:43:20 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Avoiding loops and forks

2. Wish problem: How can I avoid wish from forking

3. Avoiding a loop

4. Avoiding loops

5. Resource Fork has no Resource Fork?

6. break one loop and skip one iteration of outer loop

7. 2 files: a loop within a loop??

8. Problem with loop inside other loop

9. Impelement for loop and do while loop

10. using while loops within while loops?

11. Fast loop inside a slow loop?

12. Troubles using while loops and case loops

 

 
Powered by phpBB® Forum Software