Function Repository Resource:

AugmentedTerse

Source Notebook

An operator form of Short with an alternative compressed representation of the output

Contributed by: Seth J. Chandler

ResourceFunction["AugmentedTerse"][][expr]

produces a List in which the first part is expr with Short applied and the second part is the Dimensions of expr.

ResourceFunction["AugmentedTerse"][n][expr]

produces an output of about n lines as the first part of the output.

Details and Options

ResourceFunction["AugmentedTerse"][n,"Augmentation"f][expr] results in the second part of the output being the function f applied to expr.

Examples

Basic Examples (1) 

Get a Short form of an Array and its Dimensions:

In[1]:=
ResourceFunction["AugmentedTerse"][][Array[x, {5, 6}]]
Out[1]=

Scope (3) 

Control the Length of the Short form:

In[2]:=
ResourceFunction["AugmentedTerse"][6][Array[x, {100, 200}]]
Out[2]=

An infix form of the AugmentedTerse operator:

In[3]:=
Array[x, {100, 200}]~ResourceFunction["AugmentedTerse"]~3
Out[3]=

AugmentedTerse can be used as a function in which the first argument is the data to be shortened and the second argument is the approximate number of lines desired:

In[4]:=
ResourceFunction["AugmentedTerse"][Range[10000], 3]
Out[4]=

Options (3) 

Augmentation (3) 

Get the Hash of the output instead of the Dimensions:

In[5]:=
ResourceFunction["AugmentedTerse"][6, "Augmentation" -> Hash][
 Array[x, {100, 200}]]
Out[5]=

Find the ByteCount of the output instead of the Dimensions:

In[6]:=
ResourceFunction["AugmentedTerse"][6, "Augmentation" -> ByteCount][
 Array[x, {100, 200}]]
Out[6]=

Set the "Augmentation" option to ListLinePlot to produce a visual representation of the output from a Collatz problem instead of its Dimensions:

In[7]:=
FixedPointList[If[EvenQ[#], #/2, 3 # + 1] &, 67, 100] // ResourceFunction["AugmentedTerse"][2, "Augmentation" -> (ListLinePlot[#, PlotRange -> All] &)]
Out[7]=

Applications (1) 

Split the Fisher iris data on whether the value of the second feature is less than 3.5, and then show the features of the flowers falling into each category as well as the mean value of each of the features:

In[8]:=
ResourceFunction[
ResourceObject[<|"Name" -> "MapReduceOperator", "ShortName" -> "MapReduceOperator", "UUID" -> "856f4937-9a4c-44a9-88ae-cfc2efd4698f", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Like an operator form of GroupBy, but where one also specifies a reducer function to be applied", "RepositoryLocation" -> URL[
      "https://www.wolframcloud.com/objects/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$ad7fe533436b4f8294edfa758a34ac26`MapReduceOperator", "FunctionLocation" -> CloudObject[
      "https://www.wolframcloud.com/obj/6d981522-1eb3-4b54-84f6-55667fb2e236"]|>, ResourceSystemBase -> Automatic]][(#[[1, 2]] < 3.5 &) -> First, ResourceFunction["AugmentedTerse"][
   "Augmentation" -> (ArrayReduce[Mean, #, 1] &)]][
 ExampleData[{"MachineLearning", "FisherIris"}, "Data"]]
Out[8]=

Properties and Relations (1) 

AugmentedTerse with Nothing as the value of the "Augmentation" option produces the same output as the resource function Terse, except the result is wrapped in a List:

In[9]:=
ResourceFunction["AugmentedTerse"][8, "Augmentation" -> Nothing][
 Range[100000]]
Out[9]=

Publisher

Seth J. Chandler

Version History

  • 1.0.0 – 08 March 2021

Related Resources

License Information