0
$\begingroup$

I have a dataset created with SemanticImport assigned to "cofo." Paralleling what Christopher Wolfram did in the LiveStream "Playing With Government Data in the Wolfram Language," I did the following (please excuse my naïveté if I'm not using the Code functionality correctly):

RandomSample[cofo, 1000][
ToLowerCase /* TextWords /* Flatten /* DeleteStopwords /* 
WordCloud, "Work Description"]

It works fine but I don't know why. In particular, how is it that the string of right composed functions applies to the Random Sample? Random sample is the argument. I also assigned

bofo=RandomSample[cofo,100];
bofo[ToLowerCase /* TextWords /* Flatten /* DeleteStopwords /* 
WordCloud, "Work Description"]

which also worked. How can the argument (bofo) be in front of the functions?

Mathematica's syntax continuously seems to baffle me.

$\endgroup$
  • $\begingroup$ what is cofo? can you post a minimal example of your dataset? $\endgroup$ – Ali Hashmi Mar 20 '17 at 1:37
  • $\begingroup$ "cofo" is the variable in which I stored a dataset imported via SemanticImport that lists various aspects of City of Los Angeles Department of Building and Safety Certificates of Occupancy (thus "cofo" for Certificates of Occupancy). The variable "cofo" has Dimensions {26277,56}. I'm not sure how to post a dataset sample. $\endgroup$ – Rob Ryan Mar 20 '17 at 1:44
  • $\begingroup$ If it is too big to put in here, use Pastebin. $\endgroup$ – J. M.'s technical difficulties Mar 20 '17 at 2:04
0
$\begingroup$

When you use SemanticImport, you create a Dataset type. (If you look at the Head of bofo and cofo, you will see it is Dataset.) So this is not some kind of reversed syntax. Datasets allow all kinds of operations similar to SQL queries. See https://www.wolfram.com/language/elementary-introduction/45-datasets.html

$\endgroup$
  • $\begingroup$ Thanks. I think I see it there. I'm still struggling with syntax with functions, including pure functions. I get the "slot" concept but certain aspects continue to elude me. The so-called "operator form" is also a bit mysterious. I'm not a programmer by vocation or avocation, so practice is what's needed. $\endgroup$ – Rob Ryan Mar 20 '17 at 3:42
  • $\begingroup$ Roger that, apologies. $\endgroup$ – Rob Ryan Mar 26 '17 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.