# The difference between set( ) and { } on Wrangle?

## Recommended Posts

Hi All,

I want to know the difference between set( ) and { } using on Wrangle.

Exactly what is difference?

Best,

Jamie

Edited by jungjaehwa
##### Share on other sites

you can use {} syntax to define vector using constants like {1,2,3} or {-0.1, 1.5, 2,0}

but if you want to use variables you have to use set() function, which builds a vector by evaluating arguments

so

```float num = 1.0;
vector A = {num, num, num}; // is invalid and will error out
vector B = set(num, num, num); // evaluates to {1.0, 1.0, 1.0}```
Edited by anim
##### Share on other sites

https://vimeo.com/67677051

It's also discussed in Ari Danesh's tutorial (starting at 19:30).  He says set() is much more effecient than {} to calculate.

##### Share on other sites

...  He says set() is much more effecient than {} to calculate.

not sure about that, as set() is a function which produces vector {}

it's as if you were saying that rand() is more efficient than number 0.854

unless I'm missing something

##### Share on other sites

not sure about that, as set() is a function which produces vector {}

it's as if you were saying that rand() is more efficient than number 0.854

unless I'm missing something

Well, technically, 0.854 as a constant is more efficient than any function call

Not sure if set() is faster though. For example there is also assign function, which extracts values from vector or matrix. Would it be faster then getting value by index? Need to do some tests anyway.

Edited by Stalkerx777
##### Share on other sites

Well, technically, 0.854 as a constant is more efficient than any function call ...

my point

##### Share on other sites

You're probably right, all I know about it is what I saw in the tutorial.

What you said about not being able to use variables in {} is probably more important anyway.

Edited by rtep
##### Share on other sites

@anim : Thank you so much for your help. I've got it what your point! Have a great day.

@rtep : Hi rtep, It's great tutorial that I saw. I wanted to know more deeply for some a confuse things using them.

@Stalkerx777 : Thanks! I am going to try your technical support.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• #### Support

×
• Create New...