Howdy John Curtis:
 
> Jeff said:
> 
>          Sure it does, with one little difference:
> 
> 
>        mapper: func ['f][func [block] compose/deep [
>                foreach element block [(f) element]]
>        ]
> 
>          l: mapper  (func  [x][prin odd?   x]) l [1    2 3 4  5]
>          truefalsetruefalsetrue
> 
> 
>          HahaHAHhahHAHAhA!! I WIN AGAIN1!!  ! 1 1!!  ! ! ! ! !!1
>          1
> 
> In this  case,  yes, but  this   isn't a general  solution.
> Compose/deep  evaluates  every parenthesized  expression in
> the block, no matter what level.  So you  have to make sure
> that   you  never  use  parenthesized  subexpressions.  For
> instance this fails:
> 
> funky: func ['f][func [block] compose/deep [
>                foreach element block [(f) (element + 3)]]
>        ]

     Well then, try this on for size:

         funky: func ['f][func [block] compose/deep [
                 foreach element block [(f) (to-paren [element + 3])]
         ]
     ]

         I WIN I WIN I WIN!!


> or this:
> 
> funky2: func ['f] [func [block] compose/deep [
>                 foreach element block [do composite (f) (func [x] [x
>                 + 3]) element]]]

                  funky2: func ['f][func [block] compose/deep [
                          foreach element block [
                                  do composite (f) 
                                          (to-paren [func [x][x + 3]]) element
                              ]
              ]
          ]

                  z: funky2 print
                  z [1]
                  4


   In fact, in all these cases I will always be able to
   generate the proper nesting and proper placement of
   parenthesized expressions, ERGO: Rah rah!! I am the
   champion!!! Trumpets blare! Confetti fills the air!! Tah
   dah! 


   :-)  Just havin' a smiley good funnin time  (-: 

   -jeff

Reply via email to