Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.2K Views
|
1 Reply
|
1 Total Like
View groups...
Share
Share this post:

Thread works different when used with If

Posted 11 years ago
POSTED BY: Mathias Breuss

Hi,

Not sure about Thread[], but see documentation for Listable

SetAttributes[blafun2, Listable] ;    
blafun2[a_, b_, c_] := If[a + b + c > 0, a + b + c, 2] ;
blafun2[a, b, {c1, c2, c3}]    
ClearAttributes[blafun2, Listable] ;
(* {If[a + b + c1 > 0, a + b + c1, 2], If[a + b + c2 > 0, a + b + c2, 2], If[a + b + c3 > 0, a + b + c3, 2]} *)

I.M.

POSTED BY: Ivan Morozov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard