jx_repl(1)

πŸ“¦
version 9.9 Β· 3 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– jx_repl β€” the manual, but make it a group chat πŸ’–

okay bestie, so this is the jx_repl(1) page from the Cooperative Computing Tools set, and I'm about to make it make sense, no cap. grab a strawberry πŸ“ and let's go.

✨ NAME ✨

jx_repl β€” an interactive command line tool to explore the JX language. that's it, that's the whole vibe. it's giving "REPL but make it JX" πŸ’…


🌸 SYNOPSIS 🌸

jx_repl

like. that's literally all of it. no flags, no args, no drama. just type the name and go, queen πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

jx_repl is an interactive tool to explore the JX language. here's the loop, and honestly the way it works is so satisfying:

  1. it reads in a JX expression
  2. it evaluates it
  3. it prints the result
  4. it saves both the query and the result into the context

so every single thing you type? remembered. every answer? also remembered. iconic behaviour tbh.

here's the part that makes it actually useful for real work β€” the memory situation:

  • results of previous expressions can be referenced via the out_%d symbol
  • their corresponding query can be referenced via the in_%d symbol

(the %d is a number, iykyk. so out_0, in_0, out_1, in_1, etc.)

the program will exit on EOF, or when the user enters quit or exit. so like, Ctrl-D out, or just say the word, both work 🫢


πŸŽ€ reserved symbols (the secret menu) πŸŽ€

jx_repl also reserves certain symbols in the context to act as commands when entered. so if you type one of these instead of an expression, it does a thing:

  • help β€” display a help message which lists details on reserved commands.
  • functions β€” display a list of functions supported by the JX language.
  • values β€” display a list of values supported by the JX language.
  • operators β€” display a list of operators supported by the JX language.
  • catalog β€” fetch the catalog data.
  • exit β€” exit the program.
  • quit β€” same as exit.

not me making "quit" and "exit" both available because we deserve options 😌


⭐ EXIT STATUS ⭐

Will always return 0. always. no matter what. she does not do error codes, she does not do beef. zero, every time, periodt. πŸ’…


🌈 EXAMPLES 🌈

just run it with no parameters, bestie

% jx_repl
Welcome to the JX Language Explorer.

Type 'help' for help

in_0  >>>

the prompt is literally sitting there waiting for you, main character energy 🌟


enter any valid JX expression

% jx_repl
in_0  >>> [ "file" + x + ".txt" for x in range(3) ]
out_0 <<<
[
  "file0.txt",
  "file1.txt",
  "file2.txt"
]

look at that list comprehension go. ate and left no crumbs πŸ”₯


fetch the catalog data

% jx_repl
in_1  >>> catalog
out_1 <<<
[
  {
    "name":NAME,
    "lastheardfrom":1620308581,
    "address":ADDRESS,
    ...
    "type":"wq_factory"
  },

  ...
]

one word, catalog, and suddenly you have the whole catalog. the way that works. 😭✨


perform operations on previous output

% jx_repl
in_2  >>> select(type=="wq_master", out_1)
out_2 <<<
[

  {
    "name":NAME,
    "lastheardfrom":1620308755,
    "address":ADDRESS,
    "tasks_total_disk":0,
    "tasks_total_memory":0,
    ...
    "type": wq_master
  }
  ...
]

see how it reaches back into out_1? that's the whole point of the numbered memory thing. it's giving ✨continuity✨


do more operations on previous output

% jx_repl
in_4  >>> join(project(name, out_2), ", ")
out_4 <<< NAME_1, NAME_2, NAME_3, ..., NAME_N

chaining on chaining on chaining. obsessed. 🧚


now, fetch the query used to attain that output

% jx_repl
in_5  >>> in_4
out_5 <<< join(project(name,select(type=="wq_master",fetch("http://catalog.cse.nd.edu:9097/query.json"))),", ")

yes. you can ask it what did I type to get here by referencing in_4. the receipt is right there. πŸ‘‘


call one of reserved commands

% jx_repl
in_7  >>> help

  help          display this message
  functions     display a list of functions supported by the JX language
  values        display a list of values supported by the JX language
  operators     display a list of operators supported by the JX language
  in_#          the #'th input query
  out_#         result of in_#
  catalog       alias to fetch catalog data
  quit|exit     exit program

there it is, the whole cheat sheet, exactly as help prints it. in_# is the #'th input query, out_# is the result of in_#, and catalog is just an alias to fetch catalog data. slay.


The Cooperative Computing Tools are Copyright (C) 2005-2019 The University of Notre Dame. This software is distributed under the GNU General Public License. See the file COPYING for details.

(so like, it's free software, respect the license, that's the vibe 🌸)


okay and that's the whole page!! πŸŽ€ this was CCTools 8.0.0 DEVELOPMENT, and the page itself is jx_repl(1). go forth and explore the JX language, bestie β€” you're gonna do amazing πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from