Ok, given the clarifications in the message from Pepe with that subject,
here's a whack at it:
**SPOILERS BELOW**
lrv =: (^:_1) b. (`(<_1;~":0)) (`:6)
boxopen f. lrv
<^:(L. = 0:)
(<^:(L. = 0:)) lrv
<^:(L. = 0:)
list lrv
list
list f. lrv
3 : 0
w=. {.wcsize''
w list y
:
if. 0=#y do. i.0 0 return. end.
if. 2>#$y=. >y do.
d=. (' ',LF) {~ LF e. y=. toJ ": y
y=. [;._2 y, d #~ d ~: {: y
end.
y=. y-. ' '{.~ c=. {:$ y=. (": y),.' '
(- 1>. <. x % c) ;\ <"1 y
)
The basic insight here is that we want an adverb not dissimilar to b. : one
that accepts a verb argument and (with a little convincing) produces a
linear rep.
That was the easy part. What I struggled with is I (mistakenly!) thought
the challenge was asking for behavior similar to this:
flrv =: (^:_1) b. (`(<_1;~":0)) (5!:5@< :: ]`) (`:6)
type flrv
{&(<;._1 '|invalid name|not
defined|noun|adverb|conjunction|verb|unknown')@(2&+)@(4!:0)&boxopen
But, implicitly or explicitly, deprecrating 5!:5 (which is unsatisfying).
That is, some elegant mechanism to force a name to be stacked by value,
which in concert with the original lrv would admit flrv =:
adverbToStackNameByValue lrv (among many other uses!).
So: NEW CHALLENGE.
Write a tacit adverb which takes a verb argument, which if anonymous it
produces untouched, and if named (proverb) produces its definition. The
adverb may not rely on : (explicit conjunction) or 5!:n (but maybe other
foreign are OK). Note, of course, that f. is not a candidate for this tool,
as we just want to "peel off" one layer of naming, if present, not all
layers.)
I've got no spoilers for this one.
-Dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dan Bron
Sent: Monday, February 20, 2012 8:03 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] tacit adverb
Oh, and would it be valuable if the domain were extended to nouns, in
particular literal vectors or boxed strings which represent J names,
potentially pro-adverbs or pro-conjunctions?
-Dan
-----Original Message-----
From: Dan Bron [mailto:[email protected]]
Sent: Monday, February 20, 2012 8:01 PM
To: 'Programming forum'
Subject: RE: [Jprogramming] tacit adverb
I just saw this message and I haven't looked at the rest of the thread yet,
because I'm afraid of spoilers, so I don't know if there are clarifications,
amplifications, or alterations to the challenge.
But there's a pretty simple solution, depending on the domain of the adverb.
So: what is the domain of the adverb? In particular, can I always expect a
proverb whose referent is a tacit verb? Can the argument be anonymous? Can
it be (or contain) explicit?
Re:
> bonus points for a fixed version
Is this for a fixed version of the adverb, or if the adverb produces the
fixed version of its argument? If the latter, is there some reason to
suspect that flrv =: f. lrv would not suffice ?
-Dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jose Mario Quintana
Sent: Monday, February 20, 2012 2:56 PM
To: Programming forum
Subject: Re: [Jprogramming] tacit adverb
Now, a challenge/puzzle: write a tacit adverb (lrv) that produces the linear
representation of its input verb (bonus points for a fixed version), for
example,
type lrv
type
type f. lrv
{&(<;._1 '|invalid name|not
defined|noun|adverb|conjunction|verb|unknown')@(2&+)@(4!:0)&(<^:(L. = 0:))
SPOILER ALERT: A Solution is presented below...
Another challenge is to evade the linear representation persistent bug to
show the adverb:
lrv=. (".(0 : 0) -. LF)`:6
(<(<,'4'),<(<(<,'4'),<(<(<,'4'),<(<(<,'4'),<<;._1 ' 0:
:.'),<(<,'4'),<(<,'`'),<(
<,'0'),<(<'b.'),<(,'0');_1),<(<,'4'),<(<'`:'),<(,'0');6),<(<,'4'),<(<(<,'4')
,<(<
(<,'4'),<(<(<,'4'),<(<(<,'4'),<(<(<,'4'),<(<,'"'),<(,'0');_),<(<,'4'),<(<(<'
@:')
,<(<,'<'),<(<,'3'),<(<<;._1 ' 0
0'),(<(<,'&'),<;:',<'),<,']'),<'@:'),<(<,'4'),<(
<,'`'),<(<,'0'),<<(,'0');_),<(<,'4'),<(<'`:'),<(,'0');6),<(<,'4'),<(<(<,'&')
,<(<
(,'0');_5),<'}.'),<,'`'),<(<,'4'),<(<'`:'),<(,'0');6)
)
lrv
(((0: :.)(`(b.`_1)))(`:6))(((((("_)(<@:((,'0') ,&<
])@:))(`_))(`:6))(_5&}.`))(`:6))
type lrv
type
type f. lrv
{&(<;._1 '|invalid name|not
defined|noun|adverb|conjunction|verb|unknown')@(2&+)@(4!:0)&(<^:(L. = 0:))
Oh yes, I cheated! I used b. _1 to get the linear representation of the
adverse of the adverse of the input verb. The code of the adverb can be
shorter; most of it is related to (_5&}.) dropping 5 trailing characters
(':. 0:') but it illustrates how to tacitly transform a verb into its
corresponding adverb. A direct, non-cheating, version is possible but quite
more difficult (as far as I can see).
________________________________________
From: [email protected] [[email protected]]
on behalf of Dan Bron [[email protected]]
Sent: Monday, February 20, 2012 11:02 AM
To: 'Programming forum'
Subject: Re: [Jprogramming] tacit adverb
> A=: 1 : '0&(;@:u) :: empty'
Can be expressed tacitly as B=: 0&(;@:) (:: empty) . In general, tacit
adverbs are trains of adverbial clauses, so if you want to add another, you
only need to wrap it in parens and tack it on the end.
Though your phrasing 0&(;@:) is very appealing; it seems to "beg for an
argument" more than the vanilla formulation of (0&) (;@:) .
-Dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Ward Lambert
Sent: Monday, February 20, 2012 10:50 AM
To: programming
Subject: [Jprogramming] tacit adverb
I had
A=: 0&(;@:)
u A y
My u raises an error if y is bad, in which case EMPTY is a reasonable
result. I'd prefer not checking y in each u. What is the tacit
A=: 1 : '0&(;@:u) :: empty'
? Thanks, Dave.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
[BEST LLC]
Bayesian Efficient Strategic Trading LLC
The information in this communication and any attachment is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of BEAM Bayesian Efficient Asset Management, LLC
(BEAM), Bayesian Efficient Strategic Trading, LLC (BEST) and/or their
affiliates unless otherwise specifically stated. All information and
opinions expressed herein are subject to change without notice. This
communication is not to be construed as an offer to sell or the solicitation
of an offer to buy any security. Any reliance one may place on the accuracy
or validity of this information is at their own risk. Past performance is
not necessarily indicative of the future results of an investment. If you
are not the intended recipient, or a person responsible for delivering this
to the intended recipient, you are not authorized to and must not disclose,
copy, distribute, or retain this
message or any part of it. If you are not the intended recipient, please
permanently delete all copies of this communication and any attachments from
your computer system, destroy any hard copies, and immediately notify the
sender or BEAM/BEST at either [email protected], [email protected]
or (201) 792-1002. No waiver of confidentiality or privilege is made by
mistransmission.
----------------------------------------------------------------------
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