JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

Community documentation for Janet

Supported Modules

Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!

Loading...

Random Examples

(math/acos 0.3)
1.2661036727795
math/acosbtbytesPlayground
(get default-peg-grammar :a)
# => '(range "az" "AZ")
default-peg-grammarsogaiuPlayground
(map dictionary? [ 'ab   :ab   "ab"   @"ab"  [97 98]  @[97 98]  {0 97 1 98}  @{0 97 1 98}  ])
# =>            @[ false false false  false  false    false     true         true          ]

(map struct?     [ 'ab   :ab   "ab"   @"ab"  [97 98]  @[97 98]  {0 97 1 98}  @{0 97 1 98}  ])
# =>            @[ false false false  false  false    false     true         false         ]

(map table?      [ 'ab   :ab   "ab"   @"ab"  [97 98]  @[97 98]  {0 97 1 98}  @{0 97 1 98}  ])
# =>            @[ false false false  false  false    false     false        true          ]
struct?cellularmitosisPlayground
(flatten-into @[1 2 3] @[[4 5 6] @[7 8 9] @[10 11 12]]) # => @[1 2 3 4 5 6 7 8 9 10 11 12]
flatten-intojgartePlayground
(max 1 2 3)             # => 3
(max (splice [1 2 3]))  # => 3
(max ;[1 2 3])          # => 3
(apply max [1 2 3])     # => 3
maxcellularmitosisPlayground
(/ 2)
# => 0.5
/sogaiuPlayground
(drop 1 "smile")
# => "mile"
dropsogaiuPlayground
((juxt + - * /) ;[1 2 3])
# => '(6 -4 6 0.166667)
juxtsogaiuPlayground
(let [x false]
  (var y 0)
  (unless x
    (++ y)
    (++ y))
  y)
# => 2
unlesssogaiuPlayground
(string/ascii-upper "hello")  # => "HELLO"
string/ascii-uppercellularmitosisPlayground
(scan-number "123") # => 123
(scan-number "f") # => nil

(scan-number 123) # =>
# error: bad slot #0, expected string|symbol|keyword|buffer, got 123
#   in scan-number
#   in _thunk [repl] (tailcall) on line 1, column 1
scan-numberswlkrPlayground
(forv i 0 10
 (print "hello"))

# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => nil
forvjgartePlayground
(array/pop @[]) # => nil
array/popjgartePlayground
# build own map-indexed with map

(defn map-indexed [f ds]
    (map f (range 0 (length ds)) ds))

(map-indexed (fn [i v] [i v] ) ["a" "b" "c" "d"])

# => @[(0 "a") (1 "b") (2 "c") (3 "d")]
mapleobmPlayground
(bnot 255)  # => -256
bnotcellularmitosisPlayground