A related task:
http://rosettacode.org/wiki/Vigen%C3%A8re_cipher/Cryptanalysis
We don't yet have a solution in j.
Let V be the character vector given on that web page less white space.
require'plot'
ROTATIONS=: >:i.50
plot ROTATIONS ; +/"1@:(="1 ROTATIONS&(|."0 1)) V
shows peaks at 14 and at 42.
I'd replace ([ * 1 - ]) with (* -.) .
As previously observed, 13 :'quoted expression' won't write hooks.
(([ * 1 - ]) -: (* -.)) -:i:8 NB. monad
1
(([ * 1 - ])/ -: (* -.)/)~ -:i:8 NB. dyad
1
>Date: Sun, 19 May 2013 11:43:52 -0400
>From: "Linda Alvord"
>To:
>Subject: Re: [Jprogramm
http://rosettacode.org/wiki/Sum_multiples_of_3_and_5#J
--
For information about J forums see http://www.jsoftware.com/forums.htm
http://rosettacode.org/wiki/Benford%27s_law#J
When trying to recover a padlock combination my father told me to start
with 1. "Most combinations start with 1."
--
For information about J forums see http://www.jsoftware.com/foru
http://rosettacode.org/wiki/Function_prototype#J
The example shows that preassigning a verb's rank affects further
definitions. I suspect others of you are more knowledgeable.
--
For information about J forums see http://www.jso
I had a definition of factors available for reuse. Yes, I realized it
was needlessly sorted. I will include this definition into my j
arsenal.
> Date: Sat, 20 Apr 2013 09:37:39 -0400
> From: Raul Miller
> To: Programming forum
> Subject: Re: [Jprogramming] more RC
> Message-ID:
> +HgM
http://rosettacode.org/wiki/Circles_of_given_radius_through_two_points#J
http://rosettacode.org/wiki/Mad_Libs#J
Mad Libs uses an associative array class of general interest.
Circles uses the complex plane. Complex numbers often simplify 2D work.
-
http://rosettacode.org/wiki/Vampire_number#J
http://rosettacode.org/wiki/Harshad_or_Niven_series#J
Vampiric numbers are dreadfully inefficient, I made no effort to follow
the algorithmic advice given in the Vampire search algorithm link.
Please modify these new entries as you please:
http://rosettacode.org/wiki/Josephus_problem#J
http://rosettacode.org/wiki/Continued_fraction/Arithmetic/Construct_from_rational_number#J
The continued fraction solution has some oddities. Returning _ to
signal "finished" converts the output vector to
In x f/.y have I ever used verb f that includes {. ?
Yes.
--
For information about J forums see http://www.jsoftware.com/forums.htm
Generating a picture of lucky numbers to 200,000 loses the striped
appearance. Have fun anyway. Remember, lucky numbers and primes are
odd. The diagonals of the spiral are odd.
S=:(spiral^:900) >: i.1 1
L =: lucky 10
LS =: S e. L
viewmat LS
Dave
---
Note 'Lucky spiral'
http://en.wikipedia.org/wiki/Lucky_number
http://oeis.org/A000959
Seeing that lucky numbers have great commonality with
primes, I found that the lucky correspondent to Ulam spiral
shares diagonal lines.
)
lucky =: 3 : 0 NB. make lucky numbers from 1 to doubled y
A
Affirming Greg, "I believe this wikipedia quote conveys a somewhat
distorted and untrue idea"
While it's true that I use matrix divide far more often than "twice and
only because domino is a glorious symbol", recently I've been parsing
some web sites. At first I tried to implement in python a fi
NB. This trick works for me:
SEED =: 2!:0 'head --bytes=8 /dev/random'
256 #. x: a.i. SEED
6185367602794180201
> From: Jo van Schalkwyk
> To: programm...@jsoftware.com
> Subject: [Jprogramming] Fwd: Newbie needs a little help with J under
> Linux :)
> Message-ID:
>
In addition to the diagonal expressions in the phrases,
http://www.jsoftware.com/docs/help701/phrases/special_matrices.htm
is a hook for diagonal.
rank =: #@:$
diagonal =: |:~ <@:i.@:rank
diagonal i. 3 3
0 4 8
diagonal i. 3 3 3
0 13 26
diagonal i.3 3 3 3
0 40 80
> Date: Tue, 5 Mar
I'm sure you know the joke with the engineer, physicist, and
mathematician. ``...the mathematician declares, as he cinches the fence
around himself, "I am on the outside."''
My heavy-handed approach to finding an optimal fence shape for a family
of curves produced a cubic equation with only sligh
Right! u Area returns
abscissa, area
That, along with incorrectly placed parens were errors.
I'll replace the 1 dimensional amoeba with Brent's method,
relax the tolerances, and see what happens. But not now.
Thank you!
NB. don't do this! too much output.
cubic =: (p.&([smoutput)~ _4&{.)~
(-@
Barn/fence problem, which shape holds maximum area?
See Mouse on moon problem
http://projecteuler.net/problem=314
which I haven't solved.
Let's build a system to test an arbitrary function.
A symmetrical figure has maximal area. Proof---a
preferred figure would be preferred in reflection
and the
You're using a 64 bit linux system. character is disabled because it
core dumps.
sax.ijs:
...
create=: 3 : 0
PARSER=: ParserCreate <<0
IGNOREWS=: 0
seterr''
SetElementHandler PARSER;(cdcb 3);(cdcb 2)
SetCharacterDataHandler^:(-.IF64) PARSER;cdcb 3 NB. crash in linux64
)
> Date: Fri,
$ ./j64-801/bin/jconsole
1 2&p. b. _1
_0.5 0.5&p.
>Date: Tue, 12 Feb 2013 09:09:21 -0500
>From: Raul Miller
>To: programm...@jsoftware.com
>Subject: Re: [Jprogramming] Basic Mystery
>Message-ID:
>
>Content-Type: text/plain; charset=UTF-8
>
>True - in the general case, p. will be difficult
2 0 3&p. is a quadratic polynomial with two roots. The multivalued
inverse won't work as a j obverse. The wikipedia "square root" entry
justifies the j definition of %: which returns 1 value, "Although the
principal square root of a positive number is only one of its two square
roots, the designa
&2@(*&3@*:) add 2 after multiplying by 3 after squaring.
Atop and at let me construct expressions by "successive approximation".
I love them.
f y NB. gives me a result,
g@:f y NB. results in a noun closer to what I need
Roughly quoting Mick Jagger, "Tack on verbs to the left
I have not yet successfully traced the substitutions of the power
operator, but why do you need it?
+:`(gfy 5 10 20)@.0 1
10 20 40
We find that rather than making a train from the agenda j actually makes
and evaluates a phrase.
> Date: Thu, 24 Jan 2013 18:29:36 -0500
> From: "Dan Bron"
> To:
round =: 1&$: : (dyad def '<.@:(1r2+])&.:(%&x) y')
assert 1 -: round 1.2
assert 1.25 -: 0.25 round 1.2
Round =: adverb def '<.@:(1r2+])&.:(%&m) y'
Is there a tacit definition of round using under?
What is the tacit definition of adverb Round?
Thanks, Dave.
-
ic =: [: , ([: i: 9&o.) j./ [: i: 11&o.
ic2 =: [: , j./&i:/@+.
NB. equivalence of monadic compose and atop
(ic-:ic2)&> 1j2 0j2NB. monadic compose
1 1
(ic-:ic2)@> 1j2 0j2NB. monadic atop
1 1
NB. The rest of this message appears to be
NB. a summary of posts I've just
Interrupting may be a bad idea.
NB. Use 13 : correctly.
NB.f=: 13 :',j./&i:/+.y' NB. no.
NB.f=: 13 : '([: , j./&i:/@+.) y' NB. yes.
ic2 =: [: , j./&i:/@+.
NB. Using a proverb is as if its definition
NB. were inserted with parenthesis.
NB. Copy
I recall having used two visual programming tools. Neither experience
was positive. There was a graphics package through which I was to
connect the outputs to inputs of various functions to transform data
into beautiful useful picture. I could connect a red output to a red
input, and generate a
The vocabulary should not say
u&v y -> ([: u v y)"v
because
[: verb verb NOUN
is a domain error.
--
Subject: Re: [Jprogramming] joining to an empty list
Message-ID: <000e01cdf0d4$4d3da130$e7b8e390$@net>
Content-Type: text/plain; charset=utf-8
Here's a sentence that I think
mp
$:~ :(+/ .*)
Reference:
--
Date: Thu, 10 Jan 2013 19:13:56 -0800
From: Roger Hui
To: Programming forum
Subject: Re: [Jprogramming] Contests & Hackatons
Message-ID:
Content-Type: text/plain; charset=UTF-8
What is mp please?
--
NB. Interesting, I must have not transcribed the rules.
NB. You knew this long ago.
sub_string_count_dwl=: (mp|.)@:>:@:#
sub_string_count_rh=: {:@:(+/\)@:>:@:i.@:#
sub_string_count_rh 'abcd'
10
sub_string_count_dwl 'abcd'
25
#@:;: 'a b c d ab bc cd abc bcd abcd'
10
Refe
,4),(5,-1), and (5,-1) The longest
is
> 'abdadba' This code counts the palindromes in the data variable.
>
> Since the string has 9 the number of substrings is only 45 (+/\1+i.9).
> Therefore, I don't understand what the description means by
"palindrome"
&g
The Kurukshetra contest is fun and soon. The university sponsors
several contests, this one fits me best.
http://kurukshetra.org.in/#!/events/athena
Of course the winners finish just about all the problems before I even
start, but they did ask me to publish one of my solutions. It's in
python,
Note 'Raul means this network'
O--/\/\--1
||
//
\\
//
\\
||
2--/\/\--3
0 1 1 _
1 0 _ 1
1 _ 0 1
_ 1 1 0
)
parallel =: +/&.:%
series =: +/
parallel~ 1x
1r2
parallel~@:series~ 1
1
> Date: Mon, 7 Jan 2013 17:36:27 -0500
> From: Raul M
NB. one of many answers, all alike.
NB. "little boxes" "all made out of ticky-tacky"
NB. "all look just the same."
[ A=: <"1 origdata ,. modvals NB. box rows of the stitched data
+---+-+-+-++++++++++-+-+-++
|9 9|10 10|11
http://rosettacode.org/wiki/Dijkstra%27s_algorithm#J
I posted above. It is a clean version of the jwiki page a posted last
year. http://www.jsoftware.com/jwiki/ProblemSolving
In particular, I separated the node names from the graph algorithm and
wrote the algorithm as a verb.
--
NB. Bring on the heavy weights! Find one root.
NB. The other could be found by polynomial division
NB. which I'm quite sure is demonstrated in the j phrases.
load'~addons/math/misc/amoeba.ijs'
f=: _5 2 700&p.
*:@:f amoeba (<30) 3,:0 NB. returns result and error estimate
+-
Use itemize, ,:
$ ,: i. 8
1 8
ravel insert works the other way,
$ ,/ ,: i. 8
8
On Tue, 2012-12-11 at 17:23 +,
programming-requ...@forums.jsoftware.com wrote:
> Date: Tue, 11 Dec 2012 17:20:05 +
> From: Alex Giannakopoulos
> To: programm...@jsoftware.com
> Subject: [Jprogramm
Laughing lots! I gave an APL book to the numpy developers about 10
years ago. I think it was the diminutive \underline{APL 360/370}.
Still can't find my Gilman & Rose. Enthought has grown. Their staff
staff is about 4 times what it was last I looked. numpy is so dang
clumsy to use compared wit
<:@:+: 0 1
_1 1
(_1 + +:)0 1 NB. for Linda
_1 1
> Date: Mon, 10 Dec 2012 19:13:05 -0500 (EST)
> From: Brian Schott
> To: programm...@jsoftware.com
> Subject: [Jprogramming] convert 0,1 coding to _1,1
> Message-ID:
> Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
>
> Is there a
Without looking studying the sentence evaluator, I expected
+.|.@
(+. |.)@
to be identical to
+.(|.@)
|.@+.
> Date: Mon, 10 Dec 2012 15:41:52 -0500
> From: Raul Miller
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Just for fun, verb cross
> Message-ID:
> +o...@ma
You can convert to a single dyadic proof with (the well known, I'm
ensuring)
verb~~
> From: Don Guinn
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Proofs in J
> Message-ID:
>
> Content-Type: text/plain; charset=UTF-8
>
> Changing the thread.
>
> No. This is a way t
cross=: ((>: * (+. |.)@:=)@:i.@:# { ({.~ (_1-#)))
cross ;/'abcde'
+-+-+-+-+-+
|a| | | |a|
+-+-+-+-+-+
| |b| |b| |
+-+-+-+-+-+
| | |c| | |
+-+-+-+-+-+
| |d| |d| |
+-+-+-+-+-+
|e| | | |e|
+-+-+-+-+-+
cross 5 43 2
5 0 5
0 43 0
2 0 2
Date: Sun
Teaching J for math class in school is a great idea. The same notation
works for English class and for social studies too. The cost of entry
is steep with algebraic notation so deeply entrenched. Can the US
convert to Metric system? That's an easier task.
> Linda Alvord
> Sent: Friday, Decembe
Sadly, the current j version 7 version of the "Object Oriented
Programming" is broken.
Lab: Object Oriented Programming
To advance the lab, press Ctrl-. in JHS or Ctrl-J in Gtk.
On a tablet your mileage may vary.
── (1 of 70) Overview ───
This lab is about Obje
The DoJ is perhaps the best technical writing I've seen,
even having admitted that it was 2 years before I understood how to
decipher headings conjunction and adverb headings such as
Atopu@v mv lv rv
Let's continue the NuVoc project.
http://www.jsoftware.com/jwiki/ControlNuVoc
Maybe we'll deci
By the way, I advised this guy or a classmate in a previous thread that
in executable Iverson notation - signum of a subtraction table would
give the result.
http://forums.devshed.com/c-programming-42/help-2darrayt-935164.html
*@:(-/~)i._5
0 1 1 1 1
_1 0 1 1 1
_1 _1 0 1 1
_1 _1 _1 0 1
Google translations are fantastic, see my post
http://forums.devshed.com/showpost.php?p=2837374&postcount=3
Google detects Japanese (I suppose that part is trivial), giving the
likely result "Seriously Thank you for the very much".
http://translate.google.com/#auto/en/%E3%83%9E%E3%82%B8%E3%81%A9%E
I learned much j tonight. My unnecessary extended precision crushed my
memory.
swops=: ((|.@:{. , }.)~ {.)^:a:
(,. _1 + ! >./@:(#@swops@A. >:)&i. ])&> >:i.10
&> is the same, in this case, as "0 .
Where you have (! hook&i. ]) I had orepeated i. .
Beautiful work!
On Tue, 2012-11-27 at 03:16
I'm glad I asked.
1) I'd forgotten or never knew about ^:a:
2) I struggled to get the solution for 9, and my solution page faulted
to death at 10.
permutations
((i.@:(-&! <:) + !@:<:)@:x: A. >:@:i.)^:(1&<)
<@permutations"0 [ 1 3
+-+-+
|1|2 1 3|
| |2 3 1|
| |3 1 2|
| |3 2 1|
+-+-+
Reference: http://rosettacode.org/wiki/Topswops
What are good ways to count iterations?
While=: 2 : 'u^:v^:_'
topswop=: (|.@:{. , }.)~ {.
topswop While (1 ~: {.) 2 4 1 3
1 2 3 4
These ideas seem like structural nightmares:
* separate data and counter with boxes;
* append a counter to
"Here's a simpler version of the domain error..."
There are two verbs f and g with demonstrated equivalence in a dyadic
case. Bringing us through
NB. .
C-:D
f is a fork, g is a hook.
As monads they don't behave alike with a boxed y.
Let's examine the noun presented to f and j in the d
"But what does t. do?"
Use the dictionary.
t. is an adverb.
The dictionary heading on the page says
u t. 0 0 0
This means (and it took me 2 years before I understood how to read
dictionary headings. I learned a lot of j via the "parts of speech"
dictionary access page)
The verb formed by
u
If your program works I'd say you aren't doing something wrong.
Raul Miller proposed a naming convention which I've found useful. In
short:
NOUN Conjunction Adverb verb
I think you'd do well to next learn the ~ adverb, reflex/passive.
And someday you'll run across the "special code" page:
http:/
Right! "Matrix multiplication" usually means something else.
You want a sort of element-by-corresponding-element multiplication.
B ; A
+---+---+
|1 1 0 0|1 1 1 1|
|0 0 1 1|1 1 2 2|
| |1 1 3 3|
| |1 1 4 4|
+---+---+
A solution uses rank conjunction twice. I coul
http://www.jsoftware.com/jwiki/Essays/Odometer
odometer=: (4 $. $.)@:($&1) NB. YAOV (odometer verb)
--
For information about J forums see http://www.jsoftware.com/forums.htm
The perl solution best fits the problem description.
perl -ne 's!^([a-z])(\.?)$!print chop().($2?$/:$")for($1..a.$1)[1..25]!
ie'
http://codegolf.stackexchange.com/questions/7036/print-custom-alphabet
At the right hand side of Bob's sentence identify [i.{.@] as hook (i.{.)
to save a character. R
A)
NB. The requirement for bad input is "no output".
(,.@]^:('.'e.[)(a.{~,65 97+/26|i.51)&(25{.[|.~1+(i.{.))) ::(0$]) '['
BCDEFGHIJKLMNOPQRSTUVWXYZ
>From: Viktor Cerovski
>To: programm...@jsoftware.com
>Subject: Re: [Jprogramming] Print Custom Alphabet
>Message-ID: <34347462.p...@talk.nabbl
NB. choices for input are ARGV_j_ or 1!:1[1
NB. These two sentences are one line apiece
,.^:('.'e.t)s{ ::($:&}.)~n+1+{.t i.~s=:a.{~,65 97+/26|
i.51[n=:i.25[t=.1!:1[1 NB. rdm
,.^:('.'e.L)(a.{~(_ 65 _ 97{~64 90 96 122&I.)+(26|i._26 25){~32<:@|
]) ::(0&$)a.i.{.L=.1!:1[1 NB. dwl
The concept: index i
In this I attempt to solve the alternation problem using ;: . Upon
illegal characters or patterns the machine is supposed to write the word
with j=_1 , causing Index Error, trapped with fsm :: _1:
I characterize my test data as "more" rather than "good".
My fsm indicates "Pass" when the problem o
(Per my thread recollection)
Raul mentioned that both valences should show.
Ian hoped for a correct solution 95% of the time.
This particular verb is interesting as a dyad because bond causes
repetition. Would we expand as some awful for. loop?
foo_explicated=: 3 : 0
NB. ((+/) % #) @
Another fine application of cap:
Suppose we have an agenda selection function which returns 0 1 3 . Cap
in this tie error checks select .
f`g`[:`h @. select Y
I regret not being able to attend the conference this year---I would
like to meet you.
Dave.
--
Question 1) 5!:6 can parenthesize trains, nouns, adverbs, and verbs.
5!:6@:<'hook'
((0;(3 4 2$0);(0$0);0 _1 0 _1)&;:) (7 (+~) +)
(+~) is a verb. (Recent email shows you slept through this.)
(7 (+~) +) is a fork. Trains are more complicated than the 6 parts of
speech, remembering punctuati
In place of a maximum iteration count I had thought 9!:33 would enforce
an execution time limit. I've never gotten it to work.
9!:33]1
-^:_[1
9!:32 y
9!:33 y Execution Time Limit. The execution time limit is a single
non-negative (possibly non-integral) number of seconds. The limit is
re
63 matches
Mail list logo