Calling Ruby scripts from Pico Lisp
I give up. There you have it, the confession. Too much basic stuff is lacking from Pico, as you might know we’ve covered both a way of matching a la PHP’s preg_match and JSON. I’ve realized however that I’m never gonna be finished creating a proper application doing it in 100% Pico.
I’m throwing in the towel and will create pure Pico Lisp libs on a per needed basis, when calling Ruby scripts is not fast enough for example.
Why not go 100% Ruby then? Well we’ve found the Holy Grail here, the Pico Lisp OODB system + GUI framework. I’m not going to give up on that easily.
Here’s an example of how to do it anyway, the Pico call:
(println
(pipe
(call 'ruby "projects/rss-reader/htmldecode.rb" "It’s a lovely world") (line)))
Update: The above interfered with the server, preventing further output, bummer, the below version using (in) works OK though:
(println
(in (list 'ruby "projects/rss-reader/htmldecode.rb" Str) (line)))
The Ruby part:
require 'rubygems'
require 'htmlentities'
coder = HTMLEntities.new
puts coder.decode(ARGV[0])
The output:
("I" "t" "’" "s" " " "a" " " "l" "o" "v" "e" "l" "y" " " "w" "o" "r" "l" "d")
Great, we can move on and actually get something done here.