http://www.jsoftware.com/help/dictionary/ctrl.htm
for_i. y do. NB. will assign each item of y to i in loop.
if. isPrime i do. i_index return. end. end. NB. _index is variable name
appended to for_i in this case.
- Original Message -
From: Jon Hough jgho...@outlook.com
To:
hook =: 2 : ('([: u v)';':';'(u v)')
no problems with dyad:
4 + (hook +:)(hook +:) 2 3
12 16
but why does this not work?
+: (hook +:)(hook +:) 2 3
|domain error
--
For information about J forums see
trains, where
the client/consumer left verb argument doesn't need to be monadic as required
when (@:+:) adverb is used.
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Tuesday, April 29, 2014 9:09
better solved with original semi-tacit design:
hook =: 2 : '([:u v) : (u v) '
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Tuesday, April 29, 2014 9:40:06 AM
Subject: Re
3 +: 8 12
|domain error
| 2 3 +:8 12
ah! dyadic +: needs binary arguments
0 1 +: 1 0
0 0
... and the dyadic case works because it ends up with:
4 + 8 12
12 16
On 29-04-14 15:09, 'Pascal Jasmin' via Programming wrote:
hook =: 2 : ('([: u v)';':';'(u v)')
no problems
Jasmin' via Programming
programm...@jsoftware.com wrote:
That is an interesting difference, that shows problem well:
+: 2 : ('([: u v)';':';'(u v)') +:
+: +:
but, the right answer:
hook =: 2 : '([: u v) : (u v)'
+: hook +:
([: +: +:) :(+: +:)
does not pre-assume dyad:
2 + (hook
this?
1 (i. 5 3) ,0 i. 5 3
- Original Message -
From: Joe Bogner joebog...@gmail.com
To: programm...@jsoftware.com
Cc:
Sent: Wednesday, April 30, 2014 11:00:55 AM
Subject: [Jprogramming] stitching two matrices
I'm trying to combine/stitch two matrices into a boxed representation. I
, 2014 at 11:36 AM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
Not really as good as your version, but using 0 10 #:
, each (( [: :@:~. {.1) , '|', :@{:1) each (] @#~ [: = {.1) ] 0
10 #: /:~ 54 59 35 41 46 25 47 60 54 46 49 46 41 34 22
2|25
3|45
4|1166679
5|449
6|0
://www.jsoftware.com/jwiki/Community/Demographics )
-Original Message-
From: programming-boun...@forums.jsoftware.com [mailto:programming-
boun...@forums.jsoftware.com] On Behalf Of 'Pascal Jasmin' via
Programming
Sent: zaterdag 3 mei 2014 17:47
To: programm...@jsoftware.com
Subject
┌─┬─┬─┬─┬─┬─┬─┬─┐
│8 0 3 1 5│8 0 3 2 5│8 0 4 1 5│8 0 4 2 5│9 0 3 1 5│9 0 3 2 5│9 0 4 1 5│9 0
4 2 5│
└─┴─┴─┴─┴─┴─┴─┴─┘
On Thu, May 8, 2014 at 10:53 AM, 'Pascal Jasmin' via Programming
programm
in the frame specified as a vector
of indices, one per axis), each selection must be boxed.
True story.
-Dan
Sent from my iPhone
On May 8, 2014, at 5:34 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
Its the same. Just more descriptive name than catalogue perhaps. Google
booltest =. (0+./) *. 0#
is designed to return 0 for 0 0 0 and i.0, and hopefully this:
booltest i.0 0, but:
(i.0) -: booltest i.0 0
1
the problem with all of this is:
3 : 'if. booltest i. 0 0 do. 1 else. 0 end.' 4
1
so, it appears I need a 3 part test? How would I write it?
- Original Message -
From: Raul Miller rauldmil...@gmail.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Sunday, May 11, 2014 7:53:35 PM
Subject: Re: [Jprogramming] testing for variations of false null empty
On Sun, May 11, 2014 at 5:08 PM, 'Pascal Jasmin' via Programming
:
Sent: Tuesday, May 13, 2014 5:01:04 AM
Subject: Re: [Jprogramming] ^: and boxes
}. 2*//.@(2=,:]) 1 2 3 2 2 4 2 1
2 2 6 4 2 8 2 1
On 12-05-14 19:11, 'Pascal Jasmin' via Programming wrote:
I'm looking for this answer, but a better way to do it.
({~1 0 [: i.#) (@:+:@)^:(1 |. 2= ] ) ;/ 1 2
fascinating,
1 0 1 # inv 3
3 0 3
1 0 1 #!. 2 inv 3
3 2 3
1 0 1 #!. 2 inv 3 3 3
|length error
1 0 1 #!. 2 inv 3 4
3 2 4
(B(#!.'M')) A
ouse on ill
which is the length of +/ B, which is required to not produce the above length
error
these also provide same result.
Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Wednesday, May 14, 2014 10:58:44 AM
Subject: Re: [Jprogramming] Substitution with under
fascinating,
1 0 1 # inv 3
3 0 3
1 0 1 #!. 2 inv 3
3 2 3
1 0 1 #!. 2 inv 3 3 3
') 3 4 5 2 1 1 2
3 4 5 6 1 1 6
(4 : '((r ~:]) (#!. w) inv r -.~ ]) y [ ''r w'' =. x')each/(@:) 3 6 ; 2 6;
3 4 5 2 1 1 2
6 4 5 6 1 1 6
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc
a gold standard of the test case is needed eg
d2=: 2
or
d2=: ,2
or
d2=: ,'2'
or it might be a set...
greg
~krsnadas.org
--
from: 'Pascal Jasmin' via Programming programm...@jsoftware.com
to: programm...@jsoftware.com programm...@jsoftware.com
date: 18 May 2014 06:56
subject: Re
regarding decap,
you may be aware that f@:g is only equivalent to [: f g if g is fully
parenthesized.
+:@:+/ 1 2 3
22
+:@:(+/) 1 2 3
12
([: +: +/) 1 2 3
12
At is super impressive to process and decompose a verb.
I have a simpler process for macros described at
The 'demo' tutorials seem to all point to paths with duplicate /jd/jd/ path (on
windows 8 )
- Original Message -
From: Eric Iverson eric.b.iver...@gmail.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Thursday, May 22, 2014 7:36:14 PM
Subject: [Jprogramming] Jd addon
] Jd addon (data/jd) available
Thanks for the bug report. I will check this tomorrow and get it fixed.
On Thu, May 22, 2014 at 8:46 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
The 'demo' tutorials seem to all point to paths with duplicate /jd/jd/ path
(on windows 8
small bug, the 'vr' demo needs the line
load JDP,'demo/common.ijs' before drd can be used.
I like the demo style, but could there be some command that releases the ctrl-j
hook?
I notice there is a line in spx_jsp_ that detects end of script, and so
perhaps that could be triggered within that
The way I would do it would be to add a prefix passed from x parameter, and
replace spaces (or illegal characters ') with underscores. Assuming other
illegal characters are rare should be fine, but the advantage of prefixing all
columns helps both in preventing collisions with general J names,
don't need. And maybe add a 0 0$ at the
beginning of the result line, if you do not like results.
Thanks,
--
Raul
On Mon, May 26, 2014 at 4:39 AM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
The way I would do it would be to add a prefix passed from x parameter
is there a way to get ^ to make a 64bit number without it being extended
precision? I guess an efficient alternative to ^ if that is not possible:
2^63
9.22337e18
2^63x
9223372036854775808
9223372036854775808
9223372036854775807
Note that the last line is probably a problem. The
a feature if
it's not documented in the dictionary, can I?):
9223372036854775809
9223372036854775807
(And that's probably more important than the using ^ issue.)
Thanks,
--
Raul
On Mon, May 26, 2014 at 1:55 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote
' 2 : . x:@^ 63 '
8.064e_6 5632
The importance of all this, btw, is that there is a significant size penalty to
storing extended integers, as well as a time/space compromise in working with
them.
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
bs
=: }.@:] ,~ (. {.) , (. {.) NB. name not used below one liner
(}.@:] ,~ (. {.) , (. {.))/^:a: ? ($ ]) 25
23 0 22 7 14 15 8 18 4 5 2 6 17 22 7 3 15 12 22 20 0 13 8 3 6
0 23 0 22 7 14 15 8 18 4 5 2 6 17 22 7 3 15 12 22 20 3 13 8 6
0 0 23 2 22 7 14 15 8
so far--J).
However, I enjoy your contributions and the support I have received
from this forum.
Don Kelly
On 27/05/2014 7:38 AM, 'Pascal Jasmin' via Programming wrote:
bs
=: }.@:] ,~ (. {.) , (. {.) NB. name not used below one liner
(}.@:] ,~ (. {.) , (. {.))/^:a: ? ($ ]) 25
Though I understand Roger's 0.: solution maybe faster, there is an
alternative to your padded base use of #:
10 #. inv 2^15
3 2 7 6 8
so a comparable to haskell approach
+/ 10 #. inv 2^1000x
1366
and a verb version:
([: +/ #. inv) or 10([: +/ #. inv) if you always want base 10
I've posted this verb before:
amendV
4 : '( ({.^:((,1) -: $)) }: x) ({: x) } y'
It unpacks the arguments to } from boxes, and works but here is another neat
approach.
eval =: 1 : ' a: 1 : m'
advswap =: 2 : (':';'u x v eval y')
I've shown eval before. It turns a string into any tacit
nice.
Ginx=: _2 \ ;/
(Ginx 2 3 0 5 1 2) {i.5 6
15 5 8
- Original Message -
From: Nollaig MacKenzie noll...@amhuinnsuidhe.net
To: programm...@jsoftware.com
Cc:
Sent: Thursday, May 29, 2014 1:27:46 PM
Subject: Re: [Jprogramming] Indexing into array
I use
Ginx=: 0.@1
thanks for reporting on this.
One nice advantage of symbols is that it removes the space padding of strings,
and so you can define sym1 as this:
sym1=: 100 2 $ s:(10$'ab')
7!:5 ;: 'str1 sym1'
27648 2176
There is still a small issue with i. I'm not completely sure how to best search
for is unlikely to have the prefix. so:
sym =: 1 : 's:@:boxopen@:[ u ]'
('ab';'abc') i.~ sym a
1 2
'ab' i.~ sym each a
1
('ab') i.~ each sym a
┌─┐
│1│
└─┘
('ab';'abc') i.~ each sym a
┌─┬─┐
│1│2│
└─┴─┘
- Original Message -
From: 'Pascal Jasmin' via
good news about wd 'timer' for forms. A wishlist would include a way for
minimal library load for jconsole support.
I don't see it mentioned here though
http://www.jsoftware.com/jwiki/System/ReleaseNotes/J802
I did see that the timer qt demo app has been updated, but its hard to
understand
can also set as tacit one line:
sys_timer_z_=: show_base_
- Original Message -
From: Joe Bogner joebog...@gmail.com
To: programm...@jsoftware.com
Cc:
Sent: Friday, May 30, 2014 10:42:57 AM
Subject: Re: [Jprogramming] opportunity to show off jhs or qt
On Fri, May 30, 2014 at 10:08 AM,
bbill@gmail.com
To: 'Pascal Jasmin' via Programming programm...@jsoftware.com
Cc:
Sent: Friday, May 30, 2014 11:19:17 AM
Subject: Re: [Jprogramming] opportunity to show off jhs or qt
Oh sorry! I thought ptimer was documented but not yet. Basically
it is very simple, if your form id is 'foo
sorry for previous message, was running timer and not ptimer.
It does not appear as though you can get a timer into an arbitrary locale by
just doing wd 'pc a' there. The form has to be visible, or needs an initial
show?
- Original Message -
From: 'Pascal Jasmin' via Programming
:00:24 PM
Subject: Re: [Jprogramming] opportunity to show off jhs or qt
did the cube rotate? did you test on the latest j802/jqt beta?
31.05.2014, в 7:48, 'Pascal Jasmin' via Programming
programm...@jsoftware.com написал(а):
from base,
wd 'pc a;' NB. or 'pc a'
wd 'pshow' NB. shows
to show off jhs or qt
what is your JVERSION ?
31.05.2014, в 8:03, 'Pascal Jasmin' via Programming
programm...@jsoftware.com написал(а):
the shader demo works. cube rotates, etc...
when I try those 3 lines from the base locale (jqt802 console session), the
error shown occurs.
- Original
form
wd 'set g timer 1000'
b_g_timer =: 3 : 'smoutput@:''b'';(6!:0) '
I was stuck on it too
On Fri, May 30, 2014 at 9:12 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
Engine: j701/2011-01-10/11:25
Library: 8.02.06
Qt IDE: 1.1.1/5.3.0
Platform: Win 64
The real problem with I. is that it returns 0 whether the first element is 1,
or no elements are 1.
But this works:
I. 0,. 4 3 $ 1 0 0 0 1 0 0 0 1 0 0 0
1
2
3
0
(i.@:# ,. I.) 0,. 4 3 $ 1 0 0 0 1 0 0 0 1 0 0 0
0 1
1 2
2 3
3 0
the column indexes (2nd col) are off by 1, and 0 means
┌───┬───┬───┬───┐
│0 1│1 2│2 2│2 3│
└───┴───┴───┴───┘
I2d 4 3 $ 1 0 0 0 1 0 0 0 1 0 0 0
┌───┬───┬───┐
│0 1│1 2│2 3│
└───┴───┴───┘
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent
better than mine, but only works with square matrix
I2d =: (I.@:, { [: , @:,0/i./@:$)
I2d 4 3 $ 1 0 0 0 1 0 0 0 1 0 0 0
┌───┬───┬───┐
│0 0│1 1│2 2│
└───┴───┴───┘
I2d 4 3 $ 1 0 0 0 1 0 0 1 1 0 0 0
┌───┬───┬───┬───┐
│0 0│1 1│2 1│2 2│
└───┴───┴───┴───┘
- Original Message
Dan wins again,
($ #: I.@:,) 2 4 3 $ 1 0 0 0 1 0 0 1 1 0 0 0
0 0 0
0 1 1
0 2 1
0 2 2
1 0 0
1 1 1
1 2 1
1 2 2
- Original Message -
From: Dan Bron j...@bron.us
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Saturday, May 31, 2014 11:35:00 AM
Subject: Re:
untested, but
Stacks =. cones 'stack' NB. should probably use this variable for only
stacks/objects
someprivatestack__Stacks =: conew 'stack'
somefield__someprivatestack__Stacks NB. accessing deeper.
or
pop__someprivatestack__Stacks ''
to answer your last question more directly,
a=.
I don't know what you mean by A tacit definition can reference the caller's
local names
Do you mean the values in base, or there is a way to access local variables
inside another function?
From: Don Guinn dongu...@gmail.com
To: Programming forum
sorry for leaving console output in there,
Your output seems incorrect, perhaps email is eating spaces. the correct value
for p is:
p=: 3 18$'Hello World! v v @# 55+, from J^ '
new_befunge_ p
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│H│e│l│l│o│ │W│o│r│l│d│!│ │f│r│o│m│ │J│
probably didn't paste the last one correctly,
881 i.2 3 4
88 88 88
88 88 88
- Original Message -
From: David Lambert b49p23t...@stny.rr.com
To: programming programm...@jsoftware.com
Cc:
Sent: Sunday, June 1, 2014 9:40:31 PM
Subject: Re: [Jprogramming] Tacit verb question
Rank
a tacit version
( \:~ ( i. { +/\@:[ % +/@:]) ] ) 1 100 5 10
1 0.862069 0.991379 0.948276
- Original Message -
From: Joe Bogner joebog...@gmail.com
To: programm...@jsoftware.com
Cc:
Sent: Tuesday, June 3, 2014 7:32:24 AM
Subject: [Jprogramming] cumulative sum percent
Is there a
in your list, you are making 5 copies of the same object. (return value of 5
copies of the same locale)
this should be what you want.
list =: conew 5$ 'GameObject' NB. should return 5 distinct locales
inl_z_ =: (cocurrent@] .@] [)1 0
] list =. cocreate 5$ a:
┌─┬─┬─┬─┬─┐
│5│6│7│8│9│
you can type cocreate in J console, and it will tell you that it is 18!:3.
Then look up those foreign definitions.
cocreate will create an empty numbered locale. If you look at the conew
definition, you will see that it uses cocreate to start off the process.
inl sets a locale to run code
that they're better at than anyone else, and that's
their yardstick for efficiency.
But too much of that and it all turns into noise.
Thanks,
--
Raul
On Tue, Jun 3, 2014 at 7:52 AM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
the definition for conway's game of life
this would be applied to my sample
data. I think I still have the problem of matching records back (assuming I
didn't have the function take the whole input table). Roger's solution got
me up and running. I appreciated your solutions as well
On Tue, Jun 3, 2014 at 10:12 AM, 'Pascal Jasmin' via
I answered your questions about objectlists yesterday. you need to use the verb
inl.
What you've done below is just create 5 boxed strings 'Account'. These are not
locales.
When you create objects the return values look like boxed numbers (though
they are strings of numbers). If your list
inl is most useful for working with lists. It allows you to send the same
command to all list members (or sublists). If you want to work with just one
list member,
fname__myobj [ myobj =. {. list
you could also use java looking code with for_obj. list do. fname__obj =: 'no
name given' end.
It can all be part of the same array, or one variable at least.
,.@: each
(5$0);('Jon';'Dick';'Harry';'Sally';'May');'Smith';'Jones';'Black';'White';'Eye'
┌─┬─┬─┐
│0│Jon │Smith│
│0│Dick │Jones│
│0│Harry│Black│
│0│Sally│White│
│0│May │Eye │
└─┴─┴─┘
lists of objects
is viewmat documented elsewhere than the source? And is there a built in
animation method?
ie. displaying a matrix that changes over time or cycling over 2d of a 3d
shape? (I'm able to crash j802 by sending it 3d shapes)
--
from the source, there is only the viewmat lab.
There is no built-in animation.
(I'm able to crash j802 by sending it 3d shapes)
Please let us know how to reproduce this, thanks.
On Sat, Jun 7, 2014 at 9:44 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
is viewmat
an optimization to short circuit on first true, while sorting them in order.
break1 =: (1 : 'for_i. y do. if. u i do. i return. end. end.')
(-: |.)@: break1 \:~ ~. , */~ 100+i.900
906609
timespacex '(-: |.)@: break1 \:~ ~. , */~ 100+i.900'
0.0350227 3.56737e7
timespacex ' ./ (#~
}.@(13!:12)@(_) )'
(-: |.)@(.0@:)0 break2 \:~ ~. , */~ 100+i.900
Henry Rich
On 6/8/2014 12:05 PM, 'Pascal Jasmin' via Programming wrote:
an optimization to short circuit on first true, while sorting them in order.
break1 =: (1 : 'for_i. y do. if. u i do. i return. end. end
=:1 :'(: 13!:8 (15_))^:uu :: (LF taketo }.@(13!:12)@(_) )'
(-: |.)@(.0@:)0 break2 \:~ ~. , */~ 100+i.900
Henry Rich
On 6/8/2014 12:05 PM, 'Pascal Jasmin' via Programming wrote:
an optimization to short circuit on first true, while sorting them in order.
break1 =: (1 : 'for_i. y
. It did not stop at finding the first
matching index.
#~. , */~ 100+i.900
227521
({~ (-: |.)@([smoutput)@:0 i. 1:) \:~ ~. , */~ 100+i.900
...Region has 227520 lines, 227520 words,...
906609
Date: Sun, 8 Jun 2014 20:25:01 -0700 (PDT)
From: 'Pascal Jasmin' via Programming programm
it's possible to emulate them as used-defined utilities (eg asgn=:dyad def
'(x)=:y' or '(y)=:y~' for things like += etc).
good explanation, but something missing from J is the ability to use those
tricks with =. affecting the caller. Though this topic comming up finally led
me to a
---
Subject: Re: [Jprogramming] copula
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
Date: Wed, 11 Jun 2014 06:48:44 -0700 (PDT)
To: programm...@jsoftware.com programm...@jsoftware.com
it's possible to emulate them as used-defined utilities (eg asgn=:dyad def
'(x)=:y
, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
I wrote something else cool instead:
Parsing function parameters outside of the function:
last section at:
http://www.jsoftware.com/jwiki/PascalJasmin/J%20tricks%20with%20assign
One thing that is still stumping me, is there any
I think that is great, Dan. I like the table approach, especially for its use
for mass updating internal parameters.
My approach is simpler, and is designed more to reduce line count than to
expand it, while still providing the documentation benefit of named parameters.
I disagree that its
I misunderstood the question, but here is a way of getting the 2nd match of a
list.
ia =. 4 : ' x } y'
}.@:I.@:~:@:(~: ia ] , (1,#) $ _1:) 2 # i.10
1 3 5 7 9 11 13 15 17 19
- Original Message -
From: Marshall Lochbaum mwlochb...@gmail.com
To: programm...@jsoftware.com
Cc:
Sent:
I like your example, but though its very cool, I see why you think its useless
for J. Your goals seem to have been to make a pretty calling convention rather
than leverage J's existing multi-assign facilities which is what my approach
does, with the convention that a passed null parameter is
Found a way to get c a trains, and even a sensible implementation for c c
trains with modified parsing that may be convenient for other purposes as well.
eval =: 1 : ' a: 1 : m'
CONJ =: 2 : 'v eval u'
+: + CONJ'@:'
+:@:+
+: +: + CONJ'@:' CONJ'@:'
+:@:(+:@:+)
(CONJ '@:') is an
The approach with ar looked promising, and I made perhaps a poor implementation:
lexset2 =: 2 : ('(n) =: u(y) ar';'y')
lex2 =: 1 : 0
a =. m~ 5!:0 y
(m) =: @:(0{ , @:(((,'0');a) (0}) )@:@:(1{))@: m~
a
)
+ lexset2 'g' 1
1
'g' lex2 2
3
'g' lex2 2
5
:@:[ lexset2 'g' 0
0
Its rare to forget that adverbs and conjunctions are greedy to the left. The
mistake I make regularly is forgetting that conjunctions are not greedy to the
right.
- Original Message -
From: Ric Sherlock tikk...@gmail.com
try:
coprime =. =0@:(+/)@:(e.q:)
the adverb / is greedy and
an explicit version for clarity
rangei
[ + :@] i.@- [
2 rangei 5
2 3 4 5
dyad verb where y just holds the total so far.
4 : 'y + +/ 1= x +./ (. x % 3) rangei (. x % 2)'/ 2,~ 4+ i.11997
7295374 NB. includes 1/3 and 1/2
timespacex '4 : ''y + +/ 1= x +./ (. x % 3) rangei (. x % 2)''/
434688
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Monday, June 16, 2014 1:49:26 PM
Subject: Re: [Jprogramming] Project Euler 73
an explicit version for clarity
rangei
[ + :@] i
I was at first surprised that the faery sequence approach is so slow, when its
supposed to be an improvement, but then I realized that it is an algorithm that
lists all fractions, and so will do 7.3M loops, on each loop adjusting at least
5 memory locations, and if done through ^:_ or some
Though its hard to see usefulness of the feature, it does have the advantage of
shortcutting parsing for a primitive, and it is extremely unlikely that you
want to use !. with a random verb, and so a sentence would be tied closely to
!., and its likely that the sentence was not intended.
all one line,
treetest =: (((' ') ('' ,~ ] #~ [ * :@:#@:])0 1~ each [: #S:1 {::) , each
@: S:0) a=: (fac =: 3 : 'q =. q: y if. 1#q do. (y ; [: fac 0 each y (] ,
%) ([: */ ] {~ # ?~ .@:-:@:#)) q else. y end.') 176715
treetest
1767150
189
9
3
3
21
Fantastic! Thank you.
On another note, $: can be frustrating to attempt to use because syntax/domain
errors often/usually/always crash J (8.01)
- Original Message -
From: Marshall Lochbaum mwlochb...@gmail.com
To: 'Pascal Jasmin' via Programming programm...@jsoftware.com
Cc:
Sent
└─┘││
││ │││ │└──┴───┘││ ││ │└──┘│└──┘│││ ││
││ │││ │││ │└──┴┴┘││ ││
││ │││ ││└─┴──┘│ ││
││ │└┴───┴┴──┴───┘│
└┴──┴──┘
- Original Message -
From: Marshall Lochbaum mwlochb...@gmail.com
To: 'Pascal Jasmin' via Programming programm
currently the following code generates a domain error at the ('f') =: y
line.
testlocal =: 3 : 0
f =. 33
assign =. 4 : '(x) =: y'
'f' assign f + y
('f') =: f+y
NB. f =: f+y
f
)
testlocal 2
|domain error: testlocal
| ('f') =: f+y
f
35
the commented line also generates the same
,
--
Raul
On Thu, Jun 19, 2014 at 11:53 AM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
currently the following code generates a domain error at the ('f') =: y
line.
testlocal =: 3 : 0
f =. 33
assign =. 4 : '(x) =: y'
'f' assign f + y
('f') =: f+y
NB. f
mode_z_ =: 2 : '([: v inv u hook v) finallyC (v inv) ' NB. v y must return y
finallyC_z_ =: 2 : 'u :: ((v)][:13!:12([]))
hook_z_ =: 2 : ('u v y' ;':';'x u v y')
plus =: +
bizmode =: (3 : 0 :. (3 : 0))
plus =: +
y
)
plus =: *
y
)
this works as intended: mode switches definition of
Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Saturday, June 21, 2014 11:58:44 AM
Subject: [Jprogramming] why won't this work (bug in :: ?)
mode_z_ =: 2 : '([: v inv u hook v) finallyC (v inv) ' NB. v y must
a
0
I guess this is part of the general issues with adverbs in locales (:.v) is the
adverb, which I understand is needed for adverbs defined in z to work
elsewhere, but this affects the usefulness of :. and :: .
- Original Message -
From: 'Pascal Jasmin' via Programming
...@jsoftware.com
Sent: Sunday, June 22, 2014 9:46:00 AM
Subject: Re: [Jprogramming] why won't this work (bug in :: ?)
I think this is a feature, not a bug. ( I assume you meant :. obverse)
On 22.06.2014, at 10:29, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
Here is the related bug
I got close enough to zero that I resented you for this, for a brief moment.
That quickly vanished because the easiest way to find the answers is through
the console, and they are all intriguing questions. If someone contributed
some easier tests they would still be very valuable to many.
You can change the sslp =: line in j802 to point to bin. Otherwise this needs
openssl (I think always available on linux and mac) RIPEMD160 is called
through sr160 function.
Library is faster than windows built in dlls
require 'dll'
NB. require 'shards'
sslp =: IFWIN pick
can try load jpath '~/path/to/my/script.ijs'
- Original Message -
From: Jon Hough jgho...@outlook.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Wednesday, June 25, 2014 11:52:16 AM
Subject: [Jprogramming] File name error
I have a script lying somewhere on my
FYI, RIPEMD is a different function than SHA1. Also, an openssl binding is
much faster, and cross platform. The required dll is also now bundled with
J802 on windows, and iirc, is dependably available on linux and osx, and maybe
android.
- Original Message -
From: Raul Miller
byte hash'
|domain error: cd
| sslRIPEMD160(y);(#y);output
This test was on a 32 bit win 7 machine. Am I calling this correctly? I
don't see the problemo?
jdb
On Wed, Jun 25, 2014 at 12:30 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
You can change the sslp
an approach I would take: (untested)
'p1 p2 p3 p4' =: i.4
(make numeric 'row column value' data) 4 : 'for_i x do. y=. v (r;c) } y [''r
c v''=. i end. y' 15 4 $ 0
- Original Message -
From: June Kim (김창준) junea...@gmail.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent:
win 7 machine. Am I calling this correctly? I
don't see the problemo?
jdb
On Wed, Jun 25, 2014 at 12:30 PM, 'Pascal Jasmin' via Programming
programm...@jsoftware.com wrote:
You can change the sslp =: line in j802 to point to bin. Otherwise
this
needs
I like yours better, a variation on Marshalls:
([: }: 1 #/.@:$~ ],]) 7
1 2 3 4 5 6 7 6 5 4 3 2
and yours tacitly:
(] }:@:- [: |@:i: :) 7
1 2 3 4 5 6 7 6 5 4 3 2
- Original Message -
From: R.E. Boss r.e.b...@outlook.com
To: programm...@jsoftware.com
Cc:
Sent: Thursday,
a similar solution that avoids making an intermediate list:
./ 13 */@:. \ n
regarding avoiding those items that contain a 0, for the problem at hand, I
would guess it isn't necessary since a 0 ensures that the product cannot be
maximum, and I would guess it slows things down. But if you
- Original Message -
From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
To: programm...@jsoftware.com programm...@jsoftware.com
Cc:
Sent: Thursday, July 3, 2014 7:35:15 PM
Subject: Re: [Jprogramming] Project Euler Problem 8
a similar solution that avoids making
well presented, thanks.
You may wish to explain, but maybe too technical?
Base58Check=:('1' #~ [: +/ (0{a.) = ]) , [: b58fd 256x #. a. i. ]
- Original Message -
From: John Baker bakerj...@gmail.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Thursday, July 3, 2014
...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of 'Pascal
Jasmin' via Programming
Sent: Thursday, June 26, 2014 8:26 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] RIPEMD-160 hashes
the definition works in win64 with J802's bundled dll.
maybe
-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of 'Pascal Jasmin'
via Programming
Sent: Saturday, July 05, 2014 10:21 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] RIPEMD-160 hashes
hexhash is an adverb. hfd is in default profile for J7
Its not quite the case that it has to be a constant, but it does have to be a
noun.
this conjunction is useful for tacit code and dyadic adverbs that take noun
arguments:
eval =: 1 : ' a: 1 : m'
advswap =: 2 : (':';'u x v eval y')
1 2 3 ([ 13 advswap '}' ]) i.10
0 13 13 13 4 5 6 7 8 9
You are describing item amend, which may be turned into a verb as follows:
ia =: 4 : 'x} y'
1 1 0 ia 2 2 2 ,:~ 1 2 3
2 2 3
1 1 0 ([ ia 2 2 2 ,:~ ]) 1 2 3
2 2 3
From: Erling Hellenäs erl...@erlinghellenas.se
To: programm...@jsoftware.com
Sent:
1 - 100 of 1430 matches
Mail list logo