Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'Pascal Jasmin' via Programming
found code skeleton, with 1 and 2 character whitelists (can be longer) cocurrent 'jon' NB. can't have all 3 @[& if you want to forbid ^: NB. should run in context that limits space and time. safe1 =: '''_0123456789+*-<>|;,#{}()]~' safe2 =: 'u:';'x:';'}.';'}:';'" ';'":';'! ';'$ ';'= ';'^ ';'^.

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'Pascal Jasmin' via Programming
you can sanitize to white listed functions.  I think I've posted this before, but cannot find the code.  The basics are J primitives, and select foreigns without allowing assignment.  J can self tokenize a sentence with ;: On Tuesday, February 18, 2020, 03:17:23 p.m. EST, 'Jim Russell' via

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread Raul Miller
J does not currently have facilities for tracking malicious user input and ensuring that it's treated safely. (This is an open-ended issue.) As a consequence, the developer must ensure that input from untrusted users is sufficiently cleaned before it's used, or that J is executing in a "safe" envi

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'Jim Russell' via Programming
Does the "do" approach involve risks like SQL injection risks? How does one ensure that a user response doesn't include malicious J code? > On Feb 18, 2020, at 1:34 PM, PMA wrote: > > Bob, Jimmy, Pascal -- > Just plain old Do fercrisake. > Omg, I feel like an idiot! > (Happy, o'course) > > Se

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread PMA
Oo, elegant! I expect I'll be using this Thanks again On 02/18/2020 01:52 PM, 'robert therriault' via Programming wrote: No worries, Pete I may be misreading how you are using this, but does the following have any application? s=. 'test' (s)=. 4 test 4 You can assign results

Re: [Jprogramming] constant substitution

2020-02-18 Thread Raul Miller
Oops, I inadvertently left out the definition of Cmn. (Odd.. I thought I remembered copying that into my message.) Anyways, it was really basic; Cmn=: 2 :'m+n' Thanks, -- Raul On Mon, Feb 17, 2020 at 11:18 AM Raul Miller wrote: > > So here's the deal with Henry's point 3: > >Cxmny=: 2

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'robert therriault' via Programming
No worries, Pete I may be misreading how you are using this, but does the following have any application? s=. 'test' (s)=. 4 test 4 You can assign results to a variable within parentheses that is evaluated and the assignment is to the value of the variable Cheers, bob > On Feb 18,

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread PMA
...with hyphens in the spaces, etc On 02/18/2020 01:36 PM, PMA wrote: Bob, Jimmy, Pascal -- Just plain old Do fercrisake. Omg, I feel like an idiot! (Happy, o'course) See, I'll be using the quotes in one string as the var NAME that this function's output will be assigned to. A little cumbersom

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread PMA
Bob, Jimmy, Pascal -- Just plain old Do fercrisake. Omg, I feel like an idiot! (Happy, o'course) See, I'll be using the quotes in one string as the var NAME that this function's output will be assigned to. A little cumbersome, but hey... Thanks again! Cheers back!!! Pete On 02/18/2020 12:27 PM

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'Pascal Jasmin' via Programming
not adding much but, '2+2' ,&". '1+1' 4 2 On Tuesday, February 18, 2020, 12:30:27 p.m. EST, Jimmy Gauvin wrote: Another variant :   exec =: 4 : 0 : ('Left';x;". x),:'Right';y;". y )   '1+1' exec '2+2' ┌─┬───┬─┐ │Left │1+1│2│ ├─┼───┼─┤ │Right│2+2│4│ └─┴───┴─┘ On Tue, Fe

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread Jimmy Gauvin
Another variant : exec =: 4 : 0 : ('Left';x;". x),:'Right';y;". y ) '1+1' exec '2+2' ┌─┬───┬─┐ │Left │1+1│2│ ├─┼───┼─┤ │Right│2+2│4│ └─┴───┴─┘ On Tue, Feb 18, 2020 at 12:27 PM 'robert therriault' via Programming < programm...@jsoftware.com> wrote: > Hi Pete, > > Are you looking

Re: [Jprogramming] J equivalent of "exec"?

2020-02-18 Thread 'robert therriault' via Programming
Hi Pete, Are you looking for ". (Do) https://code.jsoftware.com/wiki/Vocabulary/quotedot ".'1 + 1' 2 FUNCTION=: 4 : 0 smoutput x NB. output x string smoutput y NB. output y string x +&". yNB. Using + as the dyadic verb placeholder, equivalent to (". x) + ". y ) '1+1' FUNCTION '2+

[Jprogramming] J equivalent of "exec"?

2020-02-18 Thread PMA
This question must be too clueless to ask, but two hours with NuVoc leaves me still wondering -- I need to write a function invocation with its numeric x and y each in quotes as TEXT: '1+1' FUNCTION '2+2' I want the function then, after displaying x and y, to remove their quotes and e