Leonid Shifrin lshifr

View CommonSubexpressionEliminator.m
1 2 3 4 5 6 7 8 9 10
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[])]},
View SimpleJavaReloader.m
1 2 3 4 5 6 7 8 9
(* ::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";
View SEFormatter.m
1 2 3 4 5 6 7 8 9 10
(* 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` *)
View lincomp.c
1 2 3 4 5 6 7 8 9 10
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
 
 
int random_in_range (unsigned int min, unsigned int max)
{
int range = max - min,
remainder = RAND_MAX % range,
bucket = RAND_MAX / range;
View EntireTableReader.m
1 2 3 4 5 6 7 8 9 10
JCompileLoad@"
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.Arrays;
public class EntireTableReader{
public static float[] getFloatTable(String filename, int rowByteCount, int rowChunkSize)
View SimpleOO.m
1 2 3 4 5 6 7 8 9 10
(* Mathematica Package *)
 
BeginPackage["SimpleOO`"]
(* Exported symbols added here with SymbolName::usage *)
 
Object;
View RawVCS.m
1 2 3 4 5 6 7 8 9
(* Mathematica Package *)
 
BeginPackage["RawVCS`", { "RuleTreeInfo`", "GithubGistClient`", "FileInfo`", "GithubGistProjectInfo`", "OO`", "OO`Methods`", "OO`Errors`"}]
(* Exported symbols added here with SymbolName::usage *)
 
RawVCS;
 
 
Begin["`Private`"] (* Begin Private Context *)
View GithubGistProjectInfo.m
1 2 3 4 5 6 7 8 9 10
(* Mathematica Package *)
 
BeginPackage["GithubGistProjectInfo`", { "RuleTreeInfo`", "OO`", "OO`Methods`", "OO`Errors`"}]
(* Exported symbols added here with SymbolName::usage *)
 
GithubGistProjectInfo;
 
Begin["`Private`"] (* Begin Private Context *)
 
join = Function[{dir, file}, FileNameJoin[{dir, file}]];
View FileInfo.m
1 2 3 4 5 6 7 8 9 10
(* Mathematica Package *)
 
BeginPackage["FileInfo`", {"OO`","OO`Methods`","OO`Errors`", "RuleTreeInfo`"}]
(* Exported symbols added here with SymbolName::usage *)
 
FileInfo;
 
Begin["`Private`"] (* Begin Private Context *)
 
join = Function[{dir, file}, FileNameJoin[{dir, file}]];
View PackageManipulations.m
1 2 3 4 5 6 7 8 9
(* ::Package:: *)
 
(*......................................................................*)
 
 
 
(* :Title: PackageManipulations *)
 
(* :Author: Leonid B.Shifrin *)
Something went wrong with that request. Please try again.