Namespace funnyqt.utils

Generic utility functions, e.g., for signaling errors, debugging, and profiling,

Other Namespaces

Show/Hide
funnyqt.bidi
Bidirectional transformations (BX).
funnyqt.coevo.tg
Co-Evolution transformations on TGraphs.
funnyqt.edn
Printing/persisting and reading/loading query results and transformation traces as EDN.
funnyqt.emf
Core functions for accessing and manipulating EMF models.
funnyqt.extensional
Specify models extensionally.
funnyqt.generic
Generic protocols extended upon many different types, and generic functions.
funnyqt.in-place
In-place transformation stuff.
funnyqt.model2model
Rule-base out-place transformations similar to ATL or QVTo.
funnyqt.pmatch
Graph Pattern Matching on arbitrary models.
funnyqt.polyfns
Polymorphic functions dispatching on types of model elements.
funnyqt.query
Generic query functions like regular path expressions & quantified expressions.
funnyqt.query.emf
EMF-specific query functions
funnyqt.query.tg
TG-specific query functions
funnyqt.relational
Relational Model Querying.
funnyqt.tg
Core functions for accessing and manipulating TGraphs.
funnyqt.visualization
Model visualization functions.
funnyqt.xmltg
Convert XML to DOM-like TGraphs.
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

Show/Hide
Generic utility functions, e.g., for signaling errors, debugging, and profiling, 
Back to top

Details of Public Vars

Protocol: IOrderedSetConvertible

Docstring:
==========

  No docs attached.

Extenders:
==========

  - class flatland.ordered.set.OrderedSet
  - interface java.util.Collection
  - class java.lang.Object
  - nil

Signatures:
===========

  (oset this)
  
    Converts this into an ordered set.

Back to top View Source

Function: array-pset

Arglists:
=========

  (array-pset)
  (array-pset x)
  (array-pset x y & more)

Docstring:
==========

  Returns an ArrayPSet containing the given args.  ArrayPSets cannot contain
  nil, so nil args are not considered, e.g., (array-pset nil) returns the empty
  ArrayPSet.
Back to top View Source

Macro: assert-flat-oset

Arglists:
=========

  (assert-flat-oset obj)

Docstring:
==========

  Asserts that obj is an ordered set containing no collections, only flat
  objects.  (Only evaluates, iff clojure.core/*assert* is true.)
Back to top View Source

Macro: compile-if

Arglists:
=========

  (compile-if exp then else)

Docstring:
==========

  Evaluate `exp` and if it returns logical true and doesn't error, expand to
  `then`.  Else expand to `else`.

  (compile-if (Class/forName "java.util.concurrent.ForkJoinTask")
  (do-cool-stuff-with-fork-join)
  (fall-back-to-executor-services))
Back to top View Source

Macro: compile-when

Arglists:
=========

  (compile-when exp & then)

Docstring:
==========

  Evaluate `exp` and if it returns logical true and doesn't error, expand to
  `then`.  Else expand to `else`.

  (compile-when (and (< (:minor *clojure-version*) 4)
  (= (:major *clojure-version*) 1))
  ;; Can't live without mapv and filterv!
  (defn mapv [...] ...)
  (defn filterv [...] ...))
Back to top View Source

Macro: doseq+

Arglists:
=========

  (doseq+ seq-exprs & body)

Docstring:
==========

  An enhanced version of clojure.core/doseq with the following additional
  features.

  - :let [var exp,...]    may occur as first element
  - :when exp             may occur as first element
  - :when-let [var expr]  bindings

  As a special case, (doseq+ [] x) executes x once.
Back to top View Source

Macro: doseq-1

Arglists:
=========

  (doseq-1 seq-exprs & body)

Docstring:
==========

  Like clojure.core/doseq but based on iterators without support for chunked
  seqs and :while.  The expressions must all be Iterable, Iterators, or Maps.
Back to top View Source

Macro: error

Arglists:
=========

  (error msg)
  (error msg cause)

Docstring:
==========

  Throws an exception with the given message and cause.
Back to top View Source

Macro: errorf

Arglists:
=========

  (errorf msg & objs)

Docstring:
==========

  Throws an exception with the given `msg` and `objs` passed to `format`.
  `msg` is a format string.
Back to top View Source

Function: fn-name

Arglists:
=========

  (fn-name f)

Docstring:
==========

  Returns the name of the given function f.
Back to top View Source

Macro: for+

Arglists:
=========

  (for+ seq-exprs body-expr)

Docstring:
==========

  An enhanced version of clojure.core/for with the following additional
  features.

  - :let [var exp,...]    may occur as first element
  - :when exp             may occur as first element
  - :when-let [var expr]  bindings

  As a special case, (for+ [] x) returns [x].
Back to top View Source

Macro: for-1

Arglists:
=========

  (for-1 seq-exprs body-expr)

Docstring:
==========

  Like clojure.core/for but based on iterators without support for chunked
  seqs.  The expressions in seq-exprs must all be Iterable, Iterators, or
  Maps.
Back to top View Source

Function: into-oset

Arglists:
=========

  (into-oset to from)
  (into-oset to xform from)

Docstring:
==========

  Returns an ordered-set of all given arguments which must be collections.
Back to top View Source

Function: iterator

Arglists:
=========

  (iterator coll)

Docstring:
==========

  Returns a java.util.Iterator for the given coll which may also be nil or a
  map.  Anything implementing Iterable will do.
Back to top View Source

Function: map-nn

Arglists:
=========

  (map-nn f coll)

Docstring:
==========

  map non-nil: Like `map` but return only the seq of values for which (f x) is
  non-nil.  Thus, the resulting sequence may be shorter than `coll`.  This is
  actually a transducer variant of (remove nil? (map f coll)).
Back to top View Source

Function: mapc

Arglists:
=========

  (mapc f coll)

Docstring:
==========

  Like map but for side-effects only.  Returns nil.
Back to top View Source

Function: no-dups

Arglists:
=========

  (no-dups)
  (no-dups coll)

Docstring:
==========

  Returns a lazy sequence of the elements of `coll` with duplicates removed.
  If `coll` is a unique collection (e.g., a Set), simply returns that again.
  With no args, returns a transducer.
Back to top View Source

Method: oset

Specified by protocol IOrderedSetConvertible.

Arglists:
=========

  (oset this)

Docstring:
==========

  Converts this into an ordered set.
Back to top View Source

Function: pr-identity

Arglists:
=========

  (pr-identity x)
  (pr-identity title x)

Docstring:
==========

  Returns and pretty prints the given argument `x` (preceeded by an optional
  `title`.
Back to top View Source

Function: prewalk

Arglists:
=========

  (prewalk edit-fn form)
  (prewalk edit-fn skip-fn form)

Docstring:
==========

  Do a pre-order traversal of `form` calling `skip-fn` and `edit-fn` on subforms.
  `edit-fn` is called on each subform and its result replaces the original
  subform.  The replacement is not subject to any further traversal.  If
  `skip-fn` returns logical true, this complete subform is skipped in the
  traversal, i.e. also all children won't be traversed.
Back to top View Source

Function: prop-name?

Arglists:
=========

  (prop-name? n)

Docstring:
==========

  Returns true, iff `n` is possibly a property name.
  Property names (attributes, roles, references) are denoted as keywords.
Back to top View Source

Function: qname?

Arglists:
=========

  (qname? n)

Docstring:
==========

  Returns true, iff `n` is possibly a element qualified name.
  Qualified names are denoted as symbols.
Back to top View Source

Function: replace-word

Arglists:
=========

  (replace-word s old new)

Docstring:
==========

  No docs attached.
Back to top View Source

Function: satisfies-protocol?

Arglists:
=========

  (satisfies-protocol? x protocol msg)

Docstring:
==========

  No docs attached.
Back to top View Source

Function: split-qname

Arglists:
=========

  (split-qname qn)

Docstring:
==========

  Given a qualified name `qn` as string, symbol, or keyword, returns a vector
  of the form ["foo.baz" "Bar" "foo.baz.Bar"], i.e., package name, simple
  name, qname.

  For an attribute qualified name foo.baz.Bar.attr, it returns
    ["foo.baz.Bar" "attr" "foo.baz.Bar.attr"],
  i.e., owning element qname, attribute name, attribute qname.
Back to top View Source

Function: time-str

Arglists:
=========

  (time-str in unit)

Docstring:
==========

  Converts a time value `in` in nanoseconds to a string "<time> <unit>".
  Valid units are :nano, :micro, :milli, :sec, and :auto meaning to convert to
  a unit in which there are at most 4 digits before the decimal separator.
Back to top View Source

Macro: timing

Arglists:
=========

  (timing fmt form & args)

Docstring:
==========

  Times the execution of `form` and returns its result.
  Additionally, prints (format fmt args), where two new formatters are
  available:

  %T: the timing information with an appropriate unit
  %T(nano|micro|milli|sec): forces the given unit
  %R: the result of evaluating `expr`
  %F: the input form that is timed

  Example:

  user> (timing "%s It took %T to eval %F to %R." (take 10 (iterate inc 0)) ";")
  ; It took 311.945 ┬Ás to eval (take 10 (iterate inc 0)) to (0 1 2 3 4 5 6 7 8 9).
  (0 1 2 3 4 5 6 7 8 9)
Back to top View Source

Function: type-spec?

Arglists:
=========

  (type-spec? n)

Docstring:
==========

  Returns true, iff `n` is possibly a type specification.
  Examples for valid type specs:
    pkg.Foo, Bar!, bla.Bla, [Foo Bar !Baz], [:and !Foo !Bar]
Back to top View Source

Function: type-with-modifiers

Arglists:
=========

  (type-with-modifiers name)

Docstring:
==========

  Given a type name with modifiers (Foo, !Foo, Foo!, !Foo!), returns a tuple
  of form [neg name exact].
Back to top View Source

Function: unique-coll?

Arglists:
=========

  (unique-coll? l)

Docstring:
==========

  Returns true if `l` is a unique collection, i.e., any element may occur at
  most once.
Back to top View Source