Curin
From RHLUG
Contents |
[edit] Usage
- Log into addiator
- Source the profile scripts (.env if you use bash)
- $ source /scratch/apps/curin/profile.csh
- Test curin
- $ echo '1 + 2
[edit] Quickref
[edit] Passing
Arguments passed are taken as a struct
arg1 | recv arg2, arg3 # Pass three arguments as input to a receiver arg1, arg2, arg3 | recv # ^ Equivalent recv arg1, arg2, arg3 # ^ Equivalent
[edit] Control Flow
() # Explicit precedence ; # Break pipeline ;; # Break pipeline and force sequential ordering
[edit] Data types
- Structs
var: input # Store input in var
var # Output previously stored input
st: {a: 3, b: 2} # nested struct (see assignment)
st.a # access nested element
{fst, snd} st # Struct unpacking (for lists too?) (fix me..)
st* # Explode structure (used when passing)
# e.g. foo st* == foo st.1, st.2, st.n
- Pipes
pipe< input # Push input into pipe pipe> n # Output first n element from pipe
- Lists
List operations work on both pipes and structs
- Functions
[ .. ] # Function creation
[arg1:; .. ] # Arguments as a list (see assignment)
[ ..; out] # Outputting return values
func args # Pass args as input to func
func& # Output a reference to the function
# e.g. clone: func& vs output: func
- Strings
`foo bar' # Create a string
- Magic
$2 + 3$ # Preform magics
[edit] Standard Library
Note: not yet finished
lst | zip # ((1,2,3)(4,5,6)) => (1,4,2,5,3,6)
lst | unzip # reverse zip
lst | merge # ((1,2,3)(4,5,6)) <=> ((1,4),(2,5),(3,6))
lst | unmerge # reverse merge
lst | each func # Iterate over input
lst | pipe # (f1, f2, f3) => (f1 | f2 | f3)
mkseq n, func # (func_1 | func_2 | .. func_n)
mkpar n, func # (func_1, func_2, .. func_n)
tee pipe, lst # Clone pipe as input for element of lst
# Output a list of f1, .. fn outputs
if/switch # control flow

