Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.2K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Specifying Pattern for Dataset argument

Hello all. I've been looking at the documentation on patterns and I have the following question. Say I have a Dataset with keys "a", "b" and "c". The "a" key is associated with an Integer, the "b" key is associated with a point which can be described by the pattern {Real,Real} and the "c" key is a String. I want to write a function F that takes such a Dataset as its only argument. I know that I could do the following:

A) F[arg_] Which would be the most general. More specifically, I can do:

B) F[arg_Dataset] which would accept any Dataset.

So, how can I specify that the argument a must a Dataset of the form described earlier.

Dataset[<| "a"->_Integer, "b"->{__Real,__Real} , "c"->_String |>]
POSTED BY: Henrick Jeanty
2 Replies
Posted 3 years ago
POSTED BY: Eric Rimbey

Hello Eric. Thank you for your suggestion. After thinking it over, I tend to agree with you that my isValidDatasetQ logic should be somewhere else rather than in checking the arguments during the function call.

I mark your suggestion as an answer. Again, thnak you.

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