Message Boards Message Boards

0
|
6982 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Get correct value

Posted 9 years ago

Hello,

I am trying to handle Associations.

 c = <|w -> 1, t -> <|r -> 2, m -> 3|>|>

I am using a function in order to print out the values

calculate2[a_Association] := (Print[a];)
calculate2[else_] := else

this commando:

calculate2 //@ c // InputForm;

results in:

   <|r->2,m->3|>
   <|w->1,t->Null|>

I am confused about the 'Null', what I need is

 <|w->1,t-> <|r->2,m->3|>|> 

I think the problem is that the value for t is also an association(?). Is there a workaround? The list c is just a small example, I have to work with larger lists (more than 3 hierarchy-levels). Later on I have to work with the input a (not only Print statements).

Thanks! Gordon

POSTED BY: gordon-fischer
POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract