Livecoding Championship
Livecoding Championship
Livecoding Championship is among my favorite events held at the annual Wolfram technology conference. It was full of surprises for me. For example, I discovered that Flip Philips is not only a pioneering researcher, but also an amazing emcee. Additionally, I discover a new Wolfram Language (WL) built-in function during one of the livecoding challenges. Here was the challenge:
◼
Which 10 people have the most Wolfram Language symbols named after them (eponyms)? Return the most common country of birth among them as a country entity.
I started by calling free-form input (type Ctrl+=) as “Wolfram language symbols”. To my amazement, the result was an entity class:
In[]:=
Out[]=
Print the full form:
In[]:=
Out[]//FullForm=
EntityClass["WolframLanguageSymbol",All]
Cool! WolframLanguageSymbol is an entity type! Therefore, there should be a documentation page about it: WolframLanguageSymbol. And likewise, a WL function for that data: WolframLanguageData. Nice! I am on the right track!
Generate properties of the WolframLanguageSymbol entity:
In[]:=
EntityProperties["WolframLanguageSymbol"]
Out[]=
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Bingo! is among properties! BTW, by this time, three correct answers were already submitted! So no credit for this challenge :(
In order to be productive, I took out my note and wrote: WolframLanguageData, there are some useful info in it for teaching Wolfram Language. And here is my initial take on this idea.
WolframLanguageData
WolframLanguageData
Generate the timeline of WolframLanguageData:
In[]:=
WolframLanguageData["WolframLanguageData"]
Out[]=
Contents cannot be rendered at this time; please try again later or download this notebook for full functionality »
Yike! Why I did not know this function? I should convince myself, somehow. How many WL functions are in version 12?
Generate list of all WL functions and return its length:
In[]:=
WolframLanguageData[]//Length
Out[]=
5436
Well, out of 5436 functions, I missed this one. Not a big deal :D
What about other users? Is WolframLanguageData a commonly-used WL function? Let’s look at the usage frequencies and ranks.
Return list of usage frequencies of WolframLanguageData from several domains:
In[]:=
Out[]=
{All0.0000192923,StackExchange5.47355×,TypicalProductionCode0.,WolframAlphaCodebase0.0000237916,WolframDemonstrations0.,WolframDocumentation0.0000152659}
-6
10
Return list of usage ranks of WolframLanguageData from several domains:
In[]:=
Out[]=
{All637,StackExchange1896,TypicalProductionCode4864,WolframAlphaCodebase314,WolframDemonstrations4864,WolframDocumentation2421}
Does it mean that WolframLanguageData is not commonly-used? Let us explore more.
Functionality areas of WL functions
Functionality areas of WL functions
We can categorize WL functions based off their functionalities. What is the complete list of “FunctionalityAreas”?
Generate functionality areas for all WL functions, flatten them and remove duplicates
In[]:=
listOfFunctionalityAreas=WolframLanguageDataAll,//Flatten//DeleteDuplicates;
So we have 188 different functionality areas!
In[]:=
Length@listOfFunctionalityAreas
Out[]=
188
Print a shallow form of listOfFunctionalityAreas
In[]:=
listOfFunctionalityAreas//Shallow
Out[]//Shallow=
{CodeInterruptionSymbols,MachineSymbols,ChannelSymbols,MessagesAndPrintingSymbols,RestructuringSymbols,AudioSymbols,DirectorySymbols,StreamSymbols,BlockchainSymbols,BinaryDataSymbols,178}
For example, let’s find WL functions with the functionality area as MoleculeSymbols.
Get the list of all WL function with the functionality area as MoleculeSymbols:
In[]:=
WolframLanguageData[EntityClass["WolframLanguageSymbol","FunctionalityAreas"ContainsAll[{"MoleculeSymbols"}]]]
Out[]=
,,,,,,,,,,,,,,,,,,,,,,,,,,
Note that searching functions based on the functionality area gives better results compared to searching based on the function name.
Generate list of all WL functions and select those whose name contains Molecule
In[]:=
Select[WolframLanguageData[],StringContainsQ[#["CanonicalName"],"Molecule"]&]
Out[]=
,,,,,,,,,,,,,
How many functions are within each functionality area?
Generate functionality area for all WL functions, count each area, and sort them from large to small.
In[]:=
WolframLanguageDataAll,//Flatten//Counts//ReverseSort
Out[]=
MathFunctions279,BasicSymbols243,ImageSymbols183,GraphTheorySymbols179,StatisticalDistributionSymbols152,GraphicsSymbols126,RegionSymbols125,StringSymbols115,StatisticsSymbols110,PlottingSymbols110,PacletSymbols103,CloudSymbols97,NetSymbols90,ControlSystemSymbols88,OperatorSymbols86,FrontEndSymbols85,CellSymbols78,FileSystemSymbols78,ComparisonOperatorSymbols73,ColorSymbols71,AudioSymbols69,LinearAlgebraSymbols62,MachineLearningSymbols60,NotebookSymbols60,DateSymbols59,ClusteringSymbols52,GraphicsPrimitiveSymbols51,FormSymbols48,StreamSymbols44,StatisticalTestSymbols42,StatisticalProcessSymbols41,ChartSymbols39,PolynomialSymbols39,ArrowOperatorSymbols38,MachineSymbols38,URLSymbols36,ImageFilterSymbols35,ParallelSymbols35,VectorTeeOperatorSymbols34,EntitySymbols34,StyleSymbols33,ControlObjectSymbols33,GeoGraphicsSymbols32,RecurrenceSymbols32,NamedGroupSymbols32,GeodesySymbols32,WaveletSymbols31,RestructuringSymbols31,SolvingSymbols30,BoxSymbols30,AssociationSymbols29,NumberTheorySymbols28,CalculusSymbols28,BoxOptions28,GraphBooleanPropertySymbols28,QuantitySymbols28,MoleculeSymbols27,ArraySymbols27,TensorSymbols26,TemplateSymbols26,ControlObjectOptions25,ListSymbols25,MathFunctionWindows24,FrontEndOptions24,TimeSeriesSymbols24,MinMaxSymbols22,GaugeSymbols22,GroupTheorySymbols21,LogicSymbols21,SearchSymbols21,LinkSymbols21,FittingSymbols20,ExtractionSymbols20,BooleanSymbols20,GeometricTransformSymbols20,NumericsPrecisionSymbols20,CompileSymbols20,DirectorySymbols20,NamedGraphSymbols19,PacketSymbols19,MatrixSymbols19,ChannelSymbols19,DeviceSymbols18,MessagesAndPrintingSymbols18,DebugSymbols17,NumericSymbols17,PermutationSymbols17,SymbolInformationSymbols17,SystemModelSymbols17,DiscreteFourierSymbols17,HistogramSymbols17,BinaryDataSymbols17,StructuralSymbols16,CryptographySymbols16,TimeMemorySymbols16,ExternalProcessSymbols15,ContinuousFourierSymbols15,DomainSymbols15,IntegerSymbols15,CodeActionSymbols15,VectorCalculusSymbols15,InterpreterSymbols15,SocketSymbols15,SoundSymbols14,LibraryLinkSymbols14,DynamicSymbols14,BlockchainSymbols14,SignalProcessingSymbols13,DialogSymbols13,EnvironmentSymbols13,GeoGraphicsPrimitiveSymbols12,AstronomySymbols12,SymbolAssignmentSymbols12,RootSymbols12,DiscreteCalculusSymbols11,ButtonSymbols11,AsymptoticSymbols11,FinanceSymbols11,GeometricSceneSymbols11,PatternSymbols11,AlgebraicSymbols11,AlignmentSymbols11,ResourceSymbols11,ServiceSymbols11,CodeInterruptionSymbols11,ExternalSessionSymbols10,NumberFieldSymbols10,OptimizationSymbols10,BitSymbols10,LegendSymbols10,AnnotationSymbols10,CodeEvaluationSymbols10,InitializationSymbols10,TaskSymbols10,FractalSymbols9,CodeFlowSymbols9,ExpressionTestingSymbols9,AskSymbols9,GrammarSymbols9,PersistentObjectSymbols9,FontSymbols9,PageSymbols8,FormattingSymbols8,DatasetSymbols8,ExpressionSizeSymbols8,GraphDistributionSymbols8,WebSessionSymbols8,NumberSymbols7,InterpolationSymbols7,ViewerSymbols7,QuantityVariableSymbols7,SymbolValueSymbols7,DatabinSymbols7,SeriesSymbols7,WolframAlphaSymbols7,TravelSymbols6,ControllerSymbols6,SliderSymbols6,NumericConstantSymbols6,TextStringSymbols6,TestSymbols6,LocalObjectSymbols6,RawExpressionSymbols5,MenuSymbols5,ContinuedFractionSymbols5,InfinitySymbols5,UncertaintySymbols5,SetSymbols5,PackageSymbols5,SymbolContextSymbols5,RealSymbols4,RuleSymbols4,ScheduledTaskSymbols4,FunctionSymbols4,Symbols3,IntervalSymbols3,AsynchronousTaskSymbols3,FrontEndExecutionSymbols3,AngleSymbols3,SpecialSymbols3,ComplexSymbols3,RationalSymbols2,GlobalOptions2,PaletteSymbols2,AutocompleteSymbols2,CDFSymbols2,ModuleSymbols1,OptionSymbols1
Generate a word cloud of top 20 functionality areas with largest number of functions
Does it mean that functions in MathFunctions are the most commonly-used WL functions?
Usage frequency of WL functions
Usage frequency of WL functions
What are the most commonly-used WL functions?
Generate an association with keys the WL functions and values the corresponding single corpus of the usage frequency, delete those whose usage frequencies are missing:
Return top 279 WL functions with the largest usage frequency:
Why 279? I will comment on that very soon.
Generate a word cloud graphic for the top 279 WL functions with the largest usage frequency:
Let us see what are the corresponding functionality areas of top279 functions and how many from each area.
Take keys of top279 (which are WL functions), return the corresponding functionality area, count the areas and sort them
The result is very interesting! For example, although the functionality area MathFunctions contains the largest number of functions (279 functions), only 5 of them are among most commonly-used functions.
Generate a word cloud of functionality areas for top 279 function
Comparing with Stephen Wolfram’s book: Elementary Introduction to WL (EIWL)
Comparing with Stephen Wolfram’s book: Elementary Introduction to WL (EIWL)
Now let’s compare our results with Stephen Wolfram’s Elementary Introduction to WL (EIWL), and see how the creator of WL has lead us in learning WL.
Generate list of WL functions per chapter from EIWL:
For example, let’s look at the functions in chapter 10.
Generate list of WL functions in chapter 10 from EIWL:
Generate complete list of functions in EIWL, flatten the list, and remove duplicates:
As you can see, 179 EIWL functions are not among top 279 commonly-used WL functions:
Generate list of functions in eiwlFunctions that are not in top279 (where keys are WL functions):
And here is the breakdown of EIWL functions in terms of the functionality areas.
Generate list of functionality areas in eiwlFunctions, flatten them, count per area and sort them from largest to the smallest:
Generate wold cloud of eiwlFunctionality (keys are functionality area and values the occurrence in EIWL):
Here is the list of functionality areas discussed in EIWL but not among top279Functionality.
Generate list of functions in eiwlFunctionality that are not in top279Functionality (where keys are WL functions):
As one can see, some functionality areas that are not in the top279 cover some important concepts such as GeoGraphicsSymbols, or MachineLearningSymbols. Does it mean the usage frequency is kind of misleading? I think this issue is related to the infamous question of what we should teach to students. When it comes to a job, we don’t use a large portion of the knowledge that we’ve learned at school. Does it mean the mentioned knowledge should be removed from formal education?
Exploring functionality areas more
Exploring functionality areas more
Let us explore the idea of categorising WL functions based off their functionality area.
Create an association by mapping a function over a list of all functionality areas, where the function generates list of WL function with a given functionality area:
As an example, let’s look at the result for the functionality area BlockchainSymbols
Return the value (WL functions) for the functionality area BlockchainSymbols:
Which area is mostly-used? Well, one needs to add up the corresponding usage frequencies for each area.
For each value in the association groupedByArea, generate a new list with elements the corresponding overall usage frequency, and then return its total value:
For example, let’s look at the result for the functionality area TravelSymbols:
Return value (overall usage frequency and the list of WL functions) for the functionality area TravelSymbols:
Get the top 10 functionality areas based off their functions usage frequency:
Generate a pie chart of top10, adding Others which represents any functionality areas other than top10:
So, we found something instructive! The functionality area “BasicSymbols” should be the starting point in the long journey of learning WL. Does it make sense? Let’s take a glimpse look at functions with the functionality area “BasicSymbols”.
Generate the corresponding value of the key BasicSymbols, and return the 2nd element (which is the list of functions, sorted based on the usage frequency):
Get the top 30 mostly-used functions with the functionality area BasicSymbols:
Generate a pie chart of top30, adding Others which represents any functions other than top20:
Concluding remark
Concluding remark
I have been told by many users that WL has a very steep learning curve. That might be true, to some extend, in particular, considering the fact that many programming languages are in the imperative paradigm, while WL is a functional programming language. More importantly, WL is not only a programming language, but also a computational language: “It’s a language that both computers and humans can use to represent computational ways of thinking about things”. Therefore, I suggest a computational approach in learning WL. Where to start? what functions to learn? what functionality areas and more? One can explore these ideas computationally, as I did it here. Of course, what I represent is a very simple analysis. I am looking forward to reading more elaborate analysis by other users, to see how WL can be taught in different disciplines.
