Hello, I am learning picolisp and in the context of solving an exercise (from Advent of Code 2020) I have stumbled upon this question.
Given an input file named 5.input with contents: BFFFBBFRRR FFFBBBFRRR BBFFBBFRLL Say I read the contents into a list with e.g. : (in "5.input" (make (until (eof) (let (s (line T)) (when s (link s)))))) -> ("BFFFBBFRRR" "FFFBBBFRRR" "BBFFBBFRLL") Next step is, I want inside picolisp to read not the file directly, but through a preprocessing step with the program tr, i.e. what in the shell would be $ tr FBLR 0101 < 5.input # or cat 5.input | tr FBLR 0101 1000110111 0001110111 1100110100 And finally I want to add one more preprocessing step, sorting, like $ tr FBLR 0101 < 5.input | sort # or cat 5.input | tr FBLR 0101 | sort 0001110111 1000110111 1100110100 I have not come very far. I know that using (in ... ) I can replace the file "5.input" with '(cat "5.input") and get the same result, but instead the attempt to replace i t with e.g. '(tr "FBLR" "0101" "<" "5.input") fails with: usage: tr [-Ccs] string1 string2 tr [-Cc] -d string1 tr [-Cc] -s string1 tr [-Cc] -ds string1 string2 -> NIL And so do other attempts at various combinations of (pipe ...), (in ..), (exec ...) etc. Is there a way to do this and get the result: -> ("0001110111" "1000110111" "1100110100") ? Regards, Christos Gitsis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe