You may think you are close to a solution but there are serious problems.
e.g.
- does * denote times or exponentiation (is * the APL * or the ASCII *)?
- you can enter i. as ⍳ but for i: you must enter i:
- |. is not ⌽ but ⊖, depending on which APL you are talking about
- / is not / but ⌿, depend
With some modicitions, J can accpet both ascii and about
30 APL symbols as primitive,
⌈>. Ceiling
⌊<. Floor
⍴$Shape
∼-. Not
∣|Absolute value
⍳i. Index generator
⋆^Exponential
−-Negation
⌹%. Matrix inverse
○o. P
Here is Roger’s definition another way.
B=:'triple';'word';'score'
diag5=: 13 :'(,~#y)$(y(#~) (1 j. #y))'
diag5 B
┌──┬┬─┐
│triple││ │
├──┼┼─┤
│ │word│ │
├──┼┼─┤
│ ││score│
└──┴┴─┘
diag5
([: ,~
(*=) doesn't work if items are repeated
(*=) 2 1 3 6
2 0 0 0
0 1 0 0
0 0 3 0
0 0 0 6OK
(*=) 2 1 3 1
|length error
| (*=)2 1 3 1 Fail
(*=@\:)2 1 3 1
2 0 0 0
0 1 0 0
0 0 3 0
0 0 0 1 OK
Don Kelly
On 26/02/2014 10:36 PM, Michal Wallace wrote:
What pur
On the J Wiki, find "The Accessible Dictionary" in the new users
section. The description of @ vs @: is described there.
Henry Rich
On 2/27/2014 8:15 PM, Jon Hough wrote:
> Another beginner question . I'm trying to understand how atop (@) works.I've
> read this http://www.jsoftware.com/help/dic
The issue is rank.
+ is rank zero, and atop has rank: mv lv rv
The convention here is m: monadic, l: left dyadic, r: right dyadic and
v refers to the verb on the right (u would refer to the verb on the
left).
So the monadic rank of <./@+ is the monadic rank of +,
the left dyadic rank of <./@+ is
1 2 (<./ @: +) 3 4
4
@ will apply <./ at 0 rank which means for each element in the list 3 4.
minimum of 4 is 4 and minimum of 6 is 6.
@: applies on the whole list.
- Original Message -
From: Jon Hough
To: "programm...@jsoftware.com"
Cc:
Sent: Thursday, February 27, 2014 8:15:54
Another beginner question . I'm trying to understand how atop (@) works.I've
read this http://www.jsoftware.com/help/dictionary/d620.htm
But I made my own example and the results are not as I expected.I made a tacit
dyadic verb:
func =: <./ @ +
Here + is dyadic and <./ is monadic.
If I do
1 2
Originally utf8 allowed at most 6 bytes that would be enough any codepoint
in ucs4. In latter unicode standard, it was decided not all of 32 bits of
ucs4 were needed and the new range corresponds 4 bytes of utf8.
On Feb 28, 2014 4:42 AM, "Raul Miller" wrote:
> Unicode is messy, but it's not that
On 2014.02.27 14:21:46, you,
the extraordinary Roger Hui, spake thus:
> Several of the diag* verbs that I posted work on non-numerics as well. e.g.
>
>diag3=: ,~@# $ ] #~ 1 j. #
Thanks! I had to go look up: (a j. b) #
--
Nollaig MacKenzie
http://www.yorku.ca/nollaig
-
Something pretty damn interesting is that m and u can both exist after all.
test2=: 2 : 0
smoutput (u`'');isNoun 'u'
if. 1=# (}: m) do. (({. m) `:6) @:((({: m) `:6) @: v) else.
(}: m) test2 (({: m) `:6) @: v end.
)
isNoun =: (0 = 4!:0 ( :: 0:))@:<
test2 is a conjunction that expects a gerund as
Several of the diag* verbs that I posted work on non-numerics as well. e.g.
diag3=: ,~@# $ ] #~ 1 j. #
diag3 'syzygy'
s
y
z
y
g
y
diag3 'triple';'word';'score'
┌──┬┬─┐
│triple││ │
├──┼┼─┤
│ │word│ │
├──┼┼─┤
│ │
(I'm dangling this off the meg that started the thread)
Is there a clever way of doing this for non-numeric strings?
I couldn't think of a way to start on a tacit solution; dg0
is clear but not noticeably clever or fast:
dg0=: 3 : 0
nn=. # y
inds=. <"1@:(<"0) ,.~ i. nn
M=.(,~ nn)$ 1{.0{. y
y inds
Unicode is messy, but it's not that messy.
The utf-8 encoding places a limit on how many characters can be
encoded, and if I understand properly, that limit is slightly over a
million, and less than a quarter of those theoretical characters
currently have been assigned. Of course... unicode is a s
Unicode was supposed to be the solution to the problems with the APL chars
as well all the code pages with national characters.
As should be obvious the solution is far from anywhere close.
UTF-8 UTF-16 UTF-32 UTF-64 UTF-???
--
F
Just learned that ctrl+c in the console window (the jhs server window)
signals break to the running JHS task. This is more convenient than
the yellow J icon for signaling break to the JHS task.
This discovery was made in taking an initial look at allowing normal
input/output/logging/break from the
Speaking of palindromes, I can not miss telling y'all the following Eugene
McDonnell anecdote as related by Bob Bernecky:
Eugene walked into my office at The Exchange Tower one
afternoon, to find me on a telephone call. He wrote the following
on the blackboard, smiled seraphically, and walked out.
This does put the numbers on the diagonal, but..
(* =/~) 1 2 2 1
1 0 0 1
0 2 2 0
0 2 2 0
1 0 0 1
...I liked Roger Hui's point about using (*"1) instead.
Thanks,
--
Raul
--
Raul
On Thu, Feb 27, 2014 at 12:26 PM, Pascal Jasmin wrote:
> not sure if given, but even shorter, and maybe clearer
not sure if given, but even shorter, and maybe clearer (?)
(* =/~) or (] * =/~)
(* =/~) 9 7 5 3
9 0 0 0
0 7 0 0
0 0 5 0
0 0 0 3
( =/~) 9 7 5 3
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
- Original Message -
From: J. Patrick Harrington
To: "programm...@jsoftware.com"
Cc:
Sent: Thursday,
There are at least two communities of J users. For the mathematicians, I
would begin with:
diag5=: 13 :'y*=\:y'
A=:10 20 30 40
diag5 A
10 0 0 0
0 20 0 0
0 0 30 0
0 0 0 40
diag5
] * [: = \:
And end by showing them how J is thinking about the problem.
Linda
-
Definitely possible, but it would take some work. But keep in mind:
9!:14''
j701/2011-01-10/11:25
J801 is still using the instance of J from three years ago. It's open
source now, which currently means (a) it's very stable, but (b) the
community needs to start contributing back.
Personally, I
One good application of sparse arrays is tracking differences in a large (or
medium) datasets. Its possible for 1 billion rows to only have a few dozen
fields that have changed in the last period. Sparse arrays are also good for
preparing mass updates to a dataset, for example by applying the
> -Original Message-
> From: programming-boun...@forums.jsoftware.com [mailto:programming-
> boun...@forums.jsoftware.com] On Behalf Of Joe Bogner
> Sent: dinsdag 25 februari 2014 13:02
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Finding Largest Prime of Numbers (Tacit)
(
'þ' is not a literal. It is UTF-8. To treat it as a literal is wrong. You
can't separate the first half of a UTF-8 character from the last half. In
terms of UTF-8 it is one character but $ treats it as two literal
characters. The thing is that when dealing with UTF-8 one can't expect
primitives des
J literal considers literal _128{.a. as valid. Those bytes are invalid in
UTF-8 as UTF-8 uses them to represent unicode values >127. To represent
those characters in UTF-8 require two literals each. It is not an oddness
in the UTF-8 specification. It is the confusion caused by treating UTF-8 as
lit
On Thu, Feb 27, 2014 at 8:54 AM, Pascal Jasmin wrote:
> with sparse arrays though, it does something weird and not obviously
> necessary:
>
>lr $. 0 0 3 0 5
> 3 5 (2 4)}1$.(,5);(,0);0+-~2
>
>lr 10 + $. 0 0 3 0 5 0
> 13 15 (2 4)}1$.(,6);(,0);10+-~2
>
> The weird part is the little piece at
On Thu, Feb 27, 2014 at 9:39 AM, Don Guinn wrote:
> Although the unicode value of 'þ' is less than 256 it still must be
> represented with two bytes in UTF-8. This is where it gets confusing to
> view UTF-8 as literal. And why I sometimes think it would be nice if UTF-8
> was a type unique from li
What you are seeing here is an oddness in the unicode specification.
a.i.8 u: 7 u: 'þ'
195 190
7 u: gives you utf-16 character representation, and 8 u: gives you
utf-8 character representation.
It just happens to be the case that the character value in the utf-16
representation of thorn (þ) h
Is 'þ' in the 256 characters? It has a unicode value of 254 but a UTF-8
numeric value of 195 190. It's literal numeric value (non-UTF-8) is invalid
when treated as UTF-8.
# 'þ'
2
#7 u:'þ'
1
254{a.
�
4 u: 254
þ
195 190{a.
þ
3!:0]7 u:'þ'
131072
3!:0 'þ'
2
Although the unicode va
lr =: 3 : '5!:5 <''y'''
lr is pretty cool:
lr 1 10 $ +: 5 * i:10
_100+10*i.1 10
with sparse arrays though, it does something weird and not obviously necessary:
lr $. 0 0 3 0 5
3 5 (2 4)}1$.(,5);(,0);0+-~2
lr 10 + $. 0 0 3 0 5 0
13 15 (2 4)}1$.(,6);(,0);10+-~2
The weird part is the
Thanks David and everyone else. I did search the forums and wiki but
struck out. It wasn't clear to me at first how identity matrix
related. I was searching for "diagonal", which was found on the page,
but didn't produce the result I was looking for. I'll have to study
the page and learn more of th
You've already gotten several solutions. This is a good time to learn
of the j essays.
http://www.jsoftware.com/jwiki/Essays/Identity%20Matrix
>Date: Wed, 26 Feb 2014 22:02:00 -0500
>From: Joe Bogner
>To: programm...@jsoftware.com
>Subject: [Jprogramming] create matrix from diagonal
>Message
There are a lot of strange things happening regarding national characters.
þ is within the 256 chars but behaves strange regarding a.
7 u: 'þ'
þ
a. i. 7 u: 'þ'
254
254 { a.
�
7 u: 254 { a.
|domain error
| 7 u:254{a.
3 u: 254 { a.
254
'þ' = 254 { a.
0 0
(7 u: 'þ') = 254 { a.
1
33 matches
Mail list logo