For quick finding: Phrases/Sets.

Some useful snippets I always need. Firstly the combinations verb from the factorial dictionary page changed slightly, secondly a simple variations verb

   comb =: 4 :'; (i.@# ,.&.> ,&.>/\.@:(>:&.>))^:x i.@(,&0)&.> 0=i.<:x-y'
   2 comb 5
0 1
0 2
0 3
0 4
1 2
1 3
1 4
2 3
2 4
3 4
   var =: [{."1 i.@]A.~!@-~*[:i.!@]%!@-~
   2 var 4
0 1
0 2
0 3
1 0
1 2
1 3
2 0
2 1
2 3
3 0
3 1
3 2

Then cross product of two 3d real vectors.

   cross=: [: : ([: -/ .*"2 (=i.3),"1 _ ,:)"1

Patchy pattern script golfed down to one J line

   ' ,'';'{~_2#.&.|:\([:-.3<:[:+/_1 0 1|."1"{[:+/_1 0 1|."{])^:40]0=?3$~50 80

Try it.


Equivalent shorter expression. -- RogerHui 2007-10-13 22:01:25

   ' ,'';'{~_2#.@|:\(3>([:+/_1 0 1|."{|:)^:2)^:40]0=?50 80$3

Ascii-art mandelbrot fractal, usable in the irc bot.

   ] agr =: [:{&' .'':' _2:#.&.|:\ 0&=
   ] mandeltop=: agr 2<| (+*:)^:10~ (0.1*i._10)j.~/(0.5-0.1*i.25)
   ] mandelbot=: agr 2<| (+*:)^:10~ (0.1*>:i.10)j.~/(0.5-0.1*i.25)
   ] mandeltop
   ] mandelbot

Another cellular automaton. Runs until interrupted. Set sleepamt to the number of seconds to wait between lines.

   sleep=: 'libc.so.6 select > i i x x x *x' (15!:0) 0;0;0;0; [:<._ 1e6#:*&1e6
   sleepamt=: %40
   0[ (([:sleep]&sleepamt)] [:1!:2&2&.({&' #') 1 3 5 6 e.~ 3 #.\ 0 0&,)^:_]79$1


It annoys me that j601 has the profile changed in such a way, that under linux jconsole, the box drawing characters are set up to something that (I assume) work on utf8 terminals, but mess up my 8859-2 terminal. In case anyone else is frustrated by this too, here's the way I reverted it to the previous settings, that is, the ascii box drawing characters. In the file j601/system/extras/util/boot.ijs, find this statement: boxdraw_j_ 1 2 0 {~ ('Darwin';'Win') i. <UNAME and comment it out with NB..


CategoryHomepage

BJonas (last edited 2011-12-15 12:06:22 by BJonas)