Re: Question for understanding usage of pipes

2021-01-15 Thread Alexander Burger
On Fri, Jan 15, 2021 at 08:13:58PM +0100, Davide BERTOLOTTO wrote: > In a more functional way: Oh, I see! The original question was about pipes. Directly in Lisp it is of course easier. I would use 'replace': (sort (in "5.input" (make (while (line)

Re: Question for understanding usage of pipes

2021-01-15 Thread Christos Gitsis
Thank you Alexander for the quick and detailed answer and Davide for the repository link. For day 5 my try using Alexander's advice is: (in '(sh "-c" "tr FBLR 0101 < 5.input | sort -r") (let N (bin (line T)) (prinl "Part one " N) (loop (NIL (= (dec 'N) (bin (line T))) (prinl "Part two

Re: Question for understanding usage of pipes

2021-01-15 Thread Mike
January 15, 2021 7:21 PM, "Christos Gitsis" wrote: > > Is there a way to do this and get the result: > -> ("0001110111" "1000110111" "1100110100") > ? https://envs.sh/BF.l This is my code how i *feel* this task. (mike) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Question for understanding usage of pipes

2021-01-15 Thread Davide BERTOLOTTO
In a more functional way: (de proc-char (C) (case C ("B" 1) ("R" 1) ("F" 0) ("L" 0))) (de proc-str (S) (pack (mapcar 'proc-char S))) (de proc-file (F) (let Inp (filter 'and (split (in F (till)) "\n")) (mapcar 'proc-str

Re: Question for understanding usage of pipes

2021-01-15 Thread Alexander Burger
Hi Christos, > $ tr FBLR 0101 < 5.input # or cat 5.input | tr FBLR 0101 This could be (pipe (in "5.input" (out '(tr "FBLR" "0101") (echo)) ) (make (until (eof) (and (line T) (link @)) ) ) ) > And finally I want to add one more preprocessing step,

Question for understanding usage of pipes

2021-01-15 Thread Christos Gitsis
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