Comments (3)
It doesn't work because foo
is a runtime definition of a string, and the rash
macro expects, at compile time, a syntax object that contains a string. So the "ls -l"
string and the rash
macro live at two different phases, and what the macro sees is a syntax object with the symbol foo
inside.
I'm not sure what context you are trying to do this in, but there are various approaches you might take to do things that seem to be related.
If you are just trying to use different commands and arguments computed dynamically, you could use variables in the unix command, like this: (rash «$command (compute-args)»)
(Note that the arguments will splice if they are a list. $args
should support splicing too, but I need to improve the dollar expansion to be more flexible -- right now it converts everything into a string, so you can't splice a list of arguments with it.)
If you want a whole pipeline segment to be computed dynamically (eg. to pass something like '(ls -l)
), you could make an operator that just accepts the runtime pipeline-member objects. (This should by all means exist as one of the default available operators, I just haven't made it yet. I am also planning to add better support for using the DSL to create first-class pipeline segments, but I haven't yet decided what I want to do for certain edge cases. But it would be a really easy pipeline operator to make yourself if you want to try your hand at making one.) If you only want this for subprocess pipeline segments, you could also use (rash «(compute-everything)»)
, although that maybe wouldn't make a lot of sense unless it were part of a larger pipeline.
If you want to pass a string specifically instead of a list and have it be parsed as a command, eg. "ls -l"
instead of '(ls -l)
, it would be easy to give this basic support by just splitting the string and passing it to the operator described above. But it wouldn't have support for anything fancy like dollar escapes without a little more elbow grease.
I guess for completeness I might say you could use eval, but that's probably a bad idea for most cases.
Does that help?
from racket-rash.
If you haven't been following Rash, the rash
macro is no longer the recommended way to escape back into line-mode, but rather just using {}
braces is recommended.
Should I close this issue, or is there anything else to address? Thanks.
from racket-rash.
@willghatch Haven't been following new developments but I gave it a try and it looks good. Thanks. Closing.
from racket-rash.
Related Issues (20)
- Save history between sessions? HOT 1
- SIGPIPE issue
- Ctrl-C handling HOT 4
- testing maubot integration
- Relicensing Rash HOT 8
- Allow comment with # in repl HOT 1
- terminal title with current directory HOT 2
- Tab completion does not quote
- ls causes issues with history-delete HOT 18
- Can't exit shell on Mac OS X HOT 2
- Behavior of Control-c (C-c, ^C, SIGINT) when no process is active HOT 3
- How to build documentation? HOT 2
- contract violation on 8.2[cs]? HOT 6
- Resizing terminal emulator
- Rash in Jupyter (with iracket) HOT 5
- multi-line readline prompt with ansi-escapes HOT 3
- Get the exit code of the last command HOT 2
- Tab completion doesn't escape `]`
- Nix flake / nixpkgs package HOT 2
- invalid memory reference HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from racket-rash.