woxi 0.1.0

Interpreter for a subset of the Wolfram Language
Documentation
# Map, Apply, Fold, FoldList, Nest, NestList tests

# Anonymous identity function
$ wo '#&[1]'
1

# Function application
$ wo '#^2 &[{1, 2, 3}]'
{1, 4, 9}

# Nested function application
$ wo 'Plus[Divide[6, 2], Abs[-5]]'
8

# `/@` (Map): Apply a function to each element of a list.
$ wo 'Sign /@ {7, -2, 0, -5}'
{1, -1, 0, -1}
$ wo '#^2& /@ {1, 2, 3}'
{1, 4, 9}

$ wo 'Sin@(Pi/2)'
1

$ wo '(Pi/2) // Sin'
1

# Define and use a function
$ wo 'Double[x_] := x * 2; Double[5]'
10
# $ wo 'Double[x_] := x * 2; Double[Sin[Pi/2]]'
# 2
# $ wo 'Double[x_] := x * 2; Double @ Sin @ (Pi/2)'
# 2
# $ wo 'Double[x_] := x * 2; (Pi/2) // Sin // Double'
# 2

# # Apply (@@): Replaces the head of an expression with a function.
# $ wo 'f @@ {1, 2, 3}'
# f[1, 2, 3]

# # Fold (Fold): Applies a function cumulatively to elements of a list,
# # starting with an initial value.
# $ wo 'Fold[Plus, 0, {1, 2, 3}]'
# 6

# # FoldList (FoldList): Like Fold, but returns a list of intermediate results.
# $ wo 'FoldList[Plus, 0, {1, 2, 3}]'
# {0, 1, 3, 6}

# # Nest (Nest): Applies a function repeatedly to an expression.
# $ wo 'Nest[f, x, 3]'
# f[f[f[x]]]

# # NestList (NestList): Like Nest, but returns a list of intermediate results.
# $ wo 'NestList[f, x, 3]'
# {x, f[x], f[f[x]], f[f[f[x]]]}

$ wo 'StringStartsQ[DateString[Now, "ISODateTime"], "2025-"]'
True