Howdy John C:
 
> Jeff asks:
> 
>          Maybe I am missing the point, but what's wrong with:
> 
>          composite: func ['f 'g][func [x] compose [(f) (g) x]]
> 
> Jeff's code doesn't work in this case:
> 
>         funny-func: composite
>                                          func [x] [x + 1] func [y] [y * 2]

 Yes, but it works fine for this case:

 funny-func: composite (func [x][x + 1]) (func [y][y + 1])

 funny-func 2
 == 4

 HahHAhahahAhahah!! 1!!! !1 !!1!1!!!!!!! I WIN!!! !1!! 1!! ! !

  :-)  ;-)  :-) 

  
> Nor does the technique generalize:
> 
>         mapper: func ['f] [func [block] compose [foreach element
>         block [(f)
> element]]]

  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

        (Just playing around.  No offense meant! (-: )

        Jolly good jovial rejoinders to you, mate!

        -jeff

Reply via email to