Skip to content

Commit

Permalink
added doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Sep 11, 2023
1 parent 22ddea4 commit b280c56
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,16 @@ else if (env.isLocal(sym)) {
.arglists("(var-sym-meta v)")
.doc("Returns the var's symbol meta data")
.examples(
"(do \n" +
" (def ^{:foo :test} x 100) \n" +
" (:foo (var-sym-meta 'x))) ")
"(do \n" +
" (def ^{:foo 3} x 100) \n" +
" (:foo (var-sym-meta 'x))) ",
"(do \n" +
" (let [^{:foo 3} x 100] \n" +
" (:foo (var-sym-meta 'x))))",
"(do \n" +
" (defn bar [^{:foo 3} x] \n" +
" (:foo (var-sym-meta 'x))) \n" +
" (bar 100)) ")
.seeAlso(
"var-val-meta", "var-get", "var-name")
.build()
Expand Down Expand Up @@ -260,10 +267,20 @@ public VncVal apply(
.arglists("(var-val-meta v)")
.doc("Returns the var's value meta data")
.examples(
"(do \n" +
" (def x ^{:foo 4} 100) \n" +
" (:foo (var-val-meta 'x))) ",
"(do \n" +
" (def x (vary-meta 100 assoc :foo 4)) \n" +
" (:foo (var-val-meta 'x))) ")
.seeAlso(
" (:foo (var-val-meta 'x))) ",
"(do \n" +
" (let [x ^{:foo 4} 100] \n" +
" (:foo (var-val-meta 'x)))) ",
"(do \n" +
" (defn bar [x] \n" +
" (:foo (var-val-meta 'x))) \n" +
" (bar (vary-meta 100 assoc :foo 4)))")
.seeAlso(
"var-sym-meta", "var-get", "var-name")
.build()
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public void test_var_sym_meta() {
@Test
public void test_var_val_meta() {
// def
assertEquals(4L, new Venice().eval("(do " +
" (def x ^{:foo 4} 100) " +
" (:foo (var-val-meta 'x))) "));

assertEquals(4L, new Venice().eval("(do " +
" (def x (vary-meta 100 assoc :foo 4)) " +
" (:foo (var-val-meta 'x))) "));
Expand Down

0 comments on commit b280c56

Please sign in to comment.