Back
parents (clj)
(source)function
(parents tag)
(parents h tag)
Returns the immediate parents of tag, either via a Java type
inheritance relationship or a relationship established via derive. h
must be a hierarchy obtained from make-hierarchy, if not supplied
defaults to the global hierarchy
Examples
clojure/core.typed
(ns ^:skip-wiki clojure.core.typed.ann.clojure
"Type annotations for the base Clojure distribution."
(:require [#?(:clj clojure.core.typed
:cljs cljs.core.typed)
:refer [defalias] :as t]))
(defalias
^{:doc "A hierarchy for use with derive, isa? etc."
:forms '[Hierarchy]}
t/Hierarchy
'{:parents (t/Map Any Any)
:ancestors (t/Map Any Any)
:descendants (t/Map Any Any)})
originrose/cortex
(ns cortex.nn.network-test
(:require
[clojure.test :refer :all]
[clojure.core.matrix :as m]
[cortex.graph :as graph]
[cortex.nn.layers :as layers]
[cortex.nn.network :as network]))
(deftest build-concatenate
(let [network (network/linear-network [(layers/input 25 25 10 :id :right)
(layers/input 500 1 1 :parents [] :id :left)
(layers/concatenate :parents [:left :right] :id :concat)
(layers/linear 10)])
graph (network/network->graph network)
concat-node (graph/get-node graph :concat)
clean-output-dims (fn [node-id]
(-> (graph/get-node graph node-id)
graph/node->output-dimensions
first
graph/clear-dimension-identifiers))]
(is (= (+ (* 25 25 10) 500)
(graph/node->output-size concat-node)))
(is (= (set [(assoc (clean-output-dims :right)
:id :right)
(assoc (clean-output-dims :left)
:id :left)])
(set (graph/node->input-dimensions concat-node))))))
(deftest out-of-order-description
(let [network (network/linear-network [(layers/input 2 1 1 :id :in)
(layers/linear 2 :parents [:linear-parent])
(layers/linear 2 :id :linear-parent :parents [:in])])
depth-first-seq (graph/dfs-seq (network/network->graph network))]
(is (= [:in :linear-parent :linear-1 :mse-loss-1]
(vec depth-first-seq)))))
hraberg/deuce
(ns deuce.emacs.chartab
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[deuce.emacs.alloc :as alloc]
[deuce.emacs.data :as data]
[deuce.emacs.fns :as fns])
(:import [deuce.emacs.data CharTable]
[java.util Arrays])
(:refer-clojure :exclude []))
(defun char-table-parent (char-table)
"Return the parent char-table of CHAR-TABLE.
The value is either nil or another char-table.
If CHAR-TABLE holds nil for a given character,
then the actual applicable value is inherited from the parent char-table
(or from its parents, if necessary)."
@(.parent ^CharTable char-table))
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
"Type annotations for the base Clojure distribution."
#?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
(:require [clojure.core :as cc]
[typed.clojure :as t]
#?(:clj [typed.ann-macros.clojure :as macros])
#?(:clj typed.ann.clojure.jvm) ;; jvm annotations
#?(:clj clojure.core.typed))
#?(:clj
(:import (clojure.lang PersistentHashSet PersistentList
APersistentMap #_IPersistentCollection
#_ITransientSet
IRef)
(java.util Comparator Collection))))
(t/defalias
^{:doc "A hierarchy for use with derive, isa? etc."
:forms '[Hierarchy]}
t/Hierarchy
'{:parents (t/Map t/Any t/Any)
:ancestors (t/Map t/Any t/Any)
:descendants (t/Map t/Any t/Any)})
#?@(:cljs [] :default [
clojure.java.shell/sh [t/Any :*
;would be nice (combine :* and kw args)
; t/Str :*
;& :optional {:in t/Any ;; any valid input to clojure.java.io/copy
; :inc-enc t/Str :out-env (t/U ':bytes t/Str)
; :env (t/U (Array t/Str) (t/Map t/Any t/Any))
; :dir (t/U t/Str java.io.File)}
:-> '{:exit t/Str
:out (t/U (Array byte) t/Str)
:err t/Str}]
clojure.java.browse/browse-url [t/Any :-> t/Any]
clojure.java.io/delete-file [clojure.java.io/Coercions (t/? t/Any) :-> t/Any]
clojure.java.io/make-parents [(t/+ clojure.java.io/Coercions) :-> t/Any]
clojure.java.io/file [(t/+ clojure.java.io/Coercions) :-> java.io.File]
clojure.java.io/as-relative-path [clojure.java.io/Coercions :-> t/Str]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/reader [clojure.java.io/IOFactory :-> java.io.BufferedReader]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/writer [clojure.java.io/IOFactory :-> java.io.BufferedWriter]
clojure.java.io/resource [t/Str (t/? ClassLoader) :-> (t/Nilable java.net.URL)]
clojure.stacktrace/e [:-> t/Any]
clojure.stacktrace/print-cause-trace [Throwable :-> t/Any]
clojure.stacktrace/print-stack-trace [Throwable :-> t/Any]
clojure.stacktrace/print-throwable [Throwable :-> t/Any]
clojure.stacktrace/root-cause [Throwable :-> Throwable]
;; FIXME keyword arguments
clojure.reflect/reflect [(t/+ t/Any) :-> (t/Map t/Any t/Any)]
clojure.inspector/atom? [t/Any :-> t/Bool]
clojure.inspector/collection-tag [t/Any :-> t/Keyword]
clojure.inspector/tree-model [t/Any :-> t/Any]
clojure.inspector/old-table-model [t/AnySeqable :-> t/Any]
clojure.inspector/inspect [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-tree [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-table [t/AnySeqable :-> javax.swing.JFrame]
])