5 ms·
I have my own scheme-esque language that I use for scripts. 16 of its 48 primitive procedures ~correspond to unix system calls (open, close, read, write, seek,
by frou_dh 12y ago
I have my own scheme-esque language that I use for scripts. 16 of its 48 primitive procedures ~correspond to unix system calls (open, close, read, write, seek, select, stat, link, unlink, mkdir, lsdir, chdir, fork+exec, wait, sleep, exit). It was very instructive to work on, and using something I know inside out is a welcome relief from the uncertainty I feel when intuiting (ba)sh.
- dorfsmay 12y agoAny reason you don't use one of the existing scriptable scheme like guile's?
- frou_dh 12y agoWanted to put my article-gleaned understanding of lisp to the test + get at the essence of what shebang-style unix scripting was about. Here is a reimplementation of "cat" in it: #!/usr/bin/env imp (def copy-out (proc (x) (let f (if (file? x) x (open x)) bytes (read default-chunk f) (if bytes (seq (write bytes stdout) (recur f)) (close f))))) (if (nil? script-args) (copy-out stdin) (each copy-out script-args)) Running external programs is a bit more verbose than normal shell, but there is some optional reader-macro sugar on top of fork+exec, e.g. the effect of the following is that /usr/bin/say gets run with those non-string args converted to strings and a voice comes out of my speaker. !(say hello there) => ((status : 0) (pid : 2945) (in : [File]) (out : [File]) (err : [File]))
- dorfsmay 12y ago> Wanted to put my article-gleaned understanding of lisp to the test fair enough! > get at the essence of what shebang-style unix scripting was about FWIW, although convoluted, you can do that with guile, with: #!/usr/bin/guile \ -e main -s Or simpler with chicken: #!/usr/bin/csi -s
- rml 12y agoIMHO the nicest Scheme for UNIX scripting is scsh. Its APIs are really well thought out and represent a lot of design work that hasn't ever been replicated by another Scheme (at least that I've seen). Some good examples of scsh scripting (some by the author, Olin Shivers) can be found at http://scsh.net/resources/scripts.html http://scsh.net/resources/scripts.html The manual is also very good: http://scsh.net/docu/html/man.html http://scsh.net/docu/html/man.html
- juanuys 12y ago> The manual is also very good The acknowledgements section made my morning, thanks.
- vegedor 12y agoI'm sure it's ironic, not pathologic. Otherwise i'd suggest to leave the Jack 'n Zak. Just assuming that it's in good humor and not actually depressive would be another reason to feel ignored.
- klibertp 12y agoDo you know what is the status of scsh? It's an old project, seemingly unmaintained. Is it considered feature complete? Are there any active users of scsh? What about bugs? Last time I checked a package for scsh for Fedora was somehow broken and/or conflicting with Chicken and I went with the latter. In general I like the idea and APIs of scsh, I'm just afraid that there will be no one to ask for help if I hit some problems. With Chicken or Racket the communities are active and it's easy to find support. How does this look in case of scsh?
- ketralnis 12y agoHave you released the source for it?
- frou_dh 12y agoNah, because given I've never even tried most of the mature alternatives then it would be a faux pas to sell other people on why they should use it.
- ketralnis 12y agoPerhaps. But even if it sucks: if it does at least one thing right, the other mature alternatives can learn another trick.
- vezzy-fnord 12y agoI'd wager scsh would provide a similar experience.
- rakoo 12y agoDon't say it's better than the others then, just say "here's my version, what do you think of it ?". You will always learn something by releasing it.