Here is a bit of a breakthrough on this type of code:
(uses definitions quoted below including those from Jose)
consider
]`+vvtie"1 0]2 3
]`+vvtie"1 0]2 3
┌─┬─┬─┐
│]│+│┌─┬─┐│
│ │ ││"│┌─┬─┐││
│ │ ││ ││┌─┬─┐│┌─┬─┐│││
│ │ ││ │││0│2│││0│_
│ │ ││ ││└─┴─┘│└
that is one of the main motivations for JON.
http://www.jsoftware.com/pipermail/programming/2014-February/035542.html. 3!:1
is a simpler alternative.
obviously of no help reading chrome json files. Binding to same/similar c
library as python would help.
- Original Message -
From: J
interesting. the 32 bits is done specifically to test 5 variables.
this probably helps see the structure:
p,q,r,s,t
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0
My naïve intuition is that a tree of symbols would be the most direct route
to increased performance. Would that fit with what you suggested here, Raul?
On Mar 3, 2014 1:52 AM, "Raul Miller" wrote:
> We should be able to concatenate boxed arrays with somewhat better
> performance. Conceptually sp
A tangential but related question: does J have a dictionary data type?
Where can I read about it?
Thanks.
On Mon, Mar 3, 2014 at 8:55 AM, Tracy Harms wrote:
> My naïve intuition is that a tree of symbols would be the most direct route
> to increased performance. Would that fit with what you su
Trees are a rather general topic, and trees that are suitable for some
tasks are horrendous for other tasks.
As for JSON, you can treat well designed JSON as an unstructured
string and pull values out of it using regular expressions. But
general case JSON is another matter. If I had an immediate n
On Mon, Mar 3, 2014 at 10:29 AM, Raul Miller wrote:
> I'd have no problems using another language
> (perhaps using the cd interface, or perhaps using sockets) to deal
> with the conversion.
To elaborate on Raul's point, another simple solution would be to
convert the JSON to a flat file. The exam
there is this lightweight version than can store any boxable content with a
key, and so suitable for json-like storage. meant to be convenient rather than
fast.
http://www.jsoftware.com/pipermail/programming/2013-September/033494.html
another approach would be to use a numbered locale
dict =
J's dictionary data type is probably the locale.
http://www.jsoftware.com/pipermail/programming/2014-February/035615.html
has a list of urls documenting locales.
That said, note that names within locales have syntactic limits. So
you'd have to map your identifier into something suitable as a name
I have problem code inside a JHS app I am trying to write. The app will
accept user inputs of valid commands like `fd 10` and produce canvas draw
updates.
This line in jijx is producing the error below it.
load'~Projects/tgsjhs/tgsjhs.ijs'
|syntax error
| jev_get_tgsj_''
*** response not
thank you for your explanations dan,
double =: 3 : 0
+: y
:
smoutput x
+: y
)
2 (double &+)&+: 3
4
12
2 double &(+&+:) 3
4
12
this I understand
4 (double &+) 6
4
12
and this
(double &+) 6
12
so this feels like a bug:
2 double &(+&+:) 3
4
12
should be able to parenthesize t
Shooting from hip response without a careful reading of your message.
jev_get is for the http get request. It is the verb that is run when
you first browse to that page. It is not a response to an ajax
request.
What is the J definition for ve_command_enter? When jev_get is called
it will get the
Eric,
Yes, I changed the jev_get to `jev_get=: create` and then decommented
(they were commented in the previous version) the following two lines in
JS. Can you see what I can do now, please?
function ev_command_enter(){jdoajax(["command"],"");}
function ajax(ts) {jbyid("command").value=ts[0];}
Beginner question again.I quick task I set myself was to write ONE ITERATION of
the Collatz function for a given positive
integer.http://en.wikipedia.org/wiki/Collatz_conjecture
So my verb is supposed to do 3*n+1 if n is odd and n/2 if n is even.In a more
imperative/OOE based language (C/C++/Ja
Eric,
Wait. I am debugging myself. Thanks.
--
(B=)
--
For information about J forums see http://www.jsoftware.com/forums.htm
That sounds like a job for agenda:
collatz =: collatz_even`collatz_odd@.(2&|)
the expression to the right of the Agenda (@.) returns 0 or 1 for any
scalar integer input; that will be used to select one of the verbs to
the left to be executed,
On Mon, Mar 3, 2014 at 11:30 AM, Jon Hough wrote
Dan,
The problem is, as you now know, exceeding the 100 KB limit. So I
followed Chris’ advice and trimmed the old messages.
These are the answers to your questions,
[: u0 u1 At
u0@:u1
I should point out that neither there is a train nor a need for
parentheses. There is an issue when there
2 double &(+&+:) 3
is equivalent to
(++:2) double (++:3)
And since neither 2 or 3 has an imaginary part, we can eliminate the
complex conjugate which means we have:
(+:2) double (+:3)
Does that help?
Thanks,
--
Raul
On Mon, Mar 3, 2014 at 11:10 AM, Pascal Jasmin wrote:
> thank you
Er... actually you only had one other question to be answered. Oops.
Thanks,
--
Raul
On Mon, Mar 3, 2014 at 2:13 PM, Raul Miller wrote:
> Answering your questions in order:
>2&%~
> is equivalent to
>(2&%)~
>
> If you want a more detailed explanation of why this is, don't hesitate
> to
Answering your questions in order:
2&%~
is equivalent to
(2&%)~
If you want a more detailed explanation of why this is, don't hesitate
to ask, but you have a number of other questions to be answered...
As for if statements, J actually has them
(http://www.jsoftware.com/help/dictionary/cif.h
The standard answer to "Does J have a dictionary data type?" seems to be
"Use symbols."
(Two other answers today recommend locales.) To which we ask, "How do
we use symbols?" Given that I may have overlooked a lab, I'll show my
effort. My goal is to maintain a database of probabilities writte
collatz=:-:&(+2&|*>:&+:)
collatz ^:(i.10)17
17 26 13 20 10 5 8 4 2 1
Den 20:15 mandag den 3. marts 2014 skrev Raul Miller :
Er... actually you only had one other question to be answered. Oops.
>
>Thanks,
>
>--
>Raul
>
>
>
>On Mon, Mar 3, 2014 at 2:13 PM, Raul Miller wrote:
>> Answe
Elaborating on what Raul and Michael said:
even`odd@.isOdd 10
5
even`odd@.isOdd 11
34
gives you one step of Collatz. Succeeding application of the same thing to
the results would suggest using the power conjunction, but I can't quite
figure out the right way to do it:
collatzNotDone=:
interesting implementation.
Could you please explain
Monad =: :[:
?
is it equivalent in use to @:] ?
- Original Message -
From: David Lambert
To: programming
Cc:
Sent: Monday, March 3, 2014 2:29:35 PM
Subject: [Jprogramming] Dictionary data type
The standard answer to "Does J hav
Monad=: :[:
RightId=: @]
example1=: >: Monad
example2=: >: RightId
example1 2 3 5 7
3 4 6 8
example2 2 3 5 7
3 4 6 8
0 example1 2 3 5 7
|domain error: example1
| 0 example1 2 3 5 7
0 example2 2 3 5 7
3 4 6 8
In other words, :[: produces a verb with an empty dyadic domain, while
given the string 'abcDEF' ,
how do i find the indicies of these letters in a. ?
I would like to do:
ix =. 'abcDEF' ??? a.
and get a list of numbers which I can use thus:
ix } a.
abcDEF
Skip Cave
Cave Consulting LLC
--
For in
a.i.'abcDEF'
On Mon, Mar 3, 2014 at 4:21 PM, Skip Cave wrote:
> given the string 'abcDEF' ,
> how do i find the indicies of these letters in a. ?
>
> I would like to do:
>
> ix =. 'abcDEF' ??? a.
>
> and get a list of numbers which I can use thus:
>
> ix } a.
>
> abcDEF
>
> Skip Cave
> Cave Co
Doh! Of course. I had the x & y of i. turned around.
Skip
Skip Cave
Cave Consulting LLC
On Mon, Mar 3, 2014 at 3:28 PM, Kenneth Lettow wrote:
> a.i.'abcDEF'
>
>
> On Mon, Mar 3, 2014 at 4:21 PM, Skip Cave wrote:
>
> > given the string 'abcDEF' ,
> > how do i find the indicies of these letters
I sometimes have so many "Doh! Of course." moments, it's beyond silly.
Thanks,
--
Raul
On Mon, Mar 3, 2014 at 4:32 PM, Skip Cave wrote:
> Doh! Of course. I had the x & y of i. turned around.
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
>
>
> On Mon, Mar 3, 2014 at 3:28 PM, Kenneth Lettow wrot
It's worst when I can't get to "Of course".
Raul Miller wrote:
I sometimes have so many "Doh! Of course." moments, it's beyond silly.
Thanks,
--
For information about J forums see http://www.jsoftware.com/forums.htm
That's what the forums are for!
And J6's labs (and hopefully some of us are working on fixing them up
for J8 - there's going to be a little back and forth on those issues,
when we are making progress).
And the links at http://www.jsoftware.com/jwiki/Guides/Getting%20Started
I should also note so
Thanks Raul! (I'm suspecting I did need this reminder.)
Pete
Raul Miller wrote:
That's what the forums are for!
And J6's labs (and hopefully some of us are working on fixing them up
for J8 - there's going to be a little back and forth on those issues,
when we are making progress).
And the l
On the issue of interacting with the outside world, it's easy enough to use
"shell" to invoke whatever OS command you like, e.g.
dir 'Q:' NB. Empty result, but what does it mean?
shell 'dir Q:'
The system cannot find the path specified.
J makes it easy to generalize this:
+./'
Here are the kind of steps I take to understand an explanation like Raul's
f=:>: :[:
f A=:2 3 5 7
3 4 6 8
0 f A
|domain error: f
| 0 f A
g=:[:>:]
g A
3 4 6 8
0 g A
3 4 6 8
f
f
>: :[:
g
[: >: ]
5!:4 <'f'
-- >:
-- : -+- [:
5!:4 <'g'
--
Meta-answers:
0.Try a Bing or Google search with
Collatz site:jsoftware.com
1. Try http://www.jsoftware.com/forumsearch and type Collatz in the
first field
However, asking questions in the forum is always fine because even if a
question is an old one there is always a chance t
FYI: I started working on i. in its various guises 30 years ago. Still
working on it.
On Mon, Mar 3, 2014 at 1:32 PM, Skip Cave wrote:
> Doh! Of course. I had the x & y of i. turned around.
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
>
>
> On Mon, Mar 3, 2014 at 3:28 PM, Kenneth Lettow >wr
See also: http://www.jsoftware.com/jwiki/Essays/Collatz%20Conjecture
On Mon, Mar 3, 2014 at 8:30 AM, Jon Hough wrote:
> Beginner question again.I quick task I set myself was to write ONE
> ITERATION of the Collatz function for a given positive integer.
> http://en.wikipedia.org/wiki/Collatz_con
Eric,
It appears my ev_command_enter is NOT being triggered by pressing the Enter
key while in the text field. I have even placed a debugging counter, T, in
ev_command_enter, but it is not being incremented.
Could you or others look at the excerpt of code below, please? I have
patterned it after
Try some javascript debugging. Put in a javascript sentence in the
javascript method ev_command_enter:
alert("wrong number of ajax results");
This will confirm that at least javascript is seeing the event.
There might be hints in the jijx window.
Using submit() in the handler is probably wron
The javascript handler should be more like (from your earlier example):
function ev_command_enter(){jdoajax(["command"],"");}
On Mon, Mar 3, 2014 at 7:32 PM, Eric Iverson wrote:
> Try some javascript debugging. Put in a javascript sentence in the
> javascript method ev_command_enter:
> alert
If you mean the following, I get nothing. No alert.
function ev_command_enter(){alert("wrong number of ajax
results");jdoajax(["command"],"");}
Thanks,
On Mon, Mar 3, 2014 at 7:33 PM, Eric Iverson wrote:
> The javascript handler should be more like (from your earlier example):
>
> function ev_
And *that* is why J is such a great language.
Thanks (many thanks),
--
Raul
On Mon, Mar 3, 2014 at 6:25 PM, Roger Hui wrote:
> FYI: I started working on i. in its various guises 30 years ago. Still
> working on it.
>
>
>
> On Mon, Mar 3, 2014 at 1:32 PM, Skip Cave wrote:
>
> > Doh! Of co
I owe you a longer reply, but I'm having trouble finding the time recently.
In short, if you compose a vet using only &, then x and y won't be combined
until te very last verb. As Raul said, your expression is equivalent to the one
he gave, and no amount of parenthesizing will change the meanin
Pepe wrote:
> The problem is, as you now know, exceeding the 100 KB limit. So I
> followed Chris advice and trimmed the old messages.
>
> These are the answers to your questions,
Below is the message Pepe is responding to, for context (and so that it
shows up in the Forum archives, which I r
Some time ago I conjectured that tacit expressions could be more easily
understood if the reader knew the intended valence. This forum
suggested valence forcing adverbs. Monad, Dyad, and the assertions are
primarily documentation aids. Unit tests also help me to write programs
which at least s
Here's another a way to think about it. Let's say we want to double the sum
of two numbers (and these numbers will be derived from our inputs rather
the raw inputs themselves). The core function here is "sum doubling", so
let's write that first. Well, we know how to do that. It's every-day,
class
I suggest you start with a copy of something that works that has a
similar layout to your example. For example, start with a copy of the
JHS demo3 and gradually migrate in the direction you want.
On Mon, Mar 3, 2014 at 7:41 PM, Brian Schott wrote:
> If you mean the following, I get nothing. No al
*collatz=:(1 0=2|])#(3*1+]),2%~]**
*
collatz 4
2
collatz 5
18
collatz _4
_2
collatz _5
_12
Test for odd/even is *2|n* returning 1 for odd and 0 for even 1 0=2|n
will return 1 0 for odd and 0 1 for even
The (3*1+n) and n%2 terms are a two element result vector
if odd, *1 0 *# returns t
I started with your demogl1.ijs. And I am trying to add things slowly.
But the part I'm working on here is something that I will start over with,
as you suggest.
Thanks,
On Mon, Mar 3, 2014 at 9:39 PM, Eric Iverson wrote:
> I suggest you start with a copy of something that works that has a
> sim
This might be more readable - I had some bold faced characters so got
the extra dusting of *
Don
collatz=:(1 0=2|])#(3*1+]),2%~]
collatz 4
2
collatz 5
18
collatz _4
_2
collatz _5
_12
Test for odd/even is 2|nreturning 1 for odd and 0 for even 1 0=2|n will
return 1 0 for odd and 0 1 f
I really have a different idea of your first paragraph. Here's how I would
approach it:
A=:6
B=:7
A+B
13
+:A+B
26
Use math to get the answer you want.
Explain your plan with an explicit definition which is more general. Now try
it.
f=: 13 :'+:x + y'
A f B
26
Look at the f
Brian, I get the following error when I run it:
ev_body_load failed: ReferenceError: init is not defined, which is
required since the javascript calls it here:
function ev_body_load(){init();} // must use JHS framework load handler
In jijx, I see this:
|value error: initTurtles
| initTurt
Joe,
I am pretty sure that is not the problem. ev_sentence_enter is never
executed, or else I would get the smoutput or the value of T would be
increased. I have trimmed the code as follows, and cannot get the
ev_sentence_enter to execute, at all. I got rid of initTurtles and the
init() and etc. I
Brian, I see you switched to trying ajax in your latest version. I can
take a look at it tomorrow. Here's the version from your previous
message. It correctly fires ev_command_enter on my chrome browser when
I hit enter. It also returns the result of the evaluation:
I suspect your ajax version had
Joe,
I noticed the `{}` at the end of your function ev_body_load(){} command.
Mine was missing that, and maybe the `init();` that was in my original was
wrong. Anyhow, I am not executing the ev_command_enter and I can move on.
Great tiny step.
Thanks,
On Mon, Mar 3, 2014 at 11:40 PM, Joe Bogner
(Er... hopefully obviously, not for only this reason, but this is an
example of the energy that has gone into it.)
Thanks again,
--
Raul
On Mon, Mar 3, 2014 at 8:14 PM, Raul Miller wrote:
> And *that* is why J is such a great language.
>
> Thanks (many thanks),
>
> --
> Raul
>
>
>
> On Mon,
Thanks David! I had no idea J had symbols, that helps greatly and in many
other areas, as does your implementation.
On Mon, Mar 3, 2014 at 8:12 PM, David Lambert wrote:
> Some time ago I conjectured that tacit expressions could be more easily
> understood if the reader knew the intended valence.
-Installation of J801 64 bits on a pc with windows 7
seems OK, but impossible to have graphics running the labs.
See log bellow:
labs_run_jqtide_ 1
── Chapter 2 Patterns: color
── ((2) 1 of 11) Addition Table ─
The pattern seen in an
May be viewmat was not yet loaded. Try typing
require 'viewmat'
before running the lab. Thanks.
On Tue, Mar 4, 2014 at 3:30 PM, Daniel Durieu wrote:
> -Installation of J801 64 bits on a pc with windows 7
> seems OK, but impossible to have graphics running the labs.
> See log bellow:
>
> labs_
59 matches
Mail list logo