I'm playing with Turtle and I'm faced with the following problem.
I want to do something like (in shell)
ls | grep 'foo'
My attempt using Turtle is
grep (prefix "foo") (ls ".") & view
But I got the following message
Couldn't match type ‘Turtle.FilePath’ with ‘Text’
Expected type: Shell Text
Actual type: Shell Turtle.FilePath
In the second argument of ‘grep’, namely ‘(ls ".")’
In the first argument of ‘(&)’, namely
‘grep (prefix "foo") (ls ".")’
I understand ls returns FilePath whereas grep works on Text, so what can I do ?
Update
There are obviously solutions which involves converting back and forth from FilePath to Text. That's beyond the simplicity I would expect shell-like program.
Someone mentioned the find function, which somehow could solves the problem.
However find is the equivalent to the find shell function and I was trying just to do ls | grep "foo". I'm not trying to solve a real life problem (if I were, I would switch to bash instead) but trying to combine simple bricks as I would do in bash. Unfortunately, it doesn't seem that bricks in Turtle are that easy to combine :-(.