-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(ns wolframite.base.cep | ||
(:require | ||
[wolframite.lib.options :as options] | ||
[wolframite.base.convert :as convert] | ||
[wolframite.base.evaluate :as evaluate] | ||
[wolframite.base.parse :as parse])) | ||
|
||
(defn- identity-first [x & _] x) | ||
|
||
(defn cep | ||
"Convert-Evaluate-Parse pipeline. | ||
Convert: from clj data to jlink Expr | ||
Evaluate: the Expr on (some) Wolfram Engine | ||
Parse: returned result into clj data. | ||
Each stage can be skipped with appropriate `opts` `:flag` e.g. `:no-parse`" | ||
[expr {:keys [flags] | ||
:as opts}] | ||
(let [convert (if (options/flag?' flags :convert) convert/convert identity-first) | ||
evaluate (if (options/flag?' flags :evaluate) evaluate/evaluate identity-first) | ||
parse (if (options/flag?' flags :parse) parse/parse identity-first)] | ||
(-> expr | ||
(convert opts) | ||
(evaluate opts) | ||
(parse opts)))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(ns wolframite.base.cep | ||
(:require | ||
[wolframite.base.convert :as convert] | ||
[wolframite.base.evaluate :as evaluate] | ||
[wolframite.base.parse :as parse] | ||
[wolframite.lib.options :as options])) | ||
|
||
(defn- identity-first [x & _] x) | ||
|
||
(defn cep | ||
"Convert-Evaluate-Parse pipeline. | ||
Convert: from clj data to jlink Expr | ||
Evaluate: the Expr on (some) Wolfram Engine | ||
Parse: returned result into clj data. | ||
Each stage can be skipped with appropriate `opts` `:flag` e.g. `:no-parse`" | ||
[expr {:keys [flags] | ||
:as opts}] | ||
(let [convert (if (options/flag?' flags :convert) convert/convert identity-first) | ||
evaluate (if (options/flag?' flags :evaluate) evaluate/evaluate identity-first) | ||
parse (if (options/flag?' flags :parse) parse/parse identity-first)] | ||
(-> expr | ||
(convert opts) | ||
(evaluate opts) | ||
(parse opts)))) |