oh if you dont like adding 0. maybe you can use the keyword #:final instead of #:break
(they say it does just one more iteration before breaking the loop) On Wednesday, 14 October 2015 05:53:03 UTC+2, Linh Chi Nguyen wrote: > Isnt this the reason we should add 0 at the beginning of the list? > > On 13/ott/2015, at 22:38, Matthias Felleisen wrote: > > > > > Welcome to Racket v6.3.0.1. > >> (define r .8) > >> (for/last ([p '(a b c d)][f '(.2 .5 .7 1)] #:break (< r f)) p) > > 'c > > > > Or WORSE: > > > >> (define r (random)) > >> r > > 0.011105628290672482 > >> (for/last ([p '(a b c d)][f '(.2 .5 .7 1)] #:break (< r f)) p) > > #f > > > > > > > > > > On Oct 13, 2015, at 3:37 PM, Nguyen Linh Chi wrote: > > > >> the list 0 isnt a bug. I add it because #:break will break the fitness > >> vector at r < f. > >> > >> For example, > >> Population : a b c d > >> Cumulative fitness .2 .5 .7 1 > >> > >> If the random r = .8, it means that the lottery points to the interval of > >> automaton d. But #:break will breaks at .7, and the associated automaton > >> is falsely identified as automaton c. > >> > >> (Hm, right?) > >> -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.