Thanks,
Just to be clear, '(',')',~ is just to bracketify the verb so its fork (in
this case) works, right?
--- Original Message ---
From: "Jan-Pieter Jacobs" <[email protected]>
Sent: April 14, 2015 5:26 PM
To: [email protected]
Subject: Re: [Jprogramming] Verb to string and Verb array
Hey John,
I think 1. you can do using 5!:5:
mean =: +/%#
mean i.5
2
5!:5 <'mean'
+/ % #
datatype 5!:5 <'mean'
literal
". (('(',')',~5!:5) <'mean'),'0 1 2 3 4'
2
stringify =: '(',')',~5!:5
(stringify <'mean') , '0 1 2 3 4'
(+/ % #)0 1 2 3 4
For point 2, you can use gerunds to pass around verbs in a list:
ger =: +`-`*`%
ger
┌─┬─┬─┬─┐
│+│-│*│%│
└─┴─┴─┴─┘
10 ((1{ger) `: 0) 20
_10
There's a massive amount of uses for gerunds, like / , ^: , } , and so on...
If you'd want to do these things (make a noun (or list there of)) out of
any type of word, I think you should be looking at atomic representation.
Jan-Pieter
2015-04-14 10:11 GMT+02:00 Jon Hough <[email protected]>:
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm