Git Product home page Git Product logo

artemis's Introduction

Artemis: the fun-sized ts-powered script machine

what's in the box?

  • easy to learn (we promise)
  • general purpose (like a swiss army knife)
  • built on typescript (because why not?)

how to get it

npm install -g @artemis-lang/cli

how to play

 _____     _             _
|  _  |___| |_ ___ _____|_|___
|     |  _|  _| -_|     | |_ -|
|__|__|_| |_| |___|_|_|_|_|___|

https://github.com/triyanox/artemis

>  artemis <command> [options]

toys in the box:
  artemis run <file>             make it go
  artemis ast <file>             peek inside
  artemis lex <file>             see the building blocks
  artemis save-ast <file> <out>  keep the insides for later
  artemis save-lex <file> <out>  save the blocks for later

extras:
  --version  what version are we on?
  --help     help me, i'm lost

the fun stuff

talking to yourself

/* psst... secret message */
/* this one's
   really long */

making things

(def b "ohai")           /* words */
(def c 1)                /* counting */
(def d true)             /* yes/no */
(def f [1, 2, 3])        /* lists */
(def g {a: 1, b: 2})     /* treasure maps */
(def h #[1, 2, 3])       /* unique lists */
(def bin 0b1010)         /* robot talk */
(def hex 0x12F)          /* wizard numbers */

doing things

(fn add [a b] ((+ a b)))
(fn wrapper [] ((add 1 2)))
(def a (wrapper))
(println a)

(fn addTwo [a]((def sum (+ a 2))(return sum)))
(println (addTwo 1))

making decisions

(if true ((println "yay!"))) 
(if true ((println "yay!")) (println "aww..."))

going in circles

(def a 0)
(while ((< a 10)) ((println a)(def a (+ a 1))))

(for [i 10 20] ((println i)))
(for [i 20 30 2] ((println i)))

playing matchmaker

(def a [])
(match a {
  1 : (println "one!"),
  2 : (for [i 0 10] ((println i))),
  3 : (for [i 0 10] (( def mul ( * (+ i 4 ) 3 ) ) (println mul) )),
  _ : (for [i 0 2] (
        (for [j 0 3] (
          (push a 69)
          (println "inner" j)
          (pop a)
        ))
        (push a 69)
        (println "outer" i)
        (pop a)
      ))
})

math and logic toys

(&& true false)
(|| true false)
(! true)
(== 1 2)
(!= 1 2)

(+ 1 2)
(- 1 2)
(* 1 2)
(/ 1 2)
(% 1 2)
(^ 1 2)

(~ 1)
(<< 1 2)
(>> 1 2)
(>>> 1 2)

built-in goodies

(def a [1, 2, 3])
(print "hi!")
(println "bye!")
(push a 1)
(pop a)
(def l (length a))
(log l)
(fn add [l] ((+ l 1)))
(def m (map a add))
(log a)
(def hi "hi")
(def hi (toUpperCase hi))
(log hi)
(println (repeat hi 2))

(def fileContent (readFile "README.md"))
(println fileContent)
(writeFile "bambo.md" "ohai!")

playing with js

(js $
  const a = 12;
  const b = 23;
  const c = a + b;
  console.log(c);
  const d = "ohai";
  console.log(d);
$)

(def a (js $ 12 $))
(println a)

grabbing things

(def random (get Math "random"))
(def random (get global "Math.random"))

(fn rand [n] ((* n (random))))
(def a (rand 100))
(println a)

(def now (get global "Date.now"))
(println (now))

(def env (get global "process.env"))
(println (get env "HOME"))

(def a {a: 1})
(set a "b" 2)
(println (get a "b"))

show me more!

check out the playgrounds

the boring stuff

MIT (but you can still have fun with it)

artemis's People

Contributors

github-actions[bot] avatar triyanox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.