Like this?
cam=:2 :0
u 5!:1<'v'
)
Am=:1 :0
u cam
)
Or, of course, you could squash the pieces together, which might be a
good thing if you are working in a more hostile environment.
Am2=: 1 :0
u 2 :'u 5!:1<''v'''
)
Thanks,
--
Raul
On Mon, Dec 14, 2015 at 4:34 PM, Dan Bron wrote:
> F
I used a direct method. Part 2 shown.
SPEED NB. m/s in flight
8 13 20 12 9 10 3 9 37
T0 NB. "on" duty cycle in seconds
8 4 7 4 5 4 37 12 1
T1 NB. "off" duty cycle also in seconds
53 49 132 43 38 37 76 97 36
T NB. period of duty cycle, T0 + T1
61 53 139 47 43 41 113 1
I forgot. The form for Adv is (whitehorse f.Adv) and the verb whitehorse
is supposed to be a purist verb; therefore, Adv has to be patched (for
instance) as follows,
Adv=. (train f. @:) (train o ((af'a4') ; ] ; (af'a3')"_) f.av)
So, for example,
(i.2 3) ]Adv
0 1 2
3 4 5
(i.2 3) ((<'*:')
The new beta release of J8.04, announced earlier today, supports two new
dissect features that make dissect a good starting point for debugging
any J sentence.
* if a tacit verb is used in a sentence, right-clicking on the name of
the verb in the dissect window will start a new dissection of t
Dan writes:
"
I have yet to find a satisfactory, general, and elegant way to express the
clause:
((<":noun)`) (((":noun) <@:; <^:2)`) (@.(0; 1 2))
...
What I’d really like is a general adverb that
- Accepts a verb as input, deriving another adverb
- That adverb converts its own i
*`(1 0 #~ ,)/ is great.
Not as nice as yours but it helped me improve my answer where I needed to put
a '#' down the centre of my input matrix:
]Data=: 0,.~ ".every (8 16 3{ ;:);._2 freads'14.txt'
7 124 19 0
15 28 3 0
9 164 19 0
9 158 19 0
7 82 13 0
6 145 25 0
3 38 14 0
16 37 3 0
For the sake of clarity:
- The general adverb is named “Am”.
- It is tacit
- Its input is a verb, say “f"
- Its output is a (derived, tacit) adverb, named “Dam”
- Dam consumes either verbs or nouns; call this argument “u”
- Whether a verb or noun, Dam converts its argument, u, whether
On Mon, Dec 14, 2015 at 10:58 AM, Dan Bron wrote:
> What I’d really like is a general adverb that
>
>- Accepts a verb as input, deriving another adverb
>- That adverb converts its own input, whether noun or verb, to its atomic
> representation
>- Then the derived adverb applies the or
Part 1 was simple with regex:
+/".> '-?[[:digit:]]+' rxall d
Part 2 stumped me, but I've been learning a lot from the solutions posted
here.
On Sun, Dec 13, 2015 at 11:54 AM, Henry Rich wrote:
> Thank you. My code addresses the question "Given a point in a
> parenthesized string, what is the s
Mine - decided to play with regex
require 'regex'
input =: fread 'c:/joe/lang-lab/j/advent2015/day14.txt'
exp =: '^([A-Za-z]+) can fly (\d+) km\/s for (\d+) seconds, but then
must rest for (\d+) seconds'
selectOther=: (#~ (0,1) $~ $)
parse=: (selectOther@(rxcut~ }.@{.@(exp&rxmatches)) each @ cut
Pepe wrote:
> This is a puzzle for adverbial tacit writing fans: Write a purist tacit
> adverb (sf1) such that, for example,
>
> (v0 v1 v2)sf1
> v0@[ v1 v2@]
>
> 3 4 (+: + -:)sf1 2 4
> 7 10
I’m sure your solution is more elegant, but I haven’t looked yet, so here’s my
attempt:
L
NB. Exploring Y
Y =: (&({::))(@:])
type<'Y'
+--+
|adverb|
+--+
select=: (<2 3) Y NB.
select
(<2 3)&({::)@:]
type<'select'
++
|verb|
++
[DATA=: [&.>10 + i.4 7
+--+--+--+--+--+--+--+
|10|11|12|13|14|15|16|
+--+--+--+--+--+--+--+
|17|18|19|20|21|22|23|
+
My version:
NB. Read in data, convert to numeric
sfr =: 0&".@> sfr (3 8 16&{)@;:;._2 wd 'clippaste'
NB. Calculate distances
>./ (0&{ * (_,1&{) ([ #. <.) 2503 #:~ (0,+/@(1 2&{)))"1 sfr
NB. Part 2. Total rewrite required
>./ +/"1 (="1 >./) +/\"1 (2503 $ *`(1 0 #~ ,)/)"1 sfr
Henry Rich
O
I don't understand what Y is, could you explain that?
On 14 Dec 2015, at 17:10, 'Pascal Jasmin' via Programming wrote:
> in =. ". leaf (3 8 _2 { ;:)"1 a =. > cutLF wdclippaste ''
> Y =: (&({::))(@:])
>
> part1 :
>
>> ./ {:"1 +/\@(2503 $ (0 #~ 2 Y) ,~ 1 Y # 0 Y)"1 in
>
> 2:
>
>> ./ (] +/@(="1 1)
14 matches
Mail list logo