This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BeginPackage["Unflatten`"] | |
Unflatten::usage = "Unflatten[h[elems], posints, heads] creates a nested structure by wrapping | |
the elements in positions intervals posints in heads heads"; | |
UnflattenNested::usage = "UnflattenNested[expr, {startposlist, endposlist}, head] wraps elements | |
of expr at positions starting at startposlist_i and ending at endposlist_i in head head"; | |
Begin["`Private`"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll[shead]; | |
SetAttributes[shead, HoldAllComplete]; | |
shead[f_Symbol[___]] := HoldComplete[f]; | |
shead[f_[___]] := shead[f]; | |
shead[f_ /; AtomQ[Unevaluated[f]]] := Head[f]; | |
(* TODO:This is a bit too simplisitc,since some pattern symbols might \ | |
be localized by inner rules inside expr,and should not be \ | |
counted.We might miss some extra dependencies this way *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <dirent.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <sys/stat.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BeginPackage["LazyTuples`"] | |
LazyTuples::usage = "LazyTuples[lists, opts] create a LazyList of the specified chunk size (\"ChunkSize\" option), containing tuples of the original lists"; | |
Begin["`Private`"] | |
Needs["Streaming`"]; | |
ClearAll[next]; | |
next[{left_, _}, dim_] := |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BeginPackage["CellTimeTrack`"] | |
CellTimeTrack::usage = "CellTimeTrack[True|False] switches on or off the cell time-tracking mode"; | |
Begin["`Private`"] | |
$style = Function[ | |
arg, | |
StyleBox[arg, FontSize -> 16, FontWeight -> Bold, FontColor -> Darker[Green, 0.5]] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll[openerDress]; | |
SetAttributes[openerDress, HoldAll]; | |
openerDress[f_[args___]]:= | |
OpenerView[{ | |
HoldForm[f], | |
HoldForm[f]@@Map[openerDress,Unevaluated[{args}]] | |
}]; | |
openerDress[x_]:=HoldForm[x]; | |
ClearAll[stackPrettify]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll[Let, let, symbolOrListQ, inSetDelayed]; | |
SetAttributes[{Let, let, symbolOrListQ}, HoldAll]; | |
symbolOrListQ[_Symbol] = True; | |
symbolOrListQ[{___?symbolOrListQ}] = True; | |
symbolOrListQ[_] = False; | |
Let::lvset = "Local variable specification `1` is not valid."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll[csub]; | |
csub[expr_Hold, rules_List, limitCount_] := | |
With[{newrule = | |
Replace[If[# =!= {} && #[[-1, -1]] > 1, #[[-1, 1]], {}] &@ | |
SortBy[Tally[ | |
Cases[expr, | |
x_ /; Depth[Unevaluated[x]] > 2 && | |
LeafCount[Unevaluated[x]] > limitCount :> Hold[x], | |
Infinity]], Last], | |
Hold[x_] :> (HoldPattern[x] -> Unique[])]}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* ::Package:: *) | |
BeginPackage["SimpleJavaReloader`", {"JLink`"}]; | |
JCompileLoad::usage = | |
"JCompileLoad[javacode_,addToClassPath_] attempts to compile a Java \ | |
class defined by a string javacode, optionally adding to Java compiler classpath \ | |
files and folders from addToClassPath, and load the resulting class into \ | |
Mathematica"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Mathematica Package *) | |
(* :Title: SEFormatter *) | |
(* :Author: Leonid B. Shifrin *) | |
(* :Summary: Code formatting palette for mathematica.stackexchange.com | |
(but can be useful also for other formatting purposes) *) | |
(* :Context: SEFormatter` *) |