Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Matlab with s-expressions.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 ampersand.m
Octocat-spinner-32 andFunction.m
Octocat-spinner-32 caret.m
Octocat-spinner-32 cellArray.m
Octocat-spinner-32 cellEqual.m
Octocat-spinner-32 cellminusgreaterThanrstring.m
Octocat-spinner-32 condHelperFirstTrue.m
Octocat-spinner-32 countOf.m
Octocat-spinner-32 deletemtimes.m
Octocat-spinner-32 directoryContents.m
Octocat-spinner-32 directoryDirectories.m
Octocat-spinner-32 directoryFiles.m
Octocat-spinner-32 divide.m
Octocat-spinner-32 divideand.m
Octocat-spinner-32 dotcaret.m
Octocat-spinner-32 dotdivide.m
Octocat-spinner-32 echoReturn.m
Octocat-spinner-32 equal.m
Octocat-spinner-32 equalOneOf.m
Octocat-spinner-32 equal_.m
Octocat-spinner-32 equalcloseParen.m
Octocat-spinner-32 equalcloseSquare.m
Octocat-spinner-32 equaldigit.m
Octocat-spinner-32 equalequal.m
Octocat-spinner-32 equalgreaterThanitems.m
Octocat-spinner-32 equalgreaterThanmaybe.m
Octocat-spinner-32 equalgreaterThannumber.m
Octocat-spinner-32 equalgreaterThanor.m
Octocat-spinner-32 equalgreaterThanstring.m
Octocat-spinner-32 equalgreaterThanzeroOrMore.m
Octocat-spinner-32 equalitem.m
Octocat-spinner-32 equalkeyword.m
Octocat-spinner-32 equallispString.m
Octocat-spinner-32 equallistOfSexpressions.m
Octocat-spinner-32 equalnil.m
Octocat-spinner-32 equalnumber.m
Octocat-spinner-32 equalnumberPhStyle.m
Octocat-spinner-32 equalopenParen.m
Octocat-spinner-32 equalopenSquare.m
Octocat-spinner-32 equalquotedSexpression.m
Octocat-spinner-32 equalsexpression.m
Octocat-spinner-32 equalsexpressionplusspaces.m
Octocat-spinner-32 equalsharpQuotedSexpression.m
Octocat-spinner-32 equalspace.m
Octocat-spinner-32 equalspaces.m
Octocat-spinner-32 equalsymbol.m
Octocat-spinner-32 equalvectorOfSexpressions.m
Octocat-spinner-32 extendStruct.m
Octocat-spinner-32 fif.m
Octocat-spinner-32 fileDirectory.m
Octocat-spinner-32 fileName.m
Octocat-spinner-32 flatAcross.m
Octocat-spinner-32 flatDown.m
Octocat-spinner-32 funcall.m
Octocat-spinner-32 greaterThanequal.m
Octocat-spinner-32 isclass.m
Octocat-spinner-32 keywordp.m
Octocat-spinner-32 lessThan.m
Octocat-spinner-32 lessThanequal.m
Octocat-spinner-32 makeKeyword.m
Octocat-spinner-32 makeSymbol.m
Octocat-spinner-32 minusgreaterThan.m
Octocat-spinner-32 minusminus.m
Octocat-spinner-32 monadic-parser-combinators.m
Octocat-spinner-32 monadic-parser-combinators.parenlab
Octocat-spinner-32 monadicParserCombinators.m
Octocat-spinner-32 monadicParserCombinatorslessThan2greaterThan.m
Octocat-spinner-32 more-info.md
Octocat-spinner-32 mtimesmtimes.m
Octocat-spinner-32 negate.m
Octocat-spinner-32 numericminusgreaterThanrstring.m
Octocat-spinner-32 objectminusgreaterThanplString.m
Octocat-spinner-32 orFunction.m
Octocat-spinner-32 parenlab-aux.el
Octocat-spinner-32 parenlab.el
Octocat-spinner-32 pbind.m
Octocat-spinner-32 pipepipe.m
Octocat-spinner-32 plusplus.m
Octocat-spinner-32 preturn.m
Octocat-spinner-32 progn.m
Octocat-spinner-32 readme.md
Octocat-spinner-32 stringminusgreaterThanrstring.m
Octocat-spinner-32 structAccess.m
Octocat-spinner-32 structAccessdividec.m
Octocat-spinner-32 structEqual.m
Octocat-spinner-32 symbolp.m
Octocat-spinner-32 test.m
Octocat-spinner-32 testFunction.m
Octocat-spinner-32 tests.el
Octocat-spinner-32 tildaequal.m
Octocat-spinner-32 todo.org
Octocat-spinner-32 treeFiles.m
Octocat-spinner-32 valCond.m
readme.md

Parenlab

(Note: parenlab depends on shadchen-el and requires Emacs).

Parenlab is a dirty cross compiler which forces an s-expression front end onto Matlab, a bit like parenscript for Javascript.

It is also a case study in using shadchen, my pattern matching library, to write nice code.

More to come.

More

Parenlab converts this:

(addpath "~/elisp/utils/parenlab/")
(setq file-name (lambda (file)
                          (with parts (tokenize file "/")
                                ({} parts end))))
        (setq is-cross-model-file 
              (lambda (f) (not (== (dsf f nil :train-perc -1) -1))))
        (setq files (ddirnames "ccModelsZeroForced" is-cross-model-file))
        (for i (: 1 (length files))
             (setq file ({} files i))
             (load file)
             (plotCrossModel model)
             (with file (strrep (file-name file)  ".txt" "")
                   (vprint ["crossModel" file])))

To:

addpath('~/elisp/utils/parenlab/');
fileName = @(file)funcall(@(parts)parts{end}, tokenize(file, '/'));
isCrossModelFile = @(f)~(equalequal(dsf(f, [], 'trainPerc', -1), -1));
files = ddirnames('ccModelsZeroForced', isCrossModelFile);
for i = ((1):(length(files)))
  file = files{i};
  load(file);
  plotCrossModel(model);
  funcall(@(file)vprint([ 'crossModel' file ]), strrep(fileName(file), '.txt', ''));
end
;

Parenlab uses Emacs Lisp to give matlab all the wonderful convenience of s-expressions AND meta-programming while still being Matlab. The user can define new macros that operate at the level of the s-expression representation of Matlab code. Underneath, the generated code has access to all the powerful analytic and plotting abilities of Matlab (or Octave, if you are running it.)

Something went wrong with that request. Please try again.