> But how would I convert a verb to a string in the first place?
J has 2 such useful representations: linear and atomic. atomic is that of
gerunds, and several built in modifiers can turn gerunds/ar's back into verbs.
I find linear representation easier to read and work with.
lrA =: 1 : '5!:5 < ''u'''
(+/ % #)`'' NB. turns verb into ar, display ommitted
(+/ % #) lrA NB. result is string.
+/ % #
the eval function (for lr s) that I prefer is:
eval =: 1 : ' a: 1 : m' NB. can return any form of speech.
though (".) works well if your phrase will return a noun.
+: '@' eval +
+:@+
+/ lrA , 1 2 3 lrA
+/1 2 3 NB. string result
________________________________
From: Jon Hough <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Tuesday, April 14, 2015 4:11 AM
Subject: [Jprogramming] Verb to string and Verb array
I have a couple of questions:
1. Is it possible to convert a verb, e.g. +/%# , to a string?": '+/%# 2 3 4'
executes a stringed verb with an argument. But how would I convert a verb to a
string in the first place?
Also, I discovered the eval verb
eval=: 1 : 0
". 'w =. ' , u
(ar < 'w') ab
)
Does this have an inverse?
2. If I have two verbs (or conjunctions, adverbs for that matter), can I not
pass them around in a list?
e.g. in other languages, like C# I can put functions into a list (List<Action>
for example).
I searched JforC and the J website and couldn't find any way to do this.
Thanks Jon
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm