Re: [Jprogramming] Syntax error

2021-09-21 Thread Vijay Lulla
Thank you, Raul and Elijah!

Just a thought...maybe we ought to put a caution about this unsupported
syntax on the NuVoc page for q:?

Cordially,
Vijay

On Tue, Sep 21, 2021 at 3:52 AM Raul Miller  wrote:

> This also works:
>
>V=: /(@,:)
>
> FYI,
>
> --
> Raul
>
> On Tue, Sep 21, 2021 at 2:31 AM Elijah Stone  wrote:
> >
> > On Tue, 21 Sep 2021, Vijay Lulla wrote:
> >
> > > I keep getting 'syntax error' for the line V=: /@,:
> >
> > That line uses a feature which is sadly no longer supported.  You can
> > replace it with: V=: {{ u/@,: }}
> >
> >   -E
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 
Vijay Lulla, PhD
ORCID | <https://orcid.org/-0002-0823-2522> Homepage
<http://vlulla.github.io> | Google Scholar
<https://scholar.google.com/citations?user=VjhJWOgJ=en> | Github
<https://github.com/vlulla>
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Syntax error

2021-09-21 Thread Vijay Lulla
Hi Jers,
I was reading the original vocabulary page for prime factors (
https://www.jsoftware.com/help/dictionary/dqco.htm ) and trying out the
examples listed on that page. I keep getting 'syntax error' for the line
V=: /@,: . I don't know what I'm doing wrong. Could this be an issue with
my installation? Anyways, here is the output from my JQT window.

V=: /@,:

|syntax error

| V=: /@,:

JVERSION

Engine: j903/j64avx2/linux

Beta-p: commercial/2021-09-13T09:39:35

Library: 9.03.06

Qt IDE: 1.9.2/5.9.5(5.12.8)

Platform: Linux 64

Installer: J903 install

InstallPath: /home/vijay/code/J/j903

Contact: www.jsoftware.com


Any guidance you can provide is greatly appreciated.

Thanks,

Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] python3 addon bug?

2021-07-02 Thread Vijay Lulla
I get the following error:

In [6]: jbase.init(True)
---
OSError   Traceback (most recent call last)
 in 
> 1 jbase.init(True)

~/code/J/j903/addons/api/python3/jcore.py in init(loadprofile)
 16  if jt!=0:
 17   raise AssertionError('J: init already run')
---> 18  libj=  CDLL(pathdll)
 19  libj.JInit.restype = c_void_p
 20  libj.JGetR.restype = c_char_p

~/anaconda3/lib/python3.8/ctypes/__init__.py in __init__(self, name, mode,
handle, use_errno, use_last_error, winmode)
371
372 if handle is None:
--> 373 self._handle = _dlopen(self._name, mode)
374 else:
375 self._handle = handle

OSError: /home/eric/j64-806/bin/libj.so: cannot open shared object file: No
such file or directory



On Fri, Jul 2, 2021 at 11:40 AM Eric Iverson 
wrote:

> The file /Users/brian/j64-807/bin/libj.so is for linux. For osx you need:
> /Users/brian/j64-807/bin/libj.dylib
>
> You could try finding where that is set in the addon and editing as
> appropriate.
>
> On Fri, Jul 2, 2021 at 11:37 AM Brian Schott 
> wrote:
>
> > Piggybacking, I could not get an even more basic python3 version to work.
> > It looks like the file j64-807/bin/libj.so is missing.
> > I am using OSX.
> > Below is my session.
> > Thank you, in advance,
> >
> > server:~ brian$ python3
> > Python 3.7.7 (v3.7.7:d7c567b08f, Mar 10 2020, 02:56:16)
> > [Clang 6.0 (clang-600.0.57)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import sys
> > >>> sys.path.append('/Users/brian/j64-807/addons/api/python3')
> > >>> import jbase as jbase
> > >>> jbase.init(True)
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "/Users/brian/j64-807/addons/api/python3/jcore.py", line 18, in
> init
> > libj=  CDLL(pathdll)
> >   File
> >
> >
> "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py",
> > line 364, in __init__
> > self._handle = _dlopen(self._name, mode)
> > OSError: dlopen(/Users/brian/j64-807/bin/libj.so, 6): image not found
> >
> >
> > On Fri, Jul 2, 2021 at 3:45 AM Raoul Schorer 
> > wrote:
> >
> > > Hi,
> > >
> > > I'm attempting to use J in VisiData <
> https://github.com/saulpw/visidata
> > >.
> > > When testing api/python3 with this program:
> > >
> > > import sys
> > > sys.path.append('/home/raoul/Desktop/j903/addons/api/python3')
> > > import jbase as jb
> > > import numpy as np
> > >
> > > jb.init(True)
> > >
> > > def j_mean(vals):
> > > jb.set('temp', np.array(vals))
> > > e = jb.do('var=:(+/%#)temp')
> > > r = jb.get('var')
> > > return (r,e)
> > >
> > > print(j_mean(list([1,2,3,4])))
> > >
> > > Everything works as expected. But when trying to call 'j_mean' from
> > > VisiData:
> > >
> > > e = jb.do('var=:(+/%#)temp') yields error code 17 (file exists)
> > >
> > > My understanding is that 'jbase.set' serializes its numpy array
> argument
> > to
> > > a file, and the problem is that this file is perhaps left lying around
> > when
> > > it shouldn't.
> > > I know this is a rather vague question, but does anybody have an idea
> on
> > > how to fix this? Or is the problem likely on the VisiData side?
> > >
> > > Thanks!
> > > Raoul
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> >
> >
> > --
> > (B=) <-my sig
> > Brian Schott
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 
Vijay Lulla, PhD
ORCID | <https://orcid.org/-0002-0823-2522> Homepage
<http://vlulla.github.io> | Google Scholar
<https://scholar.google.com/citations?user=VjhJWOgJ=en> | Github
<https://github.com/vlulla>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Addon - viewmat

2021-06-17 Thread Vijay Lulla
Maybe you can try

viewbmp jpath '~addons/graphics/bmp/toucan.bmp'

?

On Thu, Jun 17, 2021 at 9:32 PM  wrote:

> Error reading bmp file.
>
>
>
> JVERSION
>
> Engine: j902/j64avx2/windows
>
> Release-a: commercial/2020-12-05T13:36:01
>
> Library: 9.02.08
>
> Qt IDE: 1.9.1/5.12.10(5.12.10)
>
> Platform: Win 64
>
> Installer: J902 install
>
> InstallPath: c:/users/bill/j902
>
> Contact: www.jsoftware.com <http://www.jsoftware.com>
>
>
>
> load 'viewmat'
>
> fexist '~addons/graphics/bmp/toucan.bmp'
>
> 1
>
> viewbmp '~addons/graphics/bmp/toucan.bmp'
>
> file read error
>
>
>
> Regards
>
>
>
> Bill Szuch
>
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 
Vijay Lulla, PhD
ORCID | <https://orcid.org/-0002-0823-2522> Homepage
<http://vlulla.github.io> | Google Scholar
<https://scholar.google.com/citations?user=VjhJWOgJ=en> | Github
<https://github.com/vlulla>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] New video lab for the generating of Large Catalan numbers.

2020-10-27 Thread Vijay Lulla
Bob,
I agree, these videos were excellent!! Thanks for making, and sharing, them.
Appreciatively,
Vijay.

On Tue, Oct 27, 2020 at 1:45 AM 'robert therriault' via Programming <
programm...@jsoftware.com> wrote:

> Thanks Ric,
>
> Some of the animations are quick, but one of the advantages of video is
> that you can replay sections to see what is going on. I wouldn't expect
> many to be able to pick up all of the concepts on the first pass. It may be
> a case of being too close to the product, but when I slowed them down I
> found my attention lagged.
>
> If you were wanting to see the next one after each one that you finished,
> I will accept that as one of the finest compliments I have been given.
>
> Thank you
>
> Cheers, bob
>
> > On Oct 26, 2020, at 22:29, Ric Sherlock  wrote:
> >
> > Hi Bob,
> > Just worked my way through the playlist. Fantastic!
> > From my point of view it was a great balance of maths, computing and
> > problem solving. You also managed to slide a heap of J primitives and
> > features into the Labs without losing the focus on the problem.
> > I thought the animations were very clean and clear although sometimes I
> > felt they could be a bit slower to help me understand exactly what was
> > going on.
> > For my taste some of the sound effects could also have been a bit more
> > subtle.
> > I liked how you've split the Lab into bite size chunks - and they always
> > left me wanting to do just one more to find out what came next.
> >
> > Well done!!
> >
> >
> > On Tue, Oct 27, 2020 at 12:43 PM 'robert therriault' via Programming <
> > programm...@jsoftware.com> wrote:
> >
> >> Oops,
> >>
> >> Forgot to include the link to the playlist of the videos.
> >>
> https://www.youtube.com/watch?v=5p8--DMRO2U=PL275xqeqDUOiOQb8Vic-E_ocq10EC_ELQ
> >>
> >> Cheers, bob
> >>
> >>> On Oct 26, 2020, at 16:26, 'robert therriault' via Programming <
> >> programm...@jsoftware.com> wrote:
> >>>
> >>> Greeting everyone,
> >>>
> >>> As you may know I have created some video labs to support some of the
> >> Nuvoc entries for the verbs Behead, Curtail, Tail, Head, and Tally and
> >> these labs can be found in the addons section in both JHS and Jqt lab
> >> menus.
> >>>
> >>> I have now produced a video lab on the Catalan numbers consisting of 13
> >> sections/videos and several supporting learning tools available through
> the
> >> IDE. It is available in the addons lab section under the name of Video -
> >> Generating the Catalan Numbers. I have done this as a proof of concept
> and
> >> would be interested to hear what the feeling is about using media in the
> >> labs within this way. It certainly takes longer to create the labs, but
> >> along the way I have learned that any video available on youtube can be
> >> used to enhance instruction, in fact even parts of videos may be run
> within
> >> a lab. It seems to me a powerful tool that could attract learners to
> the J
> >> environment.
> >>>
> >>> If you would like here is a link to the videos alone, without accessing
> >> the J IDE.
> >>>
> >>> To get access to the new labs, you need to have an up to date version
> of
> >> the lab and media addons and for jqt, be running the full version to
> have
> >> access to the web views. Also to have access to youtube where the videos
> >> reside.
> >>>
> >>> Cheers, bob
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J and data structures

2019-11-21 Thread Vijay Lulla
Rob,
Can you please send me the paper too?  I would like to read it.
Thanks in advance,
Vijay.

On Tue, Nov 19, 2019 at 8:02 PM 'Rob Hodgkinson' via Programming <
programm...@jsoftware.com> wrote:

> Devon, my previous reply also brought to mind a very good example you
> request below …
>
> In kdb+ the “table” datatype is built atop the “dictionary” data type… a
> table may be perceived as a list of dictionaries (Key value pairs) that are
> Columns/Values.  I’ll send you a paper offline that shows this.
>
> Thanks, Regards Rob
>
> > On 19 Nov 2019, at 5:14 am, Devon McCormick  wrote:
> >
> > I would like to see examples of where a dictionary would be the preferred
> > way of dealing with some data.  Does anyone know of any, not necessarily
> in
> > J, that are short and to the point?
> >
> >
>
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

-- 
Vijay Lulla

Assistant Professor,
Dept. of Geography, IUPUI
425 University Blvd, CA-207C.
Indianapolis, IN-46202
vlu...@iupui.edu
ORCID: https://orcid.org/-0002-0823-2522
Online: http://vijaylulla.com | https://github.com/vlulla
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Vijay Lulla
Welcome back, Dan!  Great to see you back on the forums after a long time!
  I have learned a lot from your emails and your code scripts...and I
expect to learn more from your future engagement.
Cordially,
Vijay.

On Fri, May 3, 2019 at 9:55 AM jjj .  wrote:

>  I haven't read this whole thread, so apologies if this has already been
> covered, but many many moons ago I wrote a util to do this:
> https://code.jsoftware.com/wiki/User:Dan_Bron/Snippets/DOOG
>
>g=. *: ` -: `^
>
>y=. 3 1 0
>
>
>
>g Across y
>
> 9 0.5 1
>
>
>
> It's more general than that, but Across was the original motivating need
> for the script.
> -Dan
> On Thursday, May 2, 2019, 8:59:25 PM EDT, pietdion 
> wrote:
>
>  Hopefully not an ignorant question.
>
> Am looking for a simple (tacit, non complicated) construction (verb?
> adverb? conjunction?) “c" that takes a gerund and applies the successive
> verbs in the gerund to successive items.
>
> A simple example is
>
> g=. *: ` -: `^
> y=. 3 1 0
> g  c  y
> 9  0.5  1
>
> What “c”  achieves this for arbitrary gerunds g's and y’s?
>
> I realise this can be done in a variety of explicit ways and  with the
> agenda construct.All I can come up with is intricate constructions.
> Looking for something simple and direct.  Seems to have a lot of uses.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] j901-beta-c

2019-04-04 Thread Vijay Lulla
Qt 5, I think.  Following the steps listed on
https://code.jsoftware.com/wiki/Guides/Qt_IDE/Install#Ubuntu.2FLinux_Mint
states that I already have the newest version of each of these libraries.

On Thu, Apr 4, 2019 at 8:00 PM bill lam  wrote:

> what is the version number of your Qt libraries?
>
>
> On Fri, Apr 5, 2019, 7:43 AM Vijay Lulla  wrote:
>
> > Trying this jqt on linux (ubuntu 18.04.2 LTS) raises the error "jqt:
> > relocation error: jqt: symbol _ZdlPvm version Qt_5 not defined in file
> > libQt5Core.so.5 with link time reference".  jconsole seems to be working
> > fine.
> >
> > On Thu, Apr 4, 2019 at 6:18 PM bill lam  wrote:
> >
> > > The list of changes is in release notes here
> > >
> > > https://code.jsoftware.com/wiki/System/ReleaseNotes/J901
> > >
> > > There are incompatible changes. In particular, the change in } will
> > likely
> > > to break existing codes.
> > >
> > > On Thu, Apr 4, 2019, 10:13 PM Eric Iverson 
> > > wrote:
> > >
> > > > J901 beta is available as a zip install package for
> > > windows/mac/linux/rpi.
> > > > Except for rpi (nonavx 32 bit), 901 will be available only as avx 64
> > bit.
> > > >
> > > > Get your zip install package at:
> > > >  https://code.jsoftware.com/wiki/System/Installation/Zips
> > > >
> > > > After your first install of j901 beta you will be able to do all
> > > subsequent
> > > > j901 beta updates with pacman.
> > > >
> --
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] j901-beta-c

2019-04-04 Thread Vijay Lulla
Trying this jqt on linux (ubuntu 18.04.2 LTS) raises the error "jqt:
relocation error: jqt: symbol _ZdlPvm version Qt_5 not defined in file
libQt5Core.so.5 with link time reference".  jconsole seems to be working
fine.

On Thu, Apr 4, 2019 at 6:18 PM bill lam  wrote:

> The list of changes is in release notes here
>
> https://code.jsoftware.com/wiki/System/ReleaseNotes/J901
>
> There are incompatible changes. In particular, the change in } will likely
> to break existing codes.
>
> On Thu, Apr 4, 2019, 10:13 PM Eric Iverson 
> wrote:
>
> > J901 beta is available as a zip install package for
> windows/mac/linux/rpi.
> > Except for rpi (nonavx 32 bit), 901 will be available only as avx 64 bit.
> >
> > Get your zip install package at:
> >  https://code.jsoftware.com/wiki/System/Installation/Zips
> >
> > After your first install of j901 beta you will be able to do all
> subsequent
> > j901 beta updates with pacman.
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] j807 on Samy CB+

2018-10-31 Thread Vijay Lulla
Installing the extra qt packages using the commands listed on
https://code.jsoftware.com/wiki/Guides/Qt_IDE/Install under "Ubuntu/Mint
Linux" should do the trick.

On Wed, Oct 31, 2018 at 5:49 PM bill lam  wrote:

> try install missing Qt library first,
> sudo apt-get install libqt5webkitwidgets
>
> or it may use another package name, or it may still requires some other
> extra qt packages. you google with with keywords like debian
> libQt5WebKitWidgets
>
>
> On Thu, Nov 1, 2018, 4:13 AM greg heil 
> > Bill
> >
> > >You might expect a CB to lack wget -- the OS being made by Google. What
> > is strange is that curl is installed!
> > sudo apt-get install wget
> > worked.
> >
> > ...and the install completed, almost to the end!
> >
> > >However at the end it says that making launch icons for jqt, jc & jhs
> > failed: "no Desktop folder"
> >
> > >Currently i am still trying to find ways to start these executables, eg:
> >
> > ./jqt
> > "/home/emanuensis/j64-807/bin/libjqt"
> > "could not resolve: state_run:
> >
> > Cannot load library /home/emanuensis/j64-807/bin/libjqt:
> > (libQt5WebKitWidgets.so.5: cannot open shared object file: No such
> > file or directory)"
> >
> > ~greg
> > http://krsnadas.org
> >
> > --
> >
> > from: bill lam 
> > reply-to: programm...@jsoftware.com
> > to: Programming forum 
> > date: Oct 31, 2018, 2:46 AM
> > subject: Re: [Jprogramming] j807 on Samy CB+
> >
> >
> > >the problem seems some linux distro do not install wget by default, but
> > base library in particular pacman assumed stock wget is available and try
> > to download files with it. Can you check if curl is available and use it
> > instead of wget, some modifications of scripts will be needed.
> >
> > Alternatively, can you install wget on CB?
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Machine learning library

2018-07-25 Thread Vijay Lulla
I second Joe's sentiment!  This looks real good (well commented code and
lots of references/links to articles/code).  Thanks for sharing.

On Wed, Jul 25, 2018 at 11:59 AM, Joe Bogner  wrote:

> This looks really good and will be a great help to those who want to get a
> better understanding of the algorithms. Thank you for sharing
>
> On Wed, Jul 25, 2018, 10:00 AM 'Jon Hough' via Programming <
> programm...@jsoftware.com> wrote:
>
> > I added my **Work In Progress** machine learning library to github:
> > https://github.com/jonghough/jlearn
> >
> > The library is mostly for didactic purposes, self learning etc. but
> > It may be of use, or of interest, to anyone experimenting with machine
> > learning using J.
> >
> > Bare in mind, I am absolutely not an expert at machine learning, so there
> > could
> > be a lot of egregious errors.
> >
> > I managed to write a convnet which can get very high accuracy with the
> > MNIST dataset, which is a pretty simple "image" library.
> > Trying with CIFAR-10 dataset, I still max out at around 50%-60% accuracy,
> > and am struggling to get any better (struggling to find time to improve,
> > since a single epoch through the 50,000 training images takes a couple of
> > hours+).
> >
> >
> > Thanks,
> > Jon
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Condensing the Kelly fraction

2018-07-12 Thread Vijay Lulla
OOPS!  Should have been

'losses wins'=. (>&0 http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Condensing the Kelly fraction

2018-07-12 Thread Vijay Lulla
Why not just use a simple definition like this?

'wins losses' =. (>&0  wrote:

> Maybe something like this (can be simplified, but I am on a phone, so
> that’s painful):
>
> M=: +/ % #
>
>(M@:>:&0([ - -.@[ % (%|)/@\:~@(M/.~) @])])2 _1
>
> 0.25
>
>
> Thanks,
>
>
> —
>
> Raul
>
> On Thursday, July 12, 2018, Devon McCormick  wrote:
>
> > Working with an article on implementing the Kelly Criterion in Python (
> > http://quantfiction.com/2018/05/06/position-sizing-for-
> > practitioners-part-1-beyond-kelly/
> > ), I first, lazily, translated some Python code like this:
> > kellyFraction=: 3 : 0
> >returns=. y
> >losses=. }.losses [ 'losses wins'=. (0,returns>0)  >R=. ((+/%#) wins) % |(+/%#) losses [ W=. (#wins) % #returns
> >W-(1-W)%R
> > )
> >kellyFraction 2 _1
> > 0.25
> >
> > Reworking the code to be more J-like, I came up with this version:
> > kellyFraction=: 3 : 0
> >'losses wins'=. }.&.>(0 1,y>0)  >((#wins) % #y) ([-] %~ [: -.[) ((+/%#) wins) % |(+/%#) losses
> > )
> >
> > The partitioning of losses and wins seems a bit awkward.  Part of the
> > awkwardness is the prepending I do (0 1,... and 0 0,...) to force the
> > losses and wins to be in the expected order.  However, it also seems that
> > there may be some way to apply the dyadic, tacit expression on the last
> > line using "key" (/.) directly but I don't see how.
> >
> > Am I expecting too much here?
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > ------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Vijay Lulla

Assistant Professor,
Dept. of Geography, IUPUI
425 University Blvd, CA-207C.
Indianapolis, IN-46202
vlu...@iupui.edu
ORCID: https://orcid.org/-0002-0823-2522
Webpage: http://vijaylulla.com
--
For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] How to know that verb might change type?

2018-03-15 Thread Vijay Lulla
​Consider the following from my session:

​   a=: 1r100
   b=: 1r10
   %: a
1r10
   %: b
0.316228
   datatype %: a
rational
   datatype %: b
floating

Is there any way to know in advance if the verb will change the datatype?
Since I am already using rational number shouldn't the verb return rational
number?  I.e., isn't rational datatype especially for exact
representations?  If so, why didn't %: b return a rational type?

Any help, or pointers to relevant documentation, is highly appreciated.
Cordially,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] python

2018-02-18 Thread Vijay Lulla
I am on a mac and I too get a segmentation fault when I run the j.init()
line.  Since it is a mac I had to change the pathdll in j_config.py like

pathdll = pathbin+'/libj.dylib'

Is there any way to check what caused the segmentation fault?

On Sun, Feb 18, 2018 at 3:51 AM, bill lam <bbill@gmail.com> wrote:

> I think for j806 deb installm the j_config.py
> can be something like
>
> # following is typical for j806 debian install
>
> pathbin= '/usr/bin'
> pathdll= 'libj.so.8.06'
> pathpro= '/etc/j/8.06/profile.ijs'
>
>
> Сб, 17 фев 2018, Eric Iverson написал(а):
> > I have just added a python3 folder to the addons api family.
> >
> > The python scripts in the addon make it easy to use J from python3.
> >
> > The popularity of python, combined with easy use of J, might open some
> > doors.
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> regards,
> 
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Vijay Lulla, Ph.D.

Assistant Professor,
Dept. of Geography, IUPUI
425 University Blvd, CA-207C.
Indianapolis, IN-46202
vlu...@iupui.edu

<http://vijaylulla.com>
http://vijaylulla.com
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Boxing sparse arrays?

2017-12-23 Thread Vijay Lulla
Knowing that J/APL developers and users are thorough I should have looked
more carefully!  Thank you, Martin.

On Sat, Dec 23, 2017 at 9:27 AM, Martin Kreuzer <i...@airkreuzer.com> wrote:

> ... and the Dictionary in the Notes section of ($.) says:
> "Sparse literal and boxed arrays not yet implemented. "
> -M
>
> At 2017-12-23 13:35, you wrote:
>
> Hi all,
>> Why can't I box sparse arrays?  I was exploring sparse arrays after it
>> came
>> up on the mailing list and was surprised to get a nonce error when I tried
>> to box a sparse error.  Using the example given on the dictionary entry
>> for
>> $. to demonstrate the issue:
>>
>>] d=: (?. 3 4$2) * ?. 3 4$100
>>  0 56  0  6
>> 85  0  0 96
>>  0  0 33  0
>>] s=: $. d
>> 0 1 │ 56
>> 0 3 │  6
>> 1 0 │ 85
>> 1 3 │ 96
>> 2 2 │ 33
>>s ; d
>> |nonce error
>> |   s;d
>>> |nonce error
>> |   >> ┌───────────┠│ 0 56  0  6│
>> │85  0  0 96│
>> │ 0  0 33  0│
>> └───────────┘
>>
>> I could not find any mention of this nonce error in the dictionary.
>> Please
>> let me know if I have overlooked something obvious.  And I am curious how
>> Roger Stokes managed to box sparse arrays in his LJ book.
>>
>> Thanks,
>> Vijay.
>> ------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Vijay Lulla, Ph.D.

Assistant Professor,
Dept. of Geography, IUPUI
425 University Blvd, CA-207C.
Indianapolis, IN-46202
vlu...@iupui.edu

<http://vijaylulla.com>
http://vijaylulla.com
--
For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Boxing sparse arrays?

2017-12-23 Thread Vijay Lulla
Hi all,
Why can't I box sparse arrays?  I was exploring sparse arrays after it came
up on the mailing list and was surprised to get a nonce error when I tried
to box a sparse error.  Using the example given on the dictionary entry for
$. to demonstrate the issue:

   ] d=: (?. 3 4$2) * ?. 3 4$100
 0 56  0  6
85  0  0 96
 0  0 33  0
   ] s=: $. d
0 1 │ 56
0 3 │  6
1 0 │ 85
1 3 │ 96
2 2 │ 33
   s ; d
|nonce error
|   s;d
   http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Overflow, underflow, floats

2017-09-20 Thread Vijay Lulla
To answer Henry's question based on the behavior of R, which Erling
advocates, and I too love!!

In R, length of vector (what we'd call list in J) with missing values is
still the actual number of elements in a vector.  Missing value *is* still
a value in a list and it gets counted!  However, it makes no sense to take
a mean/stddev/median unless we handle (acknowledge?) missing values so R
will yield missing value (NA) when you take mean/stddev/median with a
vector with missing values.  Check out this behavior from an interactive R
session:

> x <- 1:10
> x
 [1]  1  2  3  4  5  6  7  8  9 10
> x <- c(x,NA)
> x
 [1]  1  2  3  4  5  6  7  8  9 10 NA
> mean(x)
[1] NA
> mean(x, na.rm=TRUE)
[1] 5.5
> length(x)
[1] 11
> sd(x)
[1] NA
> median(x)
[1] NA
>

IMO, this is a good practice (notice I didn't say right) and helps with
dealing with issues in real world.  No other language that I'm aware of
deals with missing values so consistently, and pragmatically, as R.  And
oh, all of this is described quite clearly in the documentation for R.

On Wed, Sep 20, 2017 at 10:51 AM, Erling Hellenäs <erl...@erlinghellenas.se>
wrote:

> Hi all !
>
> Here is part of the standard. Required exception handling. Things I
> discuss in my post. Is it implemented in J? https://en.wikipedia.org/wiki/
> IEEE_754#Exception_handling
> The floating point standard is obviously used in environments where the
> users can not afford random results, so there must be solutions to the
> problems I mention, which we also can see in this wikipedia article.
>
> Cheers,
> Erling
>
>
> Den 2017-09-20 kl. 16:27, skrev Erling Hellenäs:
>
>> I hope others want to read my post even if Raul discards it as not worthy
>> of comments. /Erling
>>
>>
>> Den 2017-09-20 kl. 12:25, skrev Raul Miller:
>>
>>> This isn't just J - this is the IEEE-754 floating point standard.
>>>
>>> It would be really nice if computers could deal with infinities,
>>> instantly, at no cost. Sadly, though, that's not going to happen.
>>>
>>> FYI,
>>>
>>>
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Vijay Lulla, Ph.D.

Assistant Professor,
Dept. of Geography,
Indiana University Purdue University Indianapolis (IUPUI)
425 University Blvd, CA-207C.
Indianapolis, IN-46202
vlu...@iupui.edu

<http://vijaylulla.com>
http://vijaylulla.com
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] How to enclose two columns

2017-08-24 Thread Vijay Lulla
Or:

,.&.><"1 |: B

On Thu, Aug 24, 2017 at 2:59 PM, chris burke  wrote:

> Try:
>
> B=:i.4 2
>
> ;/|:B
>
> <"1|:B
>
> ('';1)<;.1 B
>
> On Thu, Aug 24, 2017 at 11:38 AM, Linda Alvord 
> wrote:
>
> > ]B=:i.4 2
> >
> > 0 1
> >
> > 2 3
> >
> > 4 5
> >
> > 6 7
> >
> >  > ┌───┐
> >
> > │0 1│
> >
> > │2 3│
> >
> > │4 5│
> >
> > │6 7│
> >
> > └───┘
> >
> > <"0 B
> >
> > ┌─┬─┐
> >
> > │0│1│
> >
> > ├─┼─┤
> >
> > │2│3│
> >
> > ├─┼─┤
> >
> > │4│5│
> >
> > ├─┼─┤
> >
> > │6│7│
> >
> > └─┴─┘
> >
> > <"1 B
> >
> > ┌───┬───┬───┬───┐
> >
> > │0 1│2 3│4 5│6 7│
> >
> > └───┴───┴───┴───┘
> >
> > <"2 B
> >
> > ┌───┐
> >
> > │0 1│
> >
> > │2 3│
> >
> > │4 5│
> >
> > │6 7│
> >
> > └───┘
> >
> > I thought it would be easy.  Linda
> >
> >
> >
> > Sent from AOL Mobile Mail
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] "n-volume" of an "n-sphere"

2017-08-15 Thread Vijay Lulla
Maybe
https://www.youtube.com/watch?v=uU_Q2a0S0zI=9=PL2FF649D0C4407B30
especially at 28 minute marker in the video discusses this very issue.  I
recommend the rest of the videos in the list too.
Thanks,
Vijay.

On Tue, Aug 15, 2017 at 4:52 PM, Don Guinn  wrote:

> Just had to try it.
>
>   plot 1 sphvol i:30
>
> Don't know if it even makes any sense, but the plot is curious.
>
> On Tue, Aug 15, 2017 at 2:27 PM, Jimmy Gauvin 
> wrote:
>
> > Funny how the n-Sphere volume dwindles for the higher dimensions.
> > Not quite intuitive but the factorial always "win" even with bigger
> radii.
> >
> > The hypercubes do not share this characteristic (V= edge ^ n)
> >
> >
> >
> > On Tue, Aug 15, 2017 at 3:33 PM, Ben Gorte - CITG <
> b.g.h.go...@tudelft.nl>
> > wrote:
> >
> > > A little surprise (to me) was
> > >plot 1 sphvol i.30
> > > (for example)
> > >
> > > Can you predict it?
> > >
> > > greetings,
> > > Ben
> > > 
> > > From: Programming [programming-boun...@forums.jsoftware.com] on behalf
> > of
> > > Raul Miller [rauldmil...@gmail.com]
> > > Sent: Tuesday, August 15, 2017 19:55
> > > To: Programming forum
> > > Subject: [Jprogramming] "n-volume" of an "n-sphere"
> > >
> > >sphvol=: (1p1&^%!)@-:@] * ^
> > >1 sphvol 3
> > > 4.18879
> > >1 sphvol i.7
> > > 1 2 3.14159 4.18879 4.9348 5.26379 5.16771
> > >
> > > Left argument is the radius of the "n-sphere".
> > >
> > > Right argument is the number of dimensions.
> > >
> > > I put "n-volume" in quotes, because if the dimension is 2 (for
> > > example), the "n-volume" is what we call the area of the circle. (And
> > > if the dimension is 1 that "n-volume" is the length of a line
> > > segment).
> > >
> > > Anyways, I stumbled across this and thought it might be interesting
> > > for someone else.
> > >
> > > Thanks,
> > >
> > > --
> > > Raul
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Integer-floating type change for large numbers in j805 and j806

2017-08-09 Thread Vijay Lulla
Though not quite the same issue but is this related to the behavior listed
at http://geocar.sdf1.org/numbers.html ?

On Wed, Aug 9, 2017 at 2:17 PM, robert therriault 
wrote:

> I was more surprised by the type change within a certain numeric range.
>
> That just seemed a little...odd.
>
> I guess that even though it feels strange to have a constant change type
> just by being
> entered, it's not really any different than these examples.
>
> (; datatype) 3j0
> ┌─┬───┐
> │3│integer│
> └─┴───┘
>(; datatype) 3.0
> ┌─┬───┐
> │3│integer│
> └─┴───┘
>(; datatype) 3.6j0
> ┌───┬┐
> │3.6│floating│
> └───┴┘
>(; datatype) 3r5j0
> ┌───┬┐
> │0.6│floating│
> └───┴┘
>
> Cheers, bob
>
> > On Aug 9, 2017, at 10:33 AM, Raul Miller  wrote:
> >
> > It's not a bug, it's an artifact of the 64 bit floating point standard.
> >
> >   2 ^.
> > 53.1508
> >
> > https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats
> >
> > The binary64 format has 53 binary digits or 15.95 decimal digits. This
> > means ".16#'9' cannot be represented exactly using this format.
> >
> > And, we do not use exact representation of large numbers by default
> > because that's too slow for large datasets. Put differently, if you
> > want exact representation and are willing to take the performance hit,
> > you should specify that. For example: ".'x',~16#'9' or
> > ".'3r10+','x',~16#'9'
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Wed, Aug 9, 2017 at 12:05 PM, Henry Rich 
> wrote:
> >> This is a bug,  since 999...9.3 should become 999...9 rather than
> 100...0.
> >> I'm away from home now,  but I think what's happening is this:
> >>
> >> 999...9 is converted to integer
> >>
> >> . is encountered and turns it to float
> >>
> >> It's rounded to the nearest float which is 100...0
> >>
> >> As a final step the JE checks to see if the value is exactly integral,
> >> which it is,  and it is converted back to integer.
> >>
> >> If you add this to Interpreter/Bugs I'll fix it when i get back.
> >>
> >> Henry Rich
> >>
> >> On Aug 9, 2017 16:16, "bill lam"  wrote:
> >>
> >> I think this is the difference between 32 and 64-bit,
> >>
> >>   9!:14''
> >> j602/2008-03-03/16:45
> >>   3!:0[ .3
> >> 4
> >>
> >> In J32
> >>
> >>   a.i. 2 fc .3
> >> 0 128 224 55 121 195 65 67
> >>   a.i. 2 fc 1e16
> >> 0 128 224 55 121 195 65 67
> >>
> >> the number has the same bit pattern as 1e16 (an integer)
> >> which can be represented as a 64-bit integer. I guess
> >> J64 is correct since .3 and 1e16 is the
> >> same number in ieee fp and J prefers integer to floats,
> >> eg
> >>  3!:0 [ 2.0
> >> 4
> >>
> >> Ср, 09 авг 2017, robert therriault написал(а):
> >>> Hi Pascal,
> >>>
> >>> I see the same behaviour in j806 as j805. Do you see something
> different?
> >>>
> >>>JVERSION
> >>> Engine: j806/j64avx/darwin
> >>> Beta-4: commercial/2017-06-27T12:55:06
> >>> Library: 8.06.03
> >>> Qt IDE: 1.5.3/5.6.2
> >>> Platform: Darwin 64
> >>> Installer: J806 install
> >>> InstallPath: /users/bobtherriault/j64-806
> >>> Contact: www.jsoftware.com
> >>>   (; datatype) 999.3
> >>> ┌┬┐
> >>> │1e15│floating│
> >>> └┴┘
> >>>   (; datatype) .3
> >>> ┌─┬───┐
> >>> │1│integer│
> >>> └─┴───┘
> >>>   (; datatype) 9.3
> >>> ┌──┬───┐
> >>> │10│integer│
> >>> └──┴───┘
> >>>   (; datatype) 99.3
> >>> ┌───┬───┐
> >>> │100│integer│
> >>> └───┴───┘
> >>>   (; datatype) 999.3
> >>> ┌┬┐
> >>> │1e19│floating│
> >>> └┴┘
> >>>
> >>> Cheers, bob
> >>>
>  On Aug 9, 2017, at 7:54 AM, 'Pascal Jasmin' via Programming <
> >> programm...@jsoftware.com> wrote:
> 
>  in j806,.31 probably the j805
> >> behaviour is preferred.  If only for consistency.  But there may be a
> good
> >> reason for change.
> 
>  From: robert therriault 
>  To: Programming forum 
>  Sent: Wednesday, August 9, 2017 10:40 AM
>  Subject: [Jprogramming] Integer-floating type change for large numbers
> >> in j805 and j806
> 
>  I am guessing that the following has something to do with precision of
> >> large numbers in j805 and is also true for j806.
> 
>   (; datatype) 999.3
>  ┌┬┐
>  │1e15│floating│
>  └┴┘
>   (; datatype) .3
>  ┌─┬───┐
>  │1│integer│
>  └─┴───┘
>   (; datatype) 9.3
>  ┌──┬───┐
>  

Re: [Jprogramming] Gustafson's Unums Revisited

2016-08-16 Thread Vijay Lulla
I also had similar problems.  I think you'll also have to do

load 'general/misc/fndef'

to get definitions that are used in the lab.  I load this before I do the
lab_jlab_ 'unums.ijt' listed in the readme file.

HTH,
Vijay.

On Tue, Aug 16, 2016 at 6:35 PM, Skip Cave <s...@caveconsulting.com> wrote:

> Vijay,
>
> 'C:/Users/Skip/j64-804/projects/unum'  worked, except it was really:
>
> 'C:/Users/Skip/j64-804-*user*/projects/unum'
>
> Now I was able to get all the way down to lesson 6, when I got this error:
>
>  ] smallpos =: SFJN 0.5
>
> |value error: first
>
> | a=.y>: (first@:>)"0 UNUMS
>
>
> So it looks like "first" hasn't been defined.
>
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
>
> On Tue, Aug 16, 2016 at 4:26 PM, Vijay Lulla <vijaylu...@gmail.com> wrote:
>
> > Also it is 1!:44 not 1:!44 .  I think 1!:44
> > 'C:/Users/Skip/j64-804/projects/unum'
> > should do the trick.
> >
> > On Tue, Aug 16, 2016 at 5:23 PM, Skip Cave <s...@caveconsulting.com>
> > wrote:
> >
> > > Well, I got a bit further in the unum lab, but it looks like I still
> need
> > > to set the directory.
> > >
> > > After a couple of steps in the unum lab I get:
> > >
> > > load 'utils.ijs' NB. utility functions
> > >
> > > not found: C:/Users/Skip/j64-804/utils.ijs
> > >
> > > |file name error: script
> > >
> > > | 0!:0 y[4!:55<'y'
> > >
> > >
> > > So I still need to point the lab to where all the unum files are, which
> > is
> > >
> > >
> > > C:/Users/Skip/j64-804/projects/unum   (where the utils.ijs file is
> > > located)
> > >
> > >
> > > So I tried:
> > >
> > >
> > >   1:!44 '~projects\unum'
> > >
> > > |syntax error
> > >
> > > | 1:!44'~projects\unum'
> > >
> > > Still no luck.
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > >
> > > On Tue, Aug 16, 2016 at 4:06 PM, Raul Miller <rauldmil...@gmail.com>
> > > wrote:
> > >
> > > > cd is defined as part of the base system.
> > > >
> > > > http://www.jsoftware.com/help/user/call_procedure.htm
> > > >
> > > > chdir would be 1!:44 if it were defined.
> > > >
> > > > http://www.jsoftware.com/help/dictionary/dx001.htm
> > > >
> > > > I hope this helps,
> > > >
> > > > --
> > > > Raul
> > > >
> > > >
> > > > On Tue, Aug 16, 2016 at 4:40 PM, Skip Cave <s...@caveconsulting.com>
> > > > wrote:
> > > > > Robert,
> > > > >
> > > > > Starting the labs, navigating to my unum directory, and then
> running
> > > lab
> > > > > _jlab_ 'unums.ijt' worked! Now I'm able to run Roger's unum lab
> code.
> > > > > Thanks for the help.
> > > > >
> > > > > It looks like in my JQT, the verb "cd" is set to the foreign 15!:0,
> > > which
> > > > > is a DLL call. I have no idea what this is so. There doesn't appear
> > to
> > > be
> > > > > any defined verb name for "Change Directory"
> > > > >
> > > > > While trying to get started, I searched all over the J software
> site
> > > for
> > > > > "change directory", "cd" and "directory" and couldn't find
> anything.
> > I
> > > > > didn't think to look under the "files" foreign conjunction. The
> > search
> > > > term
> > > > > that would be required was "Set Working Directory" (1!:44) which
> > would
> > > > have
> > > > > gotten me there.
> > > > >
> > > > > However, the actual string needed to define the new directory is
> not
> > > > > immediately obvious. So the "run labs & navigate to the file"
> method
> > is
> > > > the
> > > > > easiest approach, at least for me.
> > > > >
> > > > > Skip
> > > > >
> > > > >
> > > > > Skip Cave
> > > > > Cave Consulting LLC
> > > > >
> > > > > On Tue, Aug 16, 2016 at 3:07 PM, robert therriault <
> > > > bobtherria...@mac.com>
> > > > > wrote:
> > > > >
>

Re: [Jprogramming] Gustafson's Unums Revisited

2016-08-16 Thread Vijay Lulla
Also it is 1!:44 not 1:!44 .  I think 1!:44
'C:/Users/Skip/j64-804/projects/unum'
should do the trick.

On Tue, Aug 16, 2016 at 5:23 PM, Skip Cave <s...@caveconsulting.com> wrote:

> Well, I got a bit further in the unum lab, but it looks like I still need
> to set the directory.
>
> After a couple of steps in the unum lab I get:
>
> load 'utils.ijs' NB. utility functions
>
> not found: C:/Users/Skip/j64-804/utils.ijs
>
> |file name error: script
>
> | 0!:0 y[4!:55<'y'
>
>
> So I still need to point the lab to where all the unum files are, which is
>
>
> C:/Users/Skip/j64-804/projects/unum   (where the utils.ijs file is
> located)
>
>
> So I tried:
>
>
>   1:!44 '~projects\unum'
>
> |syntax error
>
> | 1:!44'~projects\unum'
>
> Still no luck.
>
> Skip Cave
> Cave Consulting LLC
>
> On Tue, Aug 16, 2016 at 4:06 PM, Raul Miller <rauldmil...@gmail.com>
> wrote:
>
> > cd is defined as part of the base system.
> >
> > http://www.jsoftware.com/help/user/call_procedure.htm
> >
> > chdir would be 1!:44 if it were defined.
> >
> > http://www.jsoftware.com/help/dictionary/dx001.htm
> >
> > I hope this helps,
> >
> > --
> > Raul
> >
> >
> > On Tue, Aug 16, 2016 at 4:40 PM, Skip Cave <s...@caveconsulting.com>
> > wrote:
> > > Robert,
> > >
> > > Starting the labs, navigating to my unum directory, and then running
> lab
> > > _jlab_ 'unums.ijt' worked! Now I'm able to run Roger's unum lab code.
> > > Thanks for the help.
> > >
> > > It looks like in my JQT, the verb "cd" is set to the foreign 15!:0,
> which
> > > is a DLL call. I have no idea what this is so. There doesn't appear to
> be
> > > any defined verb name for "Change Directory"
> > >
> > > While trying to get started, I searched all over the J software site
> for
> > > "change directory", "cd" and "directory" and couldn't find anything. I
> > > didn't think to look under the "files" foreign conjunction. The search
> > term
> > > that would be required was "Set Working Directory" (1!:44) which would
> > have
> > > gotten me there.
> > >
> > > However, the actual string needed to define the new directory is not
> > > immediately obvious. So the "run labs & navigate to the file" method is
> > the
> > > easiest approach, at least for me.
> > >
> > > Skip
> > >
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > >
> > > On Tue, Aug 16, 2016 at 3:07 PM, robert therriault <
> > bobtherria...@mac.com>
> > > wrote:
> > >
> > >> Or you can open the Lab dialogue in jqt with Help|Studio|Labs... and
> > then
> > >> use the Browse button in the upper right to go to the unums.ijt file
> in
> > the
> > >> unumslab folder. At least that works in the Mac system for jqt.
> > >>
> > >> Cheers, bob
> > >>
> > >> > On Aug 16, 2016, at 12:58 PM, Vijay Lulla <vijaylu...@gmail.com>
> > wrote:
> > >> >
> > >> > You can try
> > >> >
> > >> >   1!:44 '~projects\unum'
> > >> >
> > >> > instead of cd in your JQT session.
> > >> >
> > >> > On Tue, Aug 16, 2016 at 3:33 PM, Skip Cave <s...@caveconsulting.com
> >
> > >> wrote:
> > >> >
> > >> >> 1. Downloaded www.learningj.com/unumslab.zip
> > >> >> 1a. Unzipped file to: C:\Users\Skip\j64-804-user\projects\unum
> > >> >> 2. Checked to make sure J labs was installed (and up to date)
> > >> >> 3. Started a JQT session
> > >> >> 4. typed cd 'projects\unum'  in JQT session:
> > >> >>
> > >> >>cd 'projects\unum'
> > >> >>
> > >> >> |domain error: cd
> > >> >>
> > >> >> | cd
> > >> >> '
> > >> >> projects\unum'
> > >> >>
> > >> >>
> > >> >> cd
> > >> >>
> > >> >> 15!:0
> > >> >> What's wrong?
> > >> >>
> > >> >> Windows 10, 64bit i7, Dell Inspiron 7348 2-in-1 Laptop
> > >> >>
> > >> >> Skip Cave
> > >> >> Cave Consulting LLC
> > >> >

Re: [Jprogramming] Gustafson's Unums Revisited

2016-08-16 Thread Vijay Lulla
You can try

   1!:44 '~projects\unum'

instead of cd in your JQT session.

On Tue, Aug 16, 2016 at 3:33 PM, Skip Cave  wrote:

> 1. Downloaded www.learningj.com/unumslab.zip
> 1a. Unzipped file to: C:\Users\Skip\j64-804-user\projects\unum
> 2. Checked to make sure J labs was installed (and up to date)
> 3. Started a JQT session
> 4. typed cd 'projects\unum'  in JQT session:
>
> cd 'projects\unum'
>
> |domain error: cd
>
> | cd
> ​'
> projects\unum'
>
> ​​
> cd
>
> 15!:0
> What's wrong?
>
> Windows 10, 64bit i7, Dell Inspiron 7348 2-in-1 Laptop
>
> Skip Cave
> Cave Consulting LLC
>
> On Tue, Aug 16, 2016 at 5:13 AM, roger stokes 
> wrote:
>
> > Dear All,
> >
> > I've heard it said that you don't understand a subject
> > unless you can explain it to a computer. With that in mind
> > I've attempted a software implementation of Gustafson's Unums 2.0
> >
> >  ( http://www.johngustafson.net/presentations/Unums2.0.pdf ).
> >
> > If anyone is interested, there is a demo available in the
> > form of a J lab. To run the lab
> >
> >Download www.learningj.com/unumslab.zip
> >
> >Unzip into any convenient directory
> >
> >Follow directions in the readme file
> >
> > Comments and criticisms appreciated.
> >
> > Regards
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Braces Considered Loopy +NYCJUG

2016-03-01 Thread Vijay Lulla
Devon,
The link on the CACM page is broken.  code.jsoftware.com not
code.jsoft-ware.com.  Regardless, good argument for array languages.
Thanks,
Vijay.

On Tue, Mar 1, 2016 at 8:20 AM, Devon McCormick  wrote:
> Hi Everybody -
>
> I've just had my letter about array-processing languages published in the
> Communications of the ACM -
> http://cacm.acm.org/magazines/2016/3/198861-acm-moral-imperatives-vs-lethal-autonomous-weapons/fulltext
> - in which I provide a link to a Jsoftware page.
>
> BTW - the NYCJUG meeting takes place in one week - basement of the Empire
> State Building at 6:30 pm, as usual.
>
> Regards,
>
> Devon
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Comparing J speed

2015-09-02 Thread Vijay Lulla
In Julia (from my console):

julia> fib(n) = ([big(1) 1; 1 0]^n)[1,2]
fib (generic function with 1 method)

julia> @time x=fib(475000);
elapsed time: 1.389054075 seconds (120836244 bytes allocated, 2.44% gc time)

julia>

Julia implements BigInt using GMP so it is really fast.  It trades
space for speed!  I agree about using GMP/MPFR in J for extended
integers.  I have little experience to help out with such an effort
but not enough to undertake to implement much of it.

On Wed, Sep 2, 2015 at 10:56 AM, Mike Day  wrote:
> Yes,  the Jwiki verb f7 using a binary power method is fast
> and quite compact.  (My own version, twice as slow as f7 for
> some reason,  has two current 2x2 matrices,  so presumably
> needs to store 8 extended integers at a time;  the final
> number is about 2^33 (!),  so even 8 such integers will
> use a fair amount of space.  Space for my version for 475000
> is about 5MB,  while it's about 5.6MB for f7 .)
>
> The Haskell implementation must be really tight,  though.
> Rademacher talks about lazy evaluation,  but his function
> _appears_ to employ a list of all prior Fibonacci numbers
> to produce the required element.  I suppose the zip and
> tail functions somehow know to discard the prior elements.
> He showed how an interpreted (I think) Haskell  fib function
> was memoized in a certain case,  which I forget;  even then
> it was impressively fast and not excessive in memory
> consumption.
>
> Now/how to program the binary power method in Haskell?!
>
> I keep having problems with space and time using extended
> integers,  so implementing the GMP method/s would be
> interesting,  but I don't have the skills for doing it!
>
> Thanks,
>
> Mike
>
>
> On 02/09/2015 14:03, David Lambert wrote:
>>
>> Essays
>> http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence
>>
>> Fibonacci numbers by matrix product:
>>
>>A=:2 2$1 1 1 2
>>mp=:+/ .*
>>mp~A
>> 2 3
>> 3 5
>>   mp~^:4 x:A
>> 1346269 2178309
>> 2178309 3524578
>>
>> Then multiply specific matrices to find a particular Fibonacci number.
>> From Wolfram Alpha the entry for 1346269 says
>>
>> 1346269 is the 31st Fibonacci number (F_31).
>>
>> 1346269 is the hypotenuse of 2 primitive Pythagorean triples:
>> 1346269^2 = 184981^2+1333500^2 = 602069^2+1204140^2
>>
>>
>>> Date: Wed, 2 Sep 2015 01:32:45 +0100
>>> From: Jon Hough
>>> To:"programm...@jsoftware.com" 
>>> Subject: [Jprogramming] Comparing J speed
>>> Message-ID:
>>> Content-Type: text/plain; charset="iso-8859-1"
>>>
>>> In this talkhttps://www.youtube.com/watch?v=apBWkBDVlow
>>> the presenter attempts to show Haskell hasn't sacrificed speed for
>>> expressiveness by comparing a Java Fibonacci calculator to his Haskell
>>> one.(skip to the 18:00 mark).Essentially, to calculate the 475000th
>>> Fibonacci number, it took his Java program ~8 seconds, while the very terse
>>> Haskell program took ~6 seconds.
>>> So I tried to do the same in J. My first attempt, used a tacit, memoized
>>> verb
>>> fib1 =:1:`(($:@:<:) + ($:@:-&2))@.(2&<)M.
>>
>>
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J By Point and Click fixed for Mac (I hope!)

2015-07-22 Thread Vijay Lulla
I tried both the install 'qtide' and install 'all' from jconsole but I
still get the same errors.  Also, there is nothing listed (I assume
everything is up-to-date) in the upgrades portion of JQT's windowed
package manager either!

Below is the result from _16]\ a. i. JVERSION

 69 110 103 105 110 101  58  32 106  56  48  51  47  50  48  49
 52  45  49  48  45  49  57  45  49  49  58  49  49  58  49  49
 10  76 105  98 114  97 114 121  58  32  56  46  48  52  46  48
 54  10  81 116  32  73  68  69  58  32  49  46  52  46  51  47
 53  46  52  46  50  10  80 108  97 116 102 111 114 109  58  32
 68  97 114 119 105 110  32  54  52  10  73 110 115 116  97 108
108 101 114  58  32  74  56  48  52  32 105 110 115 116  97 108
108  10  73 110 115 116  97 108 108  80  97 116 104  58  32  47
117 115 101 114 115  47 118 105 106  97 121  47  99 111 100 101
 47  97 112 108  47 106  54  52  45  56  48  52   0   0   0   0


On Wed, Jul 22, 2015 at 8:28 PM, Henry Rich henryhr...@nc.rr.com wrote:
 It checks the Qt IDE version to see if it's at least 1.4.3.

 The 's' in your 'Qt IDE:' would cause the problem.  I wasn't expecting that.

 I see that it is created when there is no Webkit and no Webengine, so I
 suppose it stands for 'slim'.

 I have just checked a new version - see if that fixes things.

 Henry Rich

 On 7/22/2015 8:14 PM, bill lam wrote:

 How did it detect Qt system was out of date?  It should already up to
 date.

  Warning *
 Your Qt system is out of date.  To refresh it, follow the instructions at
 http://www.jsoftware.com/jwiki/Guides/Qt%20IDE/Install#Upgrade.  Don't
 forget to
 update ide\qt!

 To run this lab, first install: graphics/graph

 JVERSION
 Engine: j803/2014-10-19-11:11:11
 Library: 8.04.06
 Qt IDE: 1.4.3s/5.5.0
 Platform: Android 32
 Installer: unknown
 InstallPath:
 /storage/emulated/legacy/Android/data/com.jsoftware.android.qtide/files
 On Jul 22, 2015 5:27 PM, Henry Rich henryhr...@nc.rr.com wrote:

 I don't have a Mac for testing, so there may be issues to work out.

 Please report the results of

 _16 ]\ a. i. JVERSION

 Henry Rich

 On 7/22/2015 12:42 AM, Vijay Lulla wrote:

 I tried J by Point  Click I after reading John Baker's comments and
 it worked perfectly on my Windows 7 machine.  And, this lab is really
 very good!  However, I run into the following on my mac

 * Warning *
 Your base library is out of date.  Before running this lab, go to
 Package Manager and
 update the base library.

  JVERSION
  Engine: j803/2014-10-19-11:11:11
  Library: 8.04.06
  Qt IDE: 1.4.3/5.4.2
  Platform: Darwin 64
  Installer: J804 install
  InstallPath: /users/v/code/apl/j64-804

 Continuing the lab gives strange errors.  For e.g.:

 error processing script - no ) found
  findshortestname 'Jeb';'Hillary';'George';'Bill'
  |value error: findshortestname
  |   findshortestname'Jeb';'Hillary';'George';'Bill'
  |[-0]


 I thought that this might be caused by an older version of J so I
 downloaded a new version of j804_mac64.zip (last modified 20-Jul-2015)
 from Jsoftware's download site and I still keep getting the same
 warning and errors.

 What am I missing?

 On Sun, Jul 12, 2015 at 9:11 PM, Linda Alvord lindaalv...@verizon.net
 wrote:

 Sorry. Here's the code:

 load'viewmat'
 require 'debug/dissect'
 'BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE'=:#:i.8

 msc=: 3 : 0
 :
 N=:x
 'A B C D' =: y
 L=: (,:~-.)@:(%~ i.@:) N
 AB =: L +/@:(*/1) A,:B
 CD =: L +/@:(*/1) D,:C
 1 0 2 |: .255 * L +/@:(*/1) AB,:CD
 dissect '1 0 2 |: .255 * L +/@:(*/1) AB,:CD'
 )
 mycube=: 3 : 0
 :
 N=:2.:x
 'A B C D H G F E' =: y
 BLANK =:  BLACK;BLACK;BLACK;BLACK
 FRONT =:  A;B;C;D
 BACK =:  H;G;F;E
 TOP =:  E;F;B;A
 LEFT =:  H;E;A;D
 RIGHT =:  F;G;C;B
 BASE =:  D;C;G;H
 plan =: BASE(3 1)}FRONT(2 1)}(LEFT,TOP,RIGHT)1}BACK(0 1)}4 3$BLANK
 colours =: ,/,/,_1./1 N msc. plan


 colours viewmat i.($plan)*N+1
 )
 5 mycube BLACK,BLUE,CYAN,GREEN,YELLOW,WHITE,MAGENTA,:RED


 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda
 Alvord
 Sent: Sunday, July 12, 2015 9:03 PM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] J By Point and Click fixed for Mac (I
 hope!)

 Next I was trying to understand the method Raul and Mike's color
 pattern.

 I put dissect on a line the program uses repeatedly.

 You'll see lots of screens and if you wait afew seconds, they fill in.
 I
 was
 impressed that it would work.

 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Henry
 Rich
 Sent: Saturday, July 11, 2015 9:58 PM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] J By Point and Click fixed for Mac (I
 hope!)

 Linda,

  The Sizes menu lets you set the maximum width and height of the
 nouns.
 This may make the display smaller.


  You get 2 images

Re: [Jprogramming] J By Point and Click fixed for Mac (I hope!)

2015-07-21 Thread Vijay Lulla
I tried J by Point  Click I after reading John Baker's comments and
it worked perfectly on my Windows 7 machine.  And, this lab is really
very good!  However, I run into the following on my mac

* Warning *
Your base library is out of date.  Before running this lab, go to
Package Manager and
update the base library.

   JVERSION
   Engine: j803/2014-10-19-11:11:11
   Library: 8.04.06
   Qt IDE: 1.4.3/5.4.2
   Platform: Darwin 64
   Installer: J804 install
   InstallPath: /users/v/code/apl/j64-804

Continuing the lab gives strange errors.  For e.g.:

error processing script - no ) found
   findshortestname 'Jeb';'Hillary';'George';'Bill'
   |value error: findshortestname
   |   findshortestname'Jeb';'Hillary';'George';'Bill'
   |[-0]


I thought that this might be caused by an older version of J so I
downloaded a new version of j804_mac64.zip (last modified 20-Jul-2015)
from Jsoftware's download site and I still keep getting the same
warning and errors.

What am I missing?

On Sun, Jul 12, 2015 at 9:11 PM, Linda Alvord lindaalv...@verizon.net wrote:
 Sorry. Here's the code:

 load'viewmat'
 require 'debug/dissect'
 'BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE'=:#:i.8

 msc=: 3 : 0
 :
 N=:x
 'A B C D' =: y
 L=: (,:~-.)@:(%~ i.@:) N
 AB =: L +/@:(*/1) A,:B
 CD =: L +/@:(*/1) D,:C
 1 0 2 |: .255 * L +/@:(*/1) AB,:CD
 dissect '1 0 2 |: .255 * L +/@:(*/1) AB,:CD'
 )
 mycube=: 3 : 0
 :
 N=:2.:x
 'A B C D H G F E' =: y
 BLANK =:  BLACK;BLACK;BLACK;BLACK
 FRONT =:  A;B;C;D
 BACK =:  H;G;F;E
 TOP =:  E;F;B;A
 LEFT =:  H;E;A;D
 RIGHT =:  F;G;C;B
 BASE =:  D;C;G;H
 plan =: BASE(3 1)}FRONT(2 1)}(LEFT,TOP,RIGHT)1}BACK(0 1)}4 3$BLANK
 colours =: ,/,/,_1./1 N msc. plan


 colours viewmat i.($plan)*N+1
 )
 5 mycube BLACK,BLUE,CYAN,GREEN,YELLOW,WHITE,MAGENTA,:RED


 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
 Sent: Sunday, July 12, 2015 9:03 PM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] J By Point and Click fixed for Mac (I hope!)

 Next I was trying to understand the method Raul and Mike's color pattern.

 I put dissect on a line the program uses repeatedly.

 You'll see lots of screens and if you wait afew seconds, they fill in. I was
 impressed that it would work.

 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Henry Rich
 Sent: Saturday, July 11, 2015 9:58 PM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] J By Point and Click fixed for Mac (I hope!)

 Linda,

The Sizes menu lets you set the maximum width and height of the nouns.
 This may make the display smaller.


You get 2 images because by default dissect executes the sentence
 twice: once as is, the second in the instrumented form that dissect uses for
 analysis.  dissect makes sure the two results agree, to make sure you're not
 looking at an invalid interpretation.

You can turn off the 'as is' execution by giving an x argument of

 (0 ; 'check';'no')

 as in

 (0 ; 'check';'no') dissect 'ALL viewmat WOW3;''Color Cube'''

 Henry Rich

 On 7/11/2015 8:24 PM, Linda Alvord wrote:
 Henry, This works fine using dissect.  Two things to note.  First the
 window
 that creates the tables is big and hides the viewmat image.  Also two
 png images appear instead of one.

 Dissect is quite amazing.

 load 'viewmat'
 require 'debug/dissect'
 A=:#:i.8
 N=:.63.75*i.5
 B=:((4#0),N),.N,4#255
 BIGBOX=:2(|.2)1 0 2{1(|:2)8 3 9$,|:(,A){1 B 'BLACK BLUE RED
 MAGENTA GREEN CYAN YELLOW WHITE'=:BIGBOX
 LYELLOW=:(i.5){2 YELLOW
 LCYAN=:(i.5){2  CYAN
 LMAGENTA=:(i.5){2 MAGENTA
 GREEN=:(4+i.5){2 GREEN
 RED=:(4+i.5){2 RED
 BLUE=:(4+i.5){2 BLUE
 BACK=:25 3$,LMAGENTA.1/LYELLOW
 TOP=:25 3$,LCYAN.1/LYELLOW
 LEFT=:25 3$,LMAGENTA.1/LCYAN
 FRONT=:25 3$,GREEN+1/BLUE
 RIGHT=:25 3$,GREEN+1/RED
 BASE=:25 3$,RED+1/BLUE
 F=:i.5 5
 T=:149,4 5$0
 L=:|:T
 R=:|:|.T
 WOW1=:(R,.(|.F),.L),((|:|.25+F),.(50+F),.|.T)
 WOW2=:WOW1,(T,.(75+F),.|:|.|:100+F)
 WOW3=:WOW2,(R,.(|.125+F),.L),2,5(#0) 0 150 0
 ALL=:BACK,LEFT,TOP,FRONT,RIGHT,BASE(,2)0 0 0 dissect 'ALL viewmat
 WOW3;''Color Cube'''

 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Henry
 Rich
 Sent: Saturday, July 11, 2015 1:52 PM
 To: Programming forum; General forum
 Subject: [Jprogramming] J By Point and Click fixed for Mac (I hope!)

 J By Point and Click is ready for Mac users to try.  Make sure you
 read
 the
 instructions under What You Need at

 http://www.jsoftware.com/jwiki/JbyPointAndClick

 You need to update qtide, get the new labs and new dissect, and also
 update
 the ide/qt addon.

 This dissect version also fixes the parsing bug Raul reported last
 week,
 and
 moves the tooltips as Devon requested.

 Henry Rich
 

Re: [Jprogramming] Substring sequences of a string

2015-07-21 Thread Vijay Lulla
Out of curiosity, I'm getting different value for the example listed
under 128!:3.  Shouldn't it be the same as listed on the page?

Below is from my J session

   f '123456789'
_873187034
   f 'assiduously avoid any and all asinine alliterations'  NB.
Different from the listed example
_2855392203
   JVERSION
Engine: j803/2014-10-19-11:11:11
Library: 8.04.06
Qt IDE: 1.4.3/5.4.2
Platform: Win 64
Installer: J804 install
InstallPath: h:/utilities/j64-804


On Tue, Jul 21, 2015 at 11:48 AM, Raul Miller rauldmil...@gmail.com wrote:
 You can't have an inverse crc, because crc is a lossy transformation.
 You are basically relying on statistics to avoid collisions (different
 strings with the same crc).

 So actual use would look something like:

 step one: get the distinct crcs which are in use.

 step two: go over the data again and for each string find its crc, and
 check that some other relevant string isn't producing the same crc.
 (If there are, you'll need further work to untangle them.)

 --
 Raul

 On Tue, Jul 21, 2015 at 10:34 AM, Mike Day mike_liz@tiscali.co.uk wrote:
 That's neat,  but it's a bit messy retrieving the actual
 substrings rather than their encoded forms.

 This does it,
10(]{~i.@[+/~((I.@:(1#/.~))@:( (128!:3)\ ]))) s

 AC

 CA


 but it would be much better with an inverse CRC;
 however that doesn't seem to be supported in J.


 Is there a maximum window size for this approach?

 Thanks,

 Mike


 On 21/07/2015 14:37, Henry Rich wrote:

 For longer subsequences consider using

 (10 (128!:3)\ ])

 to reduce the size of the intermediate array.

 Henry Rich

 On 7/21/2015 12:49 AM, Vijay Lulla wrote:

 Using slightly less space

 (~. #~ 1  #/.~)@(10 ]\ ]) s

 On Mon, Jul 20, 2015 at 11:59 PM, Tikkanz tikk...@gmail.com wrote:

 (i.~ ~: i:~) will find duplicates so how about:

  ~.@(#~ i.~ ~: i:~)@(10 ]\ ]) s

 AC

 CA



 On Tue, Jul 21, 2015 at 3:51 PM, Jon Hough jgho...@outlook.com wrote:

 This is a problem from leetcode.com (similar to Project Euler)
 https://leetcode.com/problems/repeated-dna-sequences/
 The problem is to find all 10 letter repeated subsequences from a DNA
 string (made of C,G,A,T characters).
 My solution:
 func =: (I.@:(1)@:@:(1{)@:(~. ,: 0@:(#/.~)) {
 ])@:(1@:(10(]\)))
 e.g. s =: 'ACACCAGGGTTT' NB. see the link for this
 definition
 func s
 ┌──┬──┐

 │AC│CA│

 └──┴──┘



 It is not very pretty. Can anyone improve on it?



 ---
 This email has been checked for viruses by Avast antivirus software.
 https://www.avast.com/antivirus


 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Substring sequences of a string

2015-07-21 Thread Vijay Lulla
Thanks for the explanation!

On Tue, Jul 21, 2015 at 4:13 PM, Henry Rich henryhr...@nc.rr.com wrote:
._2855392203 + 2^32
 1439575093

 The upper bits of the CRC-32 should be discarded:

 4bminus1 =. (26 b.) 32 (33 b.) _32 (33 b.) _1
fourbminus1 (17 b.) f 'assiduously avoid any and all asinine
 alliterations'
 1439575093

 Henry Rich

 On 7/21/2015 3:06 PM, Vijay Lulla wrote:

 Out of curiosity, I'm getting different value for the example listed
 under 128!:3.  Shouldn't it be the same as listed on the page?

 Below is from my J session

 f '123456789'
 _873187034
 f 'assiduously avoid any and all asinine alliterations'  NB.
 Different from the listed example
 _2855392203
 JVERSION
 Engine: j803/2014-10-19-11:11:11
 Library: 8.04.06
 Qt IDE: 1.4.3/5.4.2
 Platform: Win 64
 Installer: J804 install
 InstallPath: h:/utilities/j64-804


 On Tue, Jul 21, 2015 at 11:48 AM, Raul Miller rauldmil...@gmail.com
 wrote:

 You can't have an inverse crc, because crc is a lossy transformation.
 You are basically relying on statistics to avoid collisions (different
 strings with the same crc).

 So actual use would look something like:

 step one: get the distinct crcs which are in use.

 step two: go over the data again and for each string find its crc, and
 check that some other relevant string isn't producing the same crc.
 (If there are, you'll need further work to untangle them.)

 --
 Raul

 On Tue, Jul 21, 2015 at 10:34 AM, Mike Day mike_liz@tiscali.co.uk
 wrote:

 That's neat,  but it's a bit messy retrieving the actual
 substrings rather than their encoded forms.

 This does it,
 10(]{~i.@[+/~((I.@:(1#/.~))@:( (128!:3)\ ]))) s

 AC

 CA


 but it would be much better with an inverse CRC;
 however that doesn't seem to be supported in J.


 Is there a maximum window size for this approach?

 Thanks,

 Mike


 On 21/07/2015 14:37, Henry Rich wrote:


 For longer subsequences consider using

 (10 (128!:3)\ ])

 to reduce the size of the intermediate array.

 Henry Rich

 On 7/21/2015 12:49 AM, Vijay Lulla wrote:


 Using slightly less space

 (~. #~ 1  #/.~)@(10 ]\ ]) s

 On Mon, Jul 20, 2015 at 11:59 PM, Tikkanz tikk...@gmail.com wrote:


 (i.~ ~: i:~) will find duplicates so how about:

   ~.@(#~ i.~ ~: i:~)@(10 ]\ ]) s

 AC

 CA



 On Tue, Jul 21, 2015 at 3:51 PM, Jon Hough jgho...@outlook.com
 wrote:

 This is a problem from leetcode.com (similar to Project Euler)
 https://leetcode.com/problems/repeated-dna-sequences/
 The problem is to find all 10 letter repeated subsequences from a
 DNA
 string (made of C,G,A,T characters).
 My solution:
 func =: (I.@:(1)@:@:(1{)@:(~. ,: 0@:(#/.~)) {
 ])@:(1@:(10(]\)))
 e.g. s =: 'ACACCAGGGTTT' NB. see the link for
 this
 definition
 func s
 ┌──┬──┐

 │AC│CA│

 └──┴──┘



 It is not very pretty. Can anyone improve on it?




 ---
 This email has been checked for viruses by Avast antivirus software.
 https://www.avast.com/antivirus


 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Substring sequences of a string

2015-07-20 Thread Vijay Lulla
Using slightly less space

(~. #~ 1  #/.~)@(10 ]\ ]) s

On Mon, Jul 20, 2015 at 11:59 PM, Tikkanz tikk...@gmail.com wrote:
 (i.~ ~: i:~) will find duplicates so how about:

 ~.@(#~ i.~ ~: i:~)@(10 ]\ ]) s

 AC

 CA



 On Tue, Jul 21, 2015 at 3:51 PM, Jon Hough jgho...@outlook.com wrote:

 This is a problem from leetcode.com (similar to Project Euler)
 https://leetcode.com/problems/repeated-dna-sequences/
 The problem is to find all 10 letter repeated subsequences from a DNA
 string (made of C,G,A,T characters).
 My solution:
 func =: (I.@:(1)@:@:(1{)@:(~. ,: 0@:(#/.~)) { ])@:(1@:(10(]\)))
 e.g. s =: 'ACACCAGGGTTT' NB. see the link for this
 definition
 func s
 ┌──┬──┐

 │AC│CA│

 └──┴──┘



 It is not very pretty. Can anyone improve on it?

 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] editing a verb definition

2015-06-27 Thread Vijay Lulla
Your steps 1-5 are correct.  The sixth step is to click the Run menu
and choose Clipboard (shortcut key F8) instead of using CTRL-V and
Enter.  Hopefully this works for you.

Thanks,
Vijay.

On Sat, Jun 27, 2015 at 10:24 PM, Daniel Roe ro...@hotmail.com wrote:
 I'm just learning J so this is a bit of a newbie question.
 1) I open up the J session window
 2) I type in a definition of a verb from the Learning J document - Chapter 
 12...

 dog =: 3 : 0
 if. y90 do. 'too hot'
 elseif. y30 do. 'too cold'
 elseif. 1 do. 'OK'
 end.
 )
 It's the porridge - too hot - too cold - example - I called it dog
 Now I want to go back in and change the parameters a bit - for example I want 
 to make too cold be  40 not 30.3) I put the cursor in the definition and 
 change the 30 to a 40

 4) With the cursor I select the entire definition and then copy it with a 
 CTRL-C

 5) I hit he enter key until I get the waiting for input cursor down below 
 everything
 6) I paste in the modified definition with a CTRL-V and hit enter
 7) I get a syntax error message.
 I can't believe that one must re-type the entire definition just to make a 
 change. What am I doing wrong?
 Dan


 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Inserting spaces in a string

2015-06-19 Thread Vijay Lulla
   a=: '93930001029303040593060708'
   reverse=:,@:( _2 (|.\))@:|.
   reverse1=: ,@:|.@:(_2(]\))

   (reverse a) -: (reverse1 a)
1

Thanks,
Vijay.

On Fri, Jun 19, 2015 at 8:39 AM, Linda Alvord lindaalv...@verizon.net wrote:
 Mine was easy. Just add |. To it:

A=:'93930001029303040593060708'
,(|.((-:$A),2)$A),1 ' '
 08 07 06 93 05 04 03 93 02 01 00 93 93

 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Jon Hough
 Sent: Friday, June 19, 2015 6:27 AM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] Inserting spaces in a string

 Lots of interesting answers, thanks.
 As a subquestion, I am also want to reverse the bytes (but not changing the
 order of letters in each byte). e.g. beef would become efbe My solution is
 (which I used some of the answers to my last question to formulate)
 a=: '93930001029303040593060708'

 , _2 (|._)\|. a


 Implicit:




 reverse=:,@:( _2 (|.\))@:|.


 Any interesting solutions to this? I would be interested in a way that only
 uses |. once at most.

 Date: Fri, 19 Jun 2015 08:33:35 +0200
 From: agroeneveld...@gmail.com
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] Inserting spaces in a string

 Here's one with variable RHA

 '93930001029303040593060708' (;: inv@ (\~-)) 2


 Vijay Lulla schreef op 19-06-15 om 03:32:
  s=. '93930001029303040593060708'
  }. , _2(' ',)\ s
 
  On Thu, Jun 18, 2015 at 8:47 PM, Jon Hough jgho...@outlook.com wrote:
  I have a hex string
93930001029303040593060708
and I want to insert spaces between each byte, i.e. I want
 
93 93 00 01 02 93 03 04 05 93 06 07 08
 
 
  My current method works fine, but seems a little clunky, plus it
  adds a trailing space onto the end of the string, which isn't the
  end of the world and can be cleaned up, but I want to know a
  terser, more elegant method.  My current method
 
 
 
 
  ,@:(' '(,~1))@:(,2@:(-:@:#) $ ])
 
 
 
 
 
 
 
 
 
 
  ---
  --- For information about J forums see
  http://www.jsoftware.com/forums.htm
  
  -- For information about J forums see
  http://www.jsoftware.com/forums.htm

 --
 Met vriendelijke groet,
 @@i = Arie Groeneveld

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Inserting spaces in a string

2015-06-18 Thread Vijay Lulla
s=. '93930001029303040593060708'
}. , _2(' ',)\ s

On Thu, Jun 18, 2015 at 8:47 PM, Jon Hough jgho...@outlook.com wrote:
 I have a hex string
  93930001029303040593060708
  and I want to insert spaces between each byte, i.e. I want

  93 93 00 01 02 93 03 04 05 93 06 07 08


 My current method works fine, but seems a little clunky, plus it adds a 
 trailing space onto the end of the string, which isn't the end of the world 
 and can be cleaned up, but I want to know a terser, more elegant method.  My 
 current method




 ,@:(' '(,~1))@:(,2@:(-:@:#) $ ])










 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Results of 1/:1

2015-04-11 Thread Vijay Lulla
The readme.txt in the jgplsrc folder (which is what the tar zipped
archive unzips to) contains instructions for how to build and test the
source code.  It is slightly different than most of the open source
projects but it shouldn't be much difficult if you're familiar with
configure/make/install routine used in linux land.  Also, each c file
has one line (4th line in most cases) describing what is in that c
file.  I've extracted those and put them in a file named 00FILEMAPPING
(strangely named to always keep it at the top!) and I just consult it
to see which file I should be looking at for implementation of
vocabulary items.

I'm not entirely sure but I think this strange issue of
grading/sorting literals might be connected to list/atom dichotomy for
a single item list.  This dichotomy is fine for numbers but unsuitable
for literals.  I just cannot think of a situation where a single item
literal can be anything but a list.  Am I missing something obvious?

On Sat, Apr 11, 2015 at 2:59 PM, Henry Rich henryhr...@nc.rr.com wrote:
 Interesting.  There seems to be a retrogression in J8.03, which included a
 new interpreter build.

 It gets even weirder:

 In J8.03 32-bit,

/:~'p'

p =. 'p'

/:~'p'

/:~p
 p
/:~'p'
 p

 Initialization error?

 If Jsoftware would organize a way to modify, build,  test the official J
 version, many of us would work on fixing problems like this.

 Henry Rich


 On 4/11/2015 2:12 PM, EelVex wrote:

 What is more alarming, imo, is that:

 (in both j701 and j801)
 /:~2
 2
 /:~'p'
 p
 /:~'pa'
 ap
 /:~'p'
   NB. empty result!



 On Sat, Apr 11, 2015 at 9:00 PM, Henry Rich henryhr...@nc.rr.com wrote:

 Don't expect this to be fixed in J804.  There are many small interpreter
 bugs and no organized effort to repair them AFAIK.

 This bug is similar to the previously-noted bug #86 which was that the
 result was atomic rather than a list for equal Boolean values.

 On my system, which is J32, /:~1 is 0.

 Henry Rich


 On 4/11/2015 1:54 PM, robert therriault wrote:

 So the fix may already be in process.

 The versions that I have found with the issue are:

 j602/2008-03-03/16:45 which is not surprising since it is not a current
 version and

 j803/2014-10-19-11:11:11 in the jhs environment on my mac, which is
 certainly more current, although the whisperings suggest j804 may not be
 far off.

 Cheers, bob

 On Apr 11, 2015, at 10:29 AM, 'Pascal Jasmin' via Programming 
 programm...@jsoftware.com wrote:

   actually, in Jqt 8.03


1 /: 1
 1



 - Original Message -
 From: robert therriault bobtherria...@mac.com
 To: Programming forum programm...@jsoftware.com
 Cc:
 Sent: Saturday, April 11, 2015 1:16 PM
 Subject: [Jprogramming] Results of 1/:1

 Just spotted a question on stack overflow from Zhe Hu about the
 behaviour of 1/:1
 http://stackoverflow.com/questions/29580291/j-sort-
 function-1-1-returns-0

  2/:2 NB. expected result
 2
  1/:1 NB. expected 1 as the result
 0

 Also,

  #$ 2 /: 2 NB. result is list as expected
 1
 #$ 1 /: 1 NB. result is atom, not a list as expected
 0

 I don't see the reasons that 1/:1 would return the atom 0 as a result,
 but that does not mean there one does not exist. :)

 Cheers, bob

 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm


 --
 For information about J forums see http://www.jsoftware.com/forums.htm

   --

 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Better way to do overlapping sliding windows?

2015-03-25 Thread Vijay Lulla
Dear all,
I came across numpy's stride_tricks submodule via
http://labrosa.ee.columbia.edu/crucialpython/ from the seminar The
dangers and delights Numpy stride tricks.  So I went to the code
section and saw what they were discussing.  This is how I did it in J:

2,\ _4 [\ i.128

Is there a better way to do this?  Or a different way?
Thanks,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Tea-tasting for non-statisticians

2015-02-25 Thread Vijay Lulla
I tried the example listed on this page but I'm getting errors (I had
problems with wh so I replaced them with wd).  Specifically, I get

   test ''
|wd : command not found: wd
|   (wd ::(''_)'qer') (13!:8)3

However, if I type wd on my ide session I get
   wd
3 : 01
smoutput^:(1Debugwd_jqtide_) y
'r c l p n'=. wd1 (,y);(#,y);(,2);(,0)
select. r
case. 0 do.
  EMPTY
case. _1 do.
  memr p,0,n
case. _2 do.
  _2 [\ ;._2 memr p,0,n
case. do.
  if. d=. Debugwd_jqtide_ do.
smoutput^:(1=Debugwd_jqtide_) y
smoutput '**ERROR**'
Debugwd_jqtide_=: d [ e=. wd ::(''_) 'qer' [ Debugwd_jqtide_=: 0
smoutput e
e (13!:8) 3
  else.
(wd ::(''_) 'qer') (13!:8) 3
  end.
end.
)

Details for J are:
   JVERSION
Engine: j803/2014-10-19-11:11:11
Library: 8.03.10
Qt IDE: 1.3.1/5.3.2
Platform: Darwin 64
Installer: J803 install
InstallPath: /users/v/code/apl/j64-803

How do I resolve this error?
Thanks,
Vijay.

On Wed, Feb 25, 2015 at 9:27 AM, chris burke cbu...@jsoftware.com wrote:
 Has anyone built a standalone Mac app using JQt?

 Please see http://www.jsoftware.com/jwiki/Guides/J8%20Standalone

 On 25 February 2015 at 06:09, Ian Clark earthspo...@gmail.com wrote:

 @Henry -- thanks for your comments. Great!

 IMO this is just the sort of discussion I would like to see aired in
 public. Though maybe do the more philosophical stuff in Chat?
 Ideally I would like a summary of the J community's findings
 documented on a Jwiki page for wider consumption.

 Further comments in-line…


 On Wed, Feb 25, 2015 at 4:27 AM, Henry Rich henryhr...@nc.rr.com wrote:
  We should take this off-group, but I'm replying in public because if I'm
  wrong I would like to be corrected (and I'm only an amateur
 statistician):

 That's exactly why I'm appealing to the forum too.
 …To the annoyance of Real Statisticians, no doubt, because this must
 be elementary stuff to them.
 But Wikipedia -- which you'd expect to give simple answers to simple
 questions which laypeople want to ask and need to ask -- approaches
 the whole issue like a cat circling a bowl of hot porridge.
 …If you're a layperson, just try working out how to score the Lady
 Tasting Tea experiment from these pages…
 https://en.wikipedia.org/wiki/Binomial_test
 https://en.wikipedia.org/wiki/Binomial_distribution
 https://en.wikipedia.org/wiki/Bernoulli_distribution
 https://en.wikipedia.org/wiki/Bernoulli_trial
 https://en.wikipedia.org/wiki/Bernoulli_process

 As a Human Factors *engineer* -- I've been a professional *user* of
 hypothesis-testing but an amateur Statistician.
 …Or should that be Probabilist? Or even Epistemologist?

 Plus… now I'm retired, I'm getting rusty.

 Plus… I can't find precise enough documentation of JAL verb: binomialprob.
 Like… what's the semantics of the 3rd entry of (y) (styled minimum
 number of successes (s)) when y has only 3 entries? Can it be called
 minimum any more? What I've concluded, after a bit of RTFC plus a
 few idiot tests, is:

(binomialprob 0.5,N,s) -: (binomialprob 0.5,N,s,N)

 Plus… has this doggie got 2 tails or just 1??


  I think you are calling binomialprob correctly but I have some
 objections to
  your use of the result.
 
  1.  I think your rejectH0 should use 1 - -: CONFIDENCE instead of
  1-CONFIDENCE.
 
The question is, How likely is a result as weird as I am seeing,
 assuming
  H0?  You should not bias weird by assuming that weird results will be
  correct guesses - they could just as likely be incorrect guesses.  To
 ensure
  that you reject 95% of the purely-chance deviations of a certain size,
 that
  95% should be centered around the mean, not loaded toward one side.

 The 1-tail-or-2? question -- or so I thought at first.
 But it's deeper than that. It's much more serious. Serious enough to
 be the key issue for me.
 Which is precisely why I want to be *sure*. Sure enough to argue my
 case to a determined layperson. Not merely make an inspired guess, as
 most people would in an industrial situation (…knowing no one else
 knows enough statistics to dare to challenge you!)

 What I understand @Henry to be saying is: should the 5% area under the
 binomial distribution curve, which sets the pass/fail threshold, be
 shared equally between both tails? Even if one tail happens to be in
 fairyland?

 What I mean by that last remark is…
 If The Lady Tasting Tea (TLTT) gets every trial *wrong*, then she's
 *not* a monkey flipping a fair coin. It's a very biased coin!
 She is sending a strong signal that she can be depended upon (…with X%
 confidence) to make the wrong decision.
 But I don't want to credit her this as evidence to support her claim
 she can tell the difference (…at least, not tell it correctly).
 This is what makes TLTT different from detecting a biased coin by
 repeated tosses.

 What's to do?


  are there really people who think optical might be better than USB??

 Oh-ho-ho! -- yes, they can still be found.
 Hi-Fi buffs have not become extinct, and the (undead?) audio industry
 still 

Re: [Jprogramming] Fwd: Hello all!

2015-02-18 Thread Vijay Lulla
Great read.  Thanks for sharing this essay.

On Wed, Feb 18, 2015 at 1:09 PM, John Baker bakerj...@gmail.com wrote:

 Here's the link to Aronson's essay

 http://www.scottaaronson.com/writings/bignumbers.html

 Sent from my iPhone

  On Feb 18, 2015, at 12:20 PM, R.E. Boss r.e.b...@outlook.com wrote:
 
  Link?
 
  Notice that Conway (who else?) in The Book of Numbers wrote a
 generalization
  of Knuth's up-notation (actually the Ackermann notation), his chained
 arrow
  notation.
 
 
  R.E. Boss
 
 
  -Original Message-
  From: programming-boun...@forums.jsoftware.com [mailto:programming-
  boun...@forums.jsoftware.com] On Behalf Of John Baker
  Sent: woensdag 18 februari 2015 16:15
  To: programm...@jsoftware.com
  Subject: Re: [Jprogramming] Fwd: Hello all!
 
  Very slick. I was just reading Scott Aronson's fine blog post about the
  Busy
  Beaver problem and he commented on Knuth's up up notation. If anyone's
  interested in very large numbers Aronson's post is a superb overview.
 
  Sent from my iPhone
 
  On Feb 17, 2015, at 3:05 PM, Jose Mario Quintana
  jose.mario.quint...@gmail.com wrote:
 
  This a way to produce numbers using the Knuth up arrow notation in J:
 
   Knuth=. * NB. (adv)
   up=. 1NB. (adv)
 
   2x  Knuth up up4 5
  65536
  2003529930406846464979072351560255750447825475569751419265016973710
  8940595563114530895061308809333481010382343429072631818229493821188
  1266886950636476154702916504187191635158796634721944293092798208430
  9104855990570159318959639524863372367203002916969...
 
   # @: : 2x Knuth up up 5
  19729
 
   6x Knuth up up 3
  2659119772153226779682489404387918594905342200269924300660432789497
  0735598738829091213422929061755830324406828265067234256016357755902
  7938964261261109302039893034777446061389442537960087466214788422902
  2133853819192905427915750759274952935109319020362271989...
   #@: : 6x Knuth up up 3
  36306
 
   3x Knuth up up up 0 1 2
  1 3 7625597484987
 
  2x Knuth up up 6  NB. It is t big!
 
  On Tue, Feb 17, 2015 at 2:23 PM, Fausto Saporito
  fausto.sapor...@gmail.com
  wrote:
 
  Hello,
 
  yes the number is very big, but why if I don't use the extended
  precision I have infinity as result, and if I use it I got an error
  ?
 
  I should get infinity anyways.
 
  this is my J session:
 
  ^/ 2 2 2 2
 
  65536
 
  ^/ 2 2 2 2 2  NB. do not use extended precision and I have +inf
 
  _
 
  ^/ 2 2 2 2 2 2   NB. do not use extended precision and I have +inf
 
  _
 
  ^/ x: 2 2 2 2 2   NB. using extended precision I have the result (part
  of
  it)
  2003529930406846464979072351560255750447825475569751419265016973710
  8940595563114530895061308809333481010382343429072631818229493821188
  1266886950636476154702916504187191635158796634721944293092798208430
  9104855990570159318959639524863372367203002916969592156...
 
  ^/ x: 2 2 2 2 2 2 NB. using extended precision I have error... not
  +inf
 
  |limit error
 
  | ^/x:2 2 2 2 2 2
 
  https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation
 
  thanks,
  Fausto
 
  2015-02-17 18:55 GMT+01:00 'Pascal Jasmin' via Programming
  programm...@jsoftware.com:
  2 ^. ^/ 5 # 2x
  65536
 
  so at just 5, it is a 65k bit number
 
  at 6, the 2log of that number would be that 65kbit number.  The
 number
  of atoms in the universe is an 80 bit number.
 
 
 
 
 
  - Original Message -
  From: Raul Miller rauldmil...@gmail.com
  To: Programming forum programm...@jsoftware.com
  Cc:
  Sent: Tuesday, February 17, 2015 12:32 PM
  Subject: Re: [Jprogramming] Fwd: Hello all!
 
  I would guess that the number you are generating is too big to be
  represented using J's data structures (which would also suggest that
  it would be too big to fit into memory).
 
  Thanks,
 
  --
  Raul
 
  On Tue, Feb 17, 2015 at 12:12 PM, Fausto Saporito
  fausto.sapor...@gmail.com wrote:
  HI!
 
  I'm a new J user with a little experience of APL and LISP.
 
  In these days I'm playing with big numbers... very big indeed, and I
  found a bug (?) in the exteded precision implementation of J.
 
  I'm not sure if I can call it a bug, but if I use the standard
  precision number I got a infinity as result... as should be.
 
  I'm talking about knuth-up-arrow notation, to build the tower of
  power. In J the syntax is amazingly simple : ^/ 2 2 2 2
 
  2^^4 is 2 * (2* (2* 2)) = 65536
 
  Now 2^^5 is _ with standard precision... but if I use x:  (i.e. ^/
 x:
  2 2 2 2 2) can get most of number... it's quite big indeed.
 
  The problem arises with 2^^6 or 3^^4 I get limit error instead of
 _
  ... why ?
 
  Is it an expected behaviour ?
 
  thanks in advance,
  Fausto
  --
  For information about J forums see
  http://www.jsoftware.com/forums.htm
 
 
 --
  For information about J forums see
  http://www.jsoftware.com/forums.htm
 
 

Re: [Jprogramming] nth digit of pi

2015-01-07 Thread Vijay Lulla
The To Summarize chapter was great.  However, I spotted a couple of typos.
1. The variable for storing 1000 digits is named g1000 whereas others are
named q30, q100, q1000, and q3000.
2. You mention the consecutive digits formula correctly in the mail but
it's wrong on the page.  There's no d1000 defined on the page.

Sorry for being nitpicky.

On Wed, Jan 7, 2015 at 12:28 AM, Ian Clark earthspo...@gmail.com wrote:

 Vital reading is chapter 17 of At Play With J, by Eugene McDonnell
  http://www.jsoftware.com/jwiki/At%20Play%20With%20J

 Here's my resultant page of notes made back in 2010. Touches on the
 points in this thread:

 See: Contact, by Carl Sagan, for a novel pivoting heavily on finding
 patterns in pi.

 Piphilology comprises the creation and use of mnemonic techniques to
 remember a span of digits of the mathematical constant π. The word is
 a play on Pi itself and the linguistic field of philology.

 The Indiana Pi Bill, an 1897 attempt by the Indiana state legislature
 to dictate a solution to the unending decimal problem by legislative
 fiat.

 Pi search...
 http://www.angio.net/pi/piquery
 http://en.wikipedia.org/wiki/String_searching_algorithm
 Probability of finding strings in pi http://www.angio.net/pi/whynotpi.html

 Should the search for meaningful sequences in pi be called perimancy?

 The Feynman Point: APWJ p136
 http://www.jsoftware.com/jwiki/Doc/Articles/Play151

 From end of Eugene McDonnell's article:
 Before we part, let’s look at a consecutive portion of these digits:
(762+i.6){q1000
 99
 Hmmm. Well, yes, that’s not too unusual.* In fact, if such strings
 didn’t occur every now and then, it would argue against randomness.

 FOOTNOTE: * Eugene has selected the so-called Feynman Point, a
 six-digit sequence 99 in the decimal expansion of π to which
 Richard Feynman (1918-1988) used to draw attention in his lectures to
 make an instructive joke about what is and what is not perceived as
 random. (Ed.)
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] variable integer coding (challenge)

2015-01-06 Thread Vijay Lulla
Actually I used (32$2)#:_17998321 . I agree about the point of simplicity
but there are other reasons for using a simpler approach too.  I didn't
consider using padding/fills because calculations involving
latitudes/longitudes have peculiarities just like date/time
representations.  For e.g., calculating distance between points in
east/west and north/south hemispheres (
http://workshops.boundlessgeo.com/postgis-intro/geography.html).  This
comes up often in GIS related calculations, especially when every mapping
webservice is using lat/lon to store geographic data. And hence, I try to
find the simplest approach (human centric) even if it might not be the most
efficient (machine/task centric).

On Tue, Jan 6, 2015 at 1:43 PM, Raul Miller rauldmil...@gmail.com wrote:

 The .|. in ($!.1).|. is so the 1s you are padding with appear on the
 left, rather than on the right.

 Another way of accomplishing that would be like this:
_32 {.!.1 #:-17998321
 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1

 But note that there's a problem here (with both of these approaches):
32 ($!.1).|. 1
 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

 ...padding on the left with 1s is only valid for negative numbers.

 Meanwhile,
#: 256 #. |. a.i. 2 ic _17998321
 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1

 ... so the |. which appears in that expression works the same way on
 probably any intel machine and would probably be relevant in most
 contexts (though I've not tested on ARM processor, and I'm not even
 sure if current versions of J run on ARM... and since ARM is
 bi-endian I'm not sure what native would mean in that context -
 but I guess it would make sense for ARM handling to mimic intel
 handling).

 But there's an even simpler approach:
(32#2)#:_17998321
 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1

 Simplicity is a virtue?

 Thanks,

 --
 Raul

 On Tue, Jan 6, 2015 at 12:44 PM, 'Pascal Jasmin' via Programming
 programm...@jsoftware.com wrote:
  I'm not sure this is the same problem, unless you are trying to encode
 within a range of lattitudes that include dense civilization, and
 longitudes that exclude oceans.
 
  but the 32bit binary rep of -17998321
 
  32 ($!.1).|. #: -17998321
  1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1
 
  though the memcopy version is simpler.
 
#: 256 #. |. a.i. 2 ic _17998321
  1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1
 
-4294967296^:(2147483648) 256 #. |. a.i. 2 ic _17998321
  _17998321
-4294967296^:(2147483648) 256 #. |. a.i. 2 ic 17998321
  17998321
 
 
   I'm not sure if the |. step is only for non macs.
 
 
 
  - Original Message -
  From: Vijay Lulla vijaylu...@gmail.com
  To: programm...@jsoftware.com
  Cc:
  Sent: Tuesday, January 6, 2015 11:38 AM
  Subject: Re: [Jprogramming] variable integer coding (challenge)
 
  I have followed this thread with interest.  Much of this discussion is
  relevant to
 
 https://developers.google.com/maps/documentation/utilities/polylinealgorithm
  . Like Joe, I also enjoyed playing at bits level and was impressed by how
  easy J makes such explorations.  Unfortunately, I couldn't generate all
 the
  encoded values in the example table listed on the page.  Maybe others in
  this group might enjoy exploring this algorithm.
 
  Thanks for the great discussion.
 
  On Wed, Dec 31, 2014 at 3:15 PM, Joe Bogner joebog...@gmail.com wrote:
 
  Thanks. I couldn't follow the examples so I worked through it on my
  own. Sharing it here for anyone else who's following. I switched to 9
  bits instead of 19 to simplify the example
 
 NB. 300 needs 9 bits to be expressed
 $ #: 300
  9
 
 NB. Show 4 9 bit numbers
 $ #: 300 301 302 303
  4 9
 
  Writing those 4 numbers would take 16 bytes[1] since J ints are 4
  bytes as well as C
 
  We can compress it down to 5 bytes if we pack all the bits together:
 
 ] packed=. #. _8[\ , #: 300 301 302 303
  150 75 101 210 240
 
 $ packed
  5
 
  Those 5 bytes could be written to a file and re-read
 
  If I knew in advance that those numbers were 9 bits, it can be reversed
 
 #.  _9[\, #: packed
  300 301 302 303 0
 
  We could also pack it into 8 bytes (two 32 bit integers), but I don't
  see an advantage of that over packing into a single byte (8 bit)
 
 ] packed=. #. _32[\ , #: 300 301 302 303
  2.52152e9 4.02653e9
 
 #.  _9[\, #: packed
  300 301 302 303 0 0 0 0
 
 
  This may be elementary for some but I haven't worked at this level in
  years so I enjoyed playing with it
 
 
 
 
  [1] - http://www.jsoftware.com/help/learning/27.htm
 
  On Wed, Dec 31, 2014 at 11:51 AM, 'Pascal Jasmin' via Programming
  programm...@jsoftware.com wrote:
   Also, if you have only 4 19 bit values, you can pack them up tighter
  
   _2 (16#.)\ #. |: ?. 4 19 $ 2
   109 59 161 30 136 80 64 129 56 1
  
   Non multiples of 8 would just generally leave some trailing

Re: [Jprogramming] variable integer coding (challenge)

2015-01-06 Thread Vijay Lulla
I have followed this thread with interest.  Much of this discussion is
relevant to
https://developers.google.com/maps/documentation/utilities/polylinealgorithm
. Like Joe, I also enjoyed playing at bits level and was impressed by how
easy J makes such explorations.  Unfortunately, I couldn't generate all the
encoded values in the example table listed on the page.  Maybe others in
this group might enjoy exploring this algorithm.

Thanks for the great discussion.

On Wed, Dec 31, 2014 at 3:15 PM, Joe Bogner joebog...@gmail.com wrote:

 Thanks. I couldn't follow the examples so I worked through it on my
 own. Sharing it here for anyone else who's following. I switched to 9
 bits instead of 19 to simplify the example

NB. 300 needs 9 bits to be expressed
$ #: 300
 9

NB. Show 4 9 bit numbers
$ #: 300 301 302 303
 4 9

 Writing those 4 numbers would take 16 bytes[1] since J ints are 4
 bytes as well as C

 We can compress it down to 5 bytes if we pack all the bits together:

] packed=. #. _8[\ , #: 300 301 302 303
 150 75 101 210 240

$ packed
 5

 Those 5 bytes could be written to a file and re-read

 If I knew in advance that those numbers were 9 bits, it can be reversed

#.  _9[\, #: packed
 300 301 302 303 0

 We could also pack it into 8 bytes (two 32 bit integers), but I don't
 see an advantage of that over packing into a single byte (8 bit)

] packed=. #. _32[\ , #: 300 301 302 303
 2.52152e9 4.02653e9

#.  _9[\, #: packed
 300 301 302 303 0 0 0 0


 This may be elementary for some but I haven't worked at this level in
 years so I enjoyed playing with it




 [1] - http://www.jsoftware.com/help/learning/27.htm

 On Wed, Dec 31, 2014 at 11:51 AM, 'Pascal Jasmin' via Programming
 programm...@jsoftware.com wrote:
  Also, if you have only 4 19 bit values, you can pack them up tighter
 
  _2 (16#.)\ #. |: ?. 4 19 $ 2
  109 59 161 30 136 80 64 129 56 1
 
  Non multiples of 8 would just generally leave some trailing 0s on
 decode, which could simply be understood as invalid.
 
 
  - Original Message -
  From: 'Pascal Jasmin' via Programming programm...@jsoftware.com
  To: programm...@jsoftware.com programm...@jsoftware.com
  Cc:
  Sent: Wednesday, December 31, 2014 11:40 AM
  Subject: Re: [Jprogramming] variable integer coding (challenge)
 
  base64 is essentially taking 3 bytes and storing them as 4.  The inverse
 can take 4 6bit values and pack them into 3 bytes.  The J code for base64
 is pretty generic to see how to do it for any base.  7 bit values could be
 packed 8 at a time in 7 bytes.
 
  There is a different way to pack 8 x bit values into x bytes.  Each byte
 would store the i'th bit of the 8 values.  This may be even faster than
 base64 type coding.
 
#. |: ?. 8 19 $ 2
  104 214 59 183 174 23 31 225 134 149 66 31 85 19 133 1 51 148 28
 
 
  - Original Message -
  From: Joe Bogner joebog...@gmail.com
  To: programm...@jsoftware.com
  Cc:
  Sent: Wednesday, December 31, 2014 10:02 AM
  Subject: Re: [Jprogramming] variable integer coding (challenge)
 
  Can 19 bits be stored in memory or a file on modern computers without
  taking up 3 bytes (24 bits)? The only idea that came to mind would some
 bit
  packing scheme with multiple items. That seems complicated unless there
 was
  a need to store billions of these numbers
 
  On Dec 31, 2014 9:28 AM, Joe Bogner joebog...@gmail.com wrote:
 
  Thanks. I missed the point of the variable breakup point but exploring
  different options below illustrated it for me.
 
  Changing the breakup point can encode the numbers into different bit
  lengths (other than 8) which can then be written to the file/memory.
 
  For example, 1021 encoded in 511 breakups would take 18 bits
 
 $ #: 511 toVint 1021
  2 9
 
  Whereas encoding it as 255 would require 40 bits, which is more than a
  32-bit int. This is where I was failing to see the point of encoding
  larger numbers
 
  NB. 5 bytes, 40 bits
  $ #: 255 toVint 1021
  5 8
 
  Without trying the binary representation, I was expecting the breakup
  point to take the same space. For example, below I would have thought
  that I'd need to write a
 
  NB. 6 bytes
 255 toVint 511 toVint 1021
  255 255 1 255 255 0
 
 
  If I understand this correctly, I can see how variable ints could
  shave off a few bits if the range of numbers is known in advance,
  which is often the case.
 
 
  Regarding packed strings I've been thinking about it recently as well.
  I would like to see how it could be used to pack a table of strings
  (rows and columns).
 
  The following string could be a packed representation of a 2x2 table
 
  FrankUSATomGermany
 
  The binary format could be:
 
  [# of rows] [# of columns] [row1-col1 length] [row1-col2 length]
 
  The header for the string could be
  2 2 5 3 3 7
 
  Or maybe if you wanted to support a variable number of columns (unsure
  of the usecase of this)
 
  [# of rows] [row-1 # of columns] [row1-col1 length] [row1-col2 

Re: [Jprogramming] plot cairo output

2014-12-25 Thread Vijay Lulla
I restarted J and I still get the value error: CAIRO_FORMAT_ARGB32.  BTW,
I'm on a mac.

On Thu, Dec 25, 2014 at 9:46 AM, bill lam bbill@gmail.com wrote:

 I suspect you had loaded plot before install cairo addon, will it
 work if you restart J?

 Чт, 25 дек 2014, R.E. Boss написал(а):
  After in Jconsole
 
  load 'graphics/cairo'
  install_jcairo_''
  testcairo_jcairo_''
  1
 
  I get
 
 run''
  |value error: CAIRO_FORMAT_ARGB32
  |   plotcs=:cairo_image_surface_create0 CAIRO_FORMAT_ARGB32,y
 
  test1.ijs and test2.ijs in addon\graphics\cairo work fine.
 
 
  R.E. Boss
 
 
   -Original Message-
   From: programming-boun...@forums.jsoftware.com [mailto:programming-
   boun...@forums.jsoftware.com] On Behalf Of bill lam
   Sent: donderdag 25 december 2014 4:15
   To: jprogramming
   Subject: [Jprogramming] plot cairo output
  
   plot cairo output in J7 is reinstated in j803. This requires
   the graphics/cairo addon, see its readme.
  
   test script:
  
   run=: 3 : 0
   require 'plot math/misc/trig'
  
   steps=: {. + (1{ - {.) * (i.@: % ])@{:
  
   pd 'reset'
   pd 'title sin(exp) vs cos(exp)'
   pd 'color red,green'
   pd 'key sin(exp),cos(exp)'
   x=. steps _1 2 100
   pd x;sin ^x
   pd x;cos ^x
   pd 'cairo ',(jpath '~temp/trig.png'),' 400 400'
   )
  
   run''
  
   set visible to 0 to suppress display similar to that in pdf
   output.
  
   --
   regards,
   
   GPG key 1024D/4434BAB3 2008-08-24
   gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
   gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm

 --
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] plot cairo output

2014-12-25 Thread Vijay Lulla
Following Bill's advice of updating the package and Linda's order worked
for me. Thanks.

On Thu, Dec 25, 2014 at 11:38 AM, Linda Alvord lindaalv...@verizon.net
wrote:

 This order seems to work from windows 8 once Cairo is loaded.

 run=: 3 : 0
 require 'graphics/cairo'
 require 'plot math/misc/trig'

 Linda

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of R.E. Boss
 Sent: Thursday, December 25, 2014 7:00 AM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] plot cairo output

 After in Jconsole

 load 'graphics/cairo'
 install_jcairo_''
 testcairo_jcairo_''
 1

 I get

run''
 |value error: CAIRO_FORMAT_ARGB32
 |   plotcs=:cairo_image_surface_create0 CAIRO_FORMAT_ARGB32,y

 test1.ijs and test2.ijs in addon\graphics\cairo work fine.


 R.E. Boss


  -Original Message-
  From: programming-boun...@forums.jsoftware.com [mailto:programming-
  boun...@forums.jsoftware.com] On Behalf Of bill lam
  Sent: donderdag 25 december 2014 4:15
  To: jprogramming
  Subject: [Jprogramming] plot cairo output
 
  plot cairo output in J7 is reinstated in j803. This requires the
  graphics/cairo addon, see its readme.
 
  test script:
 
  run=: 3 : 0
  require 'plot math/misc/trig'
 
  steps=: {. + (1{ - {.) * (i.@: % ])@{:
 
  pd 'reset'
  pd 'title sin(exp) vs cos(exp)'
  pd 'color red,green'
  pd 'key sin(exp),cos(exp)'
  x=. steps _1 2 100
  pd x;sin ^x
  pd x;cos ^x
  pd 'cairo ',(jpath '~temp/trig.png'),' 400 400'
  )
 
  run''
 
  set visible to 0 to suppress display similar to that in pdf output.
 
  --
  regards,
  
  GPG key 1024D/4434BAB3 2008-08-24
  gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver
  subkeys.pgp.net --armor --export 4434BAB3
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J803 and Suse Linux 12.1

2014-12-12 Thread Vijay Lulla
Thanks Chris.  That did it.

On Fri, Dec 12, 2014 at 10:02 AM, chris burke cbu...@jsoftware.com wrote:

 Thank you. This has been added to the wiki installation page at to

 http://www.jsoftware.com/jwiki/System/Installation/J803#Linux_and_Raspberry_Pi
 .


 On Fri, Dec 12, 2014 at 6:44 AM, Aai agroeneveld...@gmail.com wrote:
 
  To install J803 properly I had to make the following shared lib links
 
  ln -s /lib/libncurses.so.5.8 libtinfo.so.5
 
  ln -s libedit.so.0.0.35 libedit.so.2
 
 
 
 
  --
  Met vriendelijke groet,
  @@i = Arie Groeneveld
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J803 and Suse Linux 12.1

2014-12-12 Thread Vijay Lulla
I made these links in a folder on my home directory (no root access
necessary) and I set the LD_LIBRARY_PATH variable to that directory.  Then
a fresh install of j803 will also work.  At least, this is what I did and
it worked for me.

On Fri, Dec 12, 2014 at 10:45 AM, bill lam bbill@gmail.com wrote:

 In which file system folder were these commands executed?
 For non-root, one may try copy the jconsole from j802 as Eric
 had mention. j803 jconsole did not introduce any new
 functionalities.

 Пт, 12 дек 2014, Aai написал(а):
  To install J803 properly I had to make the following shared lib links
 
  ln -s /lib/libncurses.so.5.8 libtinfo.so.5
 
  ln -s libedit.so.0.0.35 libedit.so.2
 
 
 
 
  --
  Met vriendelijke groet,
  @@i = Arie Groeneveld
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm

 --
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] How is it that people are oblivious to APL/J?

2014-12-02 Thread Vijay Lulla
That sure looks like a nice course and I too wish I could've taken
such a course.  Thanks for sharing.

Vijay.

 On a related topic, Kevin Lawler (author of Kona among other things) pointed 
 this course out to me the other day; a course on approximate solutions to 
 computationally hard problems taught in K. Man, I wish I had taken such a 
 course, taught in K or J. It looks mind melting.

 http://cs.nyu.edu/courses/fall11/CSCI-GA.2965-001/


 -SL
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] SQLITE with Mac

2014-11-28 Thread Vijay Lulla
OOPS! There was a typo in my path.  It should be 'libsqlite3.dylib' and not
'libsqlie3.dylib'. Sorry.

On Fri, Nov 28, 2014 at 1:41 AM, bill lam bbill@gmail.com wrote:

 Thanks Vijay, ddsqlite updated to check for /opt/local/lib/libsqlie3.dylib

 Please report if this patch will cause any regression.


 Чт, 27 ноя 2014, Vijay Lulla написал(а):
  The sqlite library for Yosemite is broken.  I stumbled upon it when John
 (I
  think) asked about how to use SQLite and I tried it myself.  There is a
  workaround.  Use another sqlite library.  I use macports to install other
  linux/GNU software stuff on my mac.  If you use the full path of the
  libsqlite.dylib (instead of the default library unxlib 'sqlite3'...
  /opt/local/lib/libsqlie3.dylib for me) for the variable libsqlite in
  ddsqlite.ijs (lines 44-51).
  HTH,
  Vijay
 
  On Thu, Nov 27, 2014 at 5:15 AM, bill lam bbill@gmail.com wrote:
 
   I have never tested on any Mac, however I tested it worked fine on all
   other platforms including iOS.  Please let me know if the same test
   database and script worked on linux or windows but failed in Mac.
   On Nov 27, 2014 5:48 PM, Jon Hough jgho...@outlook.com wrote:
  
Sorry I am unable to check that at the moment. I should point out
 that
python can access the db without problem, using sqlite3 module I
 created
   a
simple py script that attempted the same SELECT query and it returned
   data.
My point being I dont think it is a database issue.
By the way, since this was a test database it only had one table amd
 two
records, and was created using sqlite browser application.
   
--- Original Message ---
   
From: bill lam bbill@gmail.com
Sent: November 27, 2014 6:42 PM
To: Programming forum programm...@jsoftware.com
Subject: Re: [Jprogramming] SQLITE with Mac
   
Will the testdb work if copied to linux and run there?
On Nov 27, 2014 3:41 PM, Jon Hough jgho...@outlook.com wrote:
   

 I got SQLITE working with J on Linux, but now I'm tryingon Mac
   (Yosemite,
 J803).I have a preexisting database which I'm trying to access.
 ch =: ddcon__db 'database=',(jpath '~/testdb') NB. no error so far,
 database exists in home directory.
 query =: 'SELECT * FROM names' NB. this table name exists, and
 contains
 data.
 ddfet__db (query ddsel__db ch),1 NB. also tried with _1.
 |domain error: cd|   p=.sqlite3_column_database_name y
 My first thought was that the table name names is incorrect. But
 it
 isn't. And ifI exchange names with any old string then ddfet__db
returns
 _1.
  Any help appreciated.


 --
 For information about J forums see
 http://www.jsoftware.com/forums.htm

   
 --
For information about J forums see
 http://www.jsoftware.com/forums.htm
   
 --
For information about J forums see
 http://www.jsoftware.com/forums.htm
   
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm

 --
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] SQLITE with Mac

2014-11-27 Thread Vijay Lulla
The sqlite library for Yosemite is broken.  I stumbled upon it when John (I
think) asked about how to use SQLite and I tried it myself.  There is a
workaround.  Use another sqlite library.  I use macports to install other
linux/GNU software stuff on my mac.  If you use the full path of the
libsqlite.dylib (instead of the default library unxlib 'sqlite3'...
/opt/local/lib/libsqlie3.dylib for me) for the variable libsqlite in
ddsqlite.ijs (lines 44-51).
HTH,
Vijay

On Thu, Nov 27, 2014 at 5:15 AM, bill lam bbill@gmail.com wrote:

 I have never tested on any Mac, however I tested it worked fine on all
 other platforms including iOS.  Please let me know if the same test
 database and script worked on linux or windows but failed in Mac.
 On Nov 27, 2014 5:48 PM, Jon Hough jgho...@outlook.com wrote:

  Sorry I am unable to check that at the moment. I should point out that
  python can access the db without problem, using sqlite3 module I created
 a
  simple py script that attempted the same SELECT query and it returned
 data.
  My point being I dont think it is a database issue.
  By the way, since this was a test database it only had one table amd two
  records, and was created using sqlite browser application.
 
  --- Original Message ---
 
  From: bill lam bbill@gmail.com
  Sent: November 27, 2014 6:42 PM
  To: Programming forum programm...@jsoftware.com
  Subject: Re: [Jprogramming] SQLITE with Mac
 
  Will the testdb work if copied to linux and run there?
  On Nov 27, 2014 3:41 PM, Jon Hough jgho...@outlook.com wrote:
 
  
   I got SQLITE working with J on Linux, but now I'm tryingon Mac
 (Yosemite,
   J803).I have a preexisting database which I'm trying to access.
   ch =: ddcon__db 'database=',(jpath '~/testdb') NB. no error so far,
   database exists in home directory.
   query =: 'SELECT * FROM names' NB. this table name exists, and contains
   data.
   ddfet__db (query ddsel__db ch),1 NB. also tried with _1.
   |domain error: cd|   p=.sqlite3_column_database_name y
   My first thought was that the table name names is incorrect. But it
   isn't. And ifI exchange names with any old string then ddfet__db
  returns
   _1.
Any help appreciated.
  
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Lapack on J80x qt on Mac running Yosemite

2014-11-05 Thread Vijay Lulla
I didn't know lapack addon worked on iphone (sorry I don't have ipad). I
don't get `addons' when I lookup help on iphone (using jx '' command).  All
I see are core,general,graphics,livetexts,math,system.

On Wed, Nov 5, 2014 at 11:17 AM, bill lam bbill@gmail.com wrote:

 I checked iOS 5 already got accelerate framework.  lapack addon
 now updated for iOS.  Please test how lapack will work on
 iPhone/iPad.

 Ср, 05 ноя 2014, bill lam написал(а):
  The lapack addon has been updated to use alternate veclib on Mac
  Yosemate, space character after dlls also removed.
 
  I heard iOS 8 also has accelerate veclib framework installed, can
  anyone confirm if lapack can run on it?
 
  On Tue, Oct 28, 2014 at 1:25 PM, bill lam bbill@gmail.com wrote:
   I agree. I'll make the change.  Thanks.
  
   Did the tests.ijs run correctly?
  
   Пн, 27 окт 2014, Joey K Tuttle написал(а):
   I rather loath spaces in file names, but trailing ones are my most
 favorite
   kind! (leading ones are nice too if you like to control ls/dir
 order...)
  
  
   On 2014/10/27 21:34 , Piet de Jong wrote:
   Wonderful.  Thanks.
   Space at end is critical!
   
   Sent from my iPhone
   
   On 28 Oct 2014, at 3:29 pm, Vijay Lulla vijaylu...@gmail.com
 wrote:
   
   I hadn't realized that LAPACK had stopped working on Yosemite until
 I saw
   this discussion.  I was able to get it to work again by setting the
   following in lapack.ijs found in the addon (notice the space at the
 end).
   
   dll=:
  
 '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
   '
   
   
   On Tue, Oct 28, 2014 at 12:01 AM, Piet de Jong pietd...@gmail.com
 wrote:
   
   Yes, you are right.   The major (large) file is
   
   
  
 '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib’
   
   However get the same error if dll points to this.
   
   
   
   
   On 27 Oct 2014, at 5:33 pm, bill lam bbill@gmail.com
 wrote:
   
  
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
   I googled there is a file at the location
  
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
   What if you set dll=: ... to this file instead?
   
   
   On Sun, Oct 26, 2014 at 7:12 PM, Piet de Jong pietd...@gmail.com
 
   wrote:
   Thanks for the message and help.
   
   I browsed around and found
  
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
   is a possible path but wasn’t successful in making it work.
   
   Also googled about Lapack and Yosemite and it appears a similar
 issue
   has recently arisen in R
   https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033 
   https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033
   where they discuss replacing “VecLib.framework” with
   “Accelerate.framework”
   My understanding of these things is very, very limited so I would
   appreciate any help/pointers to fix up the link.
   For example:  I’m assuming in lapack.ijs  “Darwin” refers to
 Mac.   Is
   this correct?
   Thanks again.
   
   On 26 Oct 2014, at 1:07 am, bill lam bbill@gmail.com
 wrote:
   
   It should be pre-installed in osx, perhaps its path changed in
   yosemite.
   try locate the library and amend the  dll=: ...  line in
 lapack.ijs .
   On Oct 25, 2014 9:42 PM, Piet de Jong pietd...@gmail.com
 wrote:
   
   So how is the shared dll library installed?
   
   Help is much appreciated.
   
   
   On 25 Oct 2014, at 10:06 pm, bill lam bbill@gmail.com
 wrote:
   
   lapack expect a shared library existed in
   
   dll=: '/System/Library/Frameworks/vecLib.framework/vecLib '
   
   lapack addon itself does not install any binary lapack lib to
   Mac.  I suspect if it failed in j80x it will also fail in
 older
   versions of J.
   
   Сб, 25 окт 2014, Piet de Jong написал(а):
   I did clean installs of 801 802 and 803 qt for Mac.
   
   Also installed the Lapack.
   
   All fail to run the Lapack StudioLabLapack at step 6 where
   it attempts to compute eigenvalues/eigenvectors.
   It objects to the cd command.
   
   Any help gratefully received.
  
 --
   For information about J forums see
   http://www.jsoftware.com/forums.htm
   --
   regards,
   
   GPG key 1024D/4434BAB3 2008-08-24
   gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
   gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
  
 --
   For information about J forums see
   http://www.jsoftware.com/forums.htm
  
 --
   For information about J forums see
   http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Lapack on J80x qt on Mac running Yosemite

2014-11-05 Thread Vijay Lulla
Ok. I got it to install. Thanks.

On Wed, Nov 5, 2014 at 8:18 PM, bill lam bbill@gmail.com wrote:

 OK. The base library now updated, and you can try the iospacman on the
 jwiki page. Note ios pacman jnterface is not gui based but uses jpkg verb.
 On Nov 6, 2014 8:16 AM, bill lam bbill@gmail.com wrote:

  the Guides/iOS in jwiki contain instruction for setting up pacman and
 base
  library will also be upgraded to j803. But please _don't_ try this right
  now because it requires a new base library update to fix some bugs which
  prevent booting of J on iOS.  I'll post another message when ready.
 
  If you are still running j7 on iOS, you can copy the latest lapack addon
  from desktop to iPx using the iExplorer way mentioned in the jwiki page.
 
  I tested on iPhone 3gs with iOS 5, the lapack test can run (not crased)
  and output some results but I did not compare them with desktop to verify
  if the answers are correct.
  On Nov 6, 2014 4:14 AM, Vijay Lulla vijaylu...@gmail.com wrote:
 
  I didn't know lapack addon worked on iphone (sorry I don't have ipad). I
  don't get `addons' when I lookup help on iphone (using jx '' command).
  All
  I see are core,general,graphics,livetexts,math,system.
 
  On Wed, Nov 5, 2014 at 11:17 AM, bill lam bbill@gmail.com wrote:
 
   I checked iOS 5 already got accelerate framework.  lapack addon
   now updated for iOS.  Please test how lapack will work on
   iPhone/iPad.
  
   Ср, 05 ноя 2014, bill lam написал(а):
The lapack addon has been updated to use alternate veclib on Mac
Yosemate, space character after dlls also removed.
   
I heard iOS 8 also has accelerate veclib framework installed, can
anyone confirm if lapack can run on it?
   
On Tue, Oct 28, 2014 at 1:25 PM, bill lam bbill@gmail.com
  wrote:
 I agree. I'll make the change.  Thanks.

 Did the tests.ijs run correctly?

 Пн, 27 окт 2014, Joey K Tuttle написал(а):
 I rather loath spaces in file names, but trailing ones are my
 most
   favorite
 kind! (leading ones are nice too if you like to control ls/dir
   order...)


 On 2014/10/27 21:34 , Piet de Jong wrote:
 Wonderful.  Thanks.
 Space at end is critical!
 
 Sent from my iPhone
 
 On 28 Oct 2014, at 3:29 pm, Vijay Lulla vijaylu...@gmail.com
   wrote:
 
 I hadn't realized that LAPACK had stopped working on Yosemite
  until
   I saw
 this discussion.  I was able to get it to work again by setting
  the
 following in lapack.ijs found in the addon (notice the space at
  the
   end).
 
 dll=:

  
 
 '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
 '
 
 
 On Tue, Oct 28, 2014 at 12:01 AM, Piet de Jong 
  pietd...@gmail.com
   wrote:
 
 Yes, you are right.   The major (large) file is
 
 

  
 
 '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib’
 
 However get the same error if dll points to this.
 
 
 
 
 On 27 Oct 2014, at 5:33 pm, bill lam bbill@gmail.com
   wrote:
 

  
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
 I googled there is a file at the location

  
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
 What if you set dll=: ... to this file instead?
 
 
 On Sun, Oct 26, 2014 at 7:12 PM, Piet de Jong 
  pietd...@gmail.com
   
 wrote:
 Thanks for the message and help.
 
 I browsed around and found

  
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
 is a possible path but wasn’t successful in making it work.
 
 Also googled about Lapack and Yosemite and it appears a
  similar
   issue
 has recently arisen in R
 https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033
 
 https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033
 where they discuss replacing “VecLib.framework” with
 “Accelerate.framework”
 My understanding of these things is very, very limited so I
  would
 appreciate any help/pointers to fix up the link.
 For example:  I’m assuming in lapack.ijs  “Darwin” refers to
   Mac.   Is
 this correct?
 Thanks again.
 
 On 26 Oct 2014, at 1:07 am, bill lam bbill@gmail.com
   wrote:
 
 It should be pre-installed in osx, perhaps its path changed
  in
 yosemite.
 try locate the library and amend the  dll=: ...  line in
   lapack.ijs .
 On Oct 25, 2014 9:42 PM, Piet de Jong 
 pietd...@gmail.com
  
   wrote:
 
 So how is the shared dll library installed?
 
 Help is much appreciated.
 
 
 On 25 Oct 2014, at 10:06 pm, bill lam 
 bbill@gmail.com
  
   wrote:
 
 lapack expect

Re: [Jprogramming] Lapack on J80x qt on Mac running Yosemite

2014-10-27 Thread Vijay Lulla
I hadn't realized that LAPACK had stopped working on Yosemite until I saw
this discussion.  I was able to get it to work again by setting the
following in lapack.ijs found in the addon (notice the space at the end).

dll=:
'/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
'


On Tue, Oct 28, 2014 at 12:01 AM, Piet de Jong pietd...@gmail.com wrote:

 Yes, you are right.   The major (large) file is


 '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib’

 However get the same error if dll points to this.




  On 27 Oct 2014, at 5:33 pm, bill lam bbill@gmail.com wrote:
 
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
 
  I googled there is a file at the location
 
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
 
  What if you set dll=: ... to this file instead?
 
 
  On Sun, Oct 26, 2014 at 7:12 PM, Piet de Jong pietd...@gmail.com
 wrote:
  Thanks for the message and help.
 
  I browsed around and found
 
 
 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
 
  is a possible path but wasn’t successful in making it work.
 
  Also googled about Lapack and Yosemite and it appears a similar issue
 has recently arisen in R
 
  https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033 
 https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16033
 
  where they discuss replacing “VecLib.framework” with
 “Accelerate.framework”
 
  My understanding of these things is very, very limited so I would
 appreciate any help/pointers to fix up the link.
  For example:  I’m assuming in lapack.ijs  “Darwin” refers to Mac.   Is
 this correct?
 
  Thanks again.
 
  On 26 Oct 2014, at 1:07 am, bill lam bbill@gmail.com wrote:
 
  It should be pre-installed in osx, perhaps its path changed in
 yosemite.
  try locate the library and amend the  dll=: ...  line in lapack.ijs .
  On Oct 25, 2014 9:42 PM, Piet de Jong pietd...@gmail.com wrote:
 
  So how is the shared dll library installed?
 
  Help is much appreciated.
 
 
  On 25 Oct 2014, at 10:06 pm, bill lam bbill@gmail.com wrote:
 
  lapack expect a shared library existed in
 
  dll=: '/System/Library/Frameworks/vecLib.framework/vecLib '
 
  lapack addon itself does not install any binary lapack lib to
  Mac.  I suspect if it failed in j80x it will also fail in older
  versions of J.
 
  Сб, 25 окт 2014, Piet de Jong написал(а):
  I did clean installs of 801 802 and 803 qt for Mac.
 
  Also installed the Lapack.
 
  All fail to run the Lapack StudioLabLapack at step 6 where
  it attempts to compute eigenvalues/eigenvectors.
  It objects to the cd command.
 
  Any help gratefully received.
 
 --
  For information about J forums see
 http://www.jsoftware.com/forums.htm
 
  --
  regards,
  
  GPG key 1024D/4434BAB3 2008-08-24
  gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
  gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
 
 --
  For information about J forums see
 http://www.jsoftware.com/forums.htm
  --
  For information about J forums see
 http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Fwd: Plotting magnitudes of complex numbers in J

2014-10-03 Thread Vijay Lulla
When I tried it I got the following:

datatype norm1 3j4 12j5

complex

datatype norm2 3j4 12j5

floating


Maybe this could be the issue?


On Fri, Oct 3, 2014 at 7:16 PM, bill lam bbill@gmail.com wrote:

 I forwarded this to J forum because I have no real knowledge of plot.
 -- Forwarded message --
 From: Andrey Paramonov andrey.paramo...@gmail.com
 Date: Oct 4, 2014 7:07 AM
 Subject: Plotting magnitudes of complex numbers in J
 To: bbill@gmail.com
 Cc:

 Hi Bill,

 For some reason my message to programm...@jsoftware.com doesn't go
 through, so I thought I can shoot you an email with some strange
 behaviour (bug?) I see in the plot function. Here is the snippet that
 highlights the problem

norm1=: %:@:(* +)
norm2=: |
norm1 3j4 12j5
 5 13
norm2 3j4 12j5
 5 13
load 'plot'
plot norm2 3j4 12j5 NB. works
plot norm1 3j4 12j5 NB. does NOT work

 I thought you might find it interesting.

 Thank you,
 Andrey

 P.S. I'm using j64-802.
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Question on rank conjunction's behavior regarding unexpected vector transposition

2014-09-12 Thread Vijay Lulla
Yes it is column-major order. To supplement Chris's point:
http://www.mathworks.com/help/matlab/math/multidimensional-arrays.html

On Fri, Sep 12, 2014 at 12:33 PM, Roger Hui rogerhui.can...@gmail.com
wrote:

  For example, if an array has shape 2 3 4, then Matlab treats this as 4
  matrices, each 2x3, while J treats it as 2 matrices, each 3x4.

 This leads me to the conjecture that Matlab stores arrays in column-major
 order, like FORTRAN.  J and APL stores arrays in row-major order.




 On Fri, Sep 12, 2014 at 9:28 AM, chris burke cbu...@jsoftware.com wrote:

  Matlab has a different notion of multidimensional array than J.
 
  For example, if an array has shape 2 3 4, then Matlab treats this as 4
  matrices, each 2x3, while J treats it as 2 matrices, each 3x4.
 
  I don't think it helps to try to enforce Matlab thinking on J.
 
  Also, you should try to set up data and calculations so that you don't
 have
  to worry about the shape. In your last post, you want a result of shape 2
  by 1 when summing the rows of a 2-row matrix, but this suggests that you
  are making a mistake, since the natural structure is a 2 element vector,
  not a 1 column matrix.
 
 
  On Fri, Sep 12, 2014 at 7:38 AM, George Dallas george.dal...@gmail.com
  wrote:
 
   Thank you all for your responses. I think I found a solution that helps
  me
   get the shape of the result I expect by specifying at the beginning of
  the
   J sentence the shape of the result I want. For example, if I want to
 add
   the columns of the expression below and I expect a 2 by 1 vector as a
   result I can specify that requirement at the beginning, like so:
  
   2 7 $1
   1 1 1 1 1 1 1
   1 1 1 1 1 1 1
  
   2 1$(+/1(2 7 $1))
   7
   7
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J Kernel

2014-09-02 Thread Vijay Lulla
Just out of curiosity, why is { not included? I use it extensively for my J
explorations. Also, it is much more regular and useful(flexible?) than
indexing in other languages. For e.g., You cannot mix +ve and -ve indexes
in R but it works as expected (at least for me) in J. Regardless, nice work.

Thanks,
Vijay.


On Tue, Sep 2, 2014 at 1:16 PM, Devon McCormick devon...@gmail.com wrote:

 Based on Skip's suggestion, this  page is now here -
 http://www.jsoftware.com/jwiki/DevonMcCormick/MinimalBeginningJ - and is
 titled Minimal J for Beginners.


 On Tue, Sep 2, 2014 at 1:10 PM, Devon McCormick devon...@gmail.com
 wrote:

  Good point - I picked up the J Kernel label from the discussion.
 
 
  On Tue, Sep 2, 2014 at 12:36 PM, Skip Cave s...@caveconsulting.com
  wrote:
 
  Devon, nice job of putting together a reduced set of primitives for rhe
  beginner. The only issue I see is the name. As a beginner, I would never
  think to find a set of most-commonly-used primitives under the name J
  Kernel That actually sounds like a discussion of the internals of J,
  which
  is what I thought when I read the subject of your email. I doubt that a
  beginner would check out a page with that label. A title like J's Basic
  Commands for Beginners or equivalent, would be more likely to attract
 the
  intended audience.
 
  Skp
 
  Skip Cave
  Cave Consulting LLC
 
 
  On Tue, Sep 2, 2014 at 9:54 AM, Devon McCormick devon...@gmail.com
  wrote:
 
   Based on some feedback from Greg Borota last year on his experiences
   learning J, I've put together a page on the J Wiki -
   http://www.jsoftware.com/jwiki/DevonMcCormick/JKernel - that has a
 few
   selected things from J on which a beginner can concentrate to avoid
  being
   overwhelmed by the language in full.
  
   It's a pretty bare minimum and I couldn't find a good link that
 explains
   J's use of single quote for quoted strings but everyone should feel
  free to
   add to it - sparingly, as it's supposed to be a reduced set of the
   language.
  
   It might make sense to leave the existing page much as it is and to
  think
   about a 2nd tier of slightly more advanced verbs and such.  There were
  good
   suggestions in the original discussion -
  
  
 
 http://jsoftware.2058.n7.nabble.com/Learning-J-language-initial-thoughts-td52786.html#a52793
   - that I elided as I consider them more than the bare minimum (things
  like
   rank modifiers and logic verbs).
  
   --
   Devon McCormick, CFA
   --
   For information about J forums see
 http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 
 
 
  --
  Devon McCormick, CFA
 
 


 --
 Devon McCormick, CFA
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J Kernel

2014-09-02 Thread Vijay Lulla
Yes, that's what I meant. Try selecting first and last n rows from data
frame. Actually R's indexing ([) is very lax and can trump people (at least
it has me) in strange ways. http://adv-r.had.co.nz/Subsetting.html How
about subsetting with floats? J raises 'domain error'...R
does...quoteNumeric values are coerced to integer as by 'as.integer' (and
hence truncated towards zero)./quote I know this because I've made this
mistake a couple of times!

One of the things that I really like about J is how regular it isat
least after you get *slightly more* comfortable with it.


On Tue, Sep 2, 2014 at 3:00 PM, Devon McCormick devon...@gmail.com wrote:

 I think he means this by mixing +ve and -ve:
0 1 _2 _1 { i.10
 0 1 8 9


 On Tue, Sep 2, 2014 at 2:50 PM, Joe Bogner joebog...@gmail.com wrote:

  I also use { extensively (dyadic). I appreciate the challenge of
  coming up with a minimal list. One criteria may be: can it be done
  relatively easily with one of the other operations?
 
  For {, it's fairly easy to use {. and }
 
  For example: {. 3 }. 0 1 2 3 4 5
 
  With a trivial case, the performance is negligible, but perhaps not as
  readable
 
 100 timespacex '{. 999 }. i. 1e7'
  0.0248935 1.3422e8
 
 100 timespacex '999 { i. 1e7'
  0.0269468 1.3422e8
 
  I mostly use it for simple indexing. I didn't understand your comment
  about mixing +ve and -ve. Can you elaborate?
 
  [by the way, excellent list Devon. I may use it to extend my
  coffeescript implementation of APL to have functioning examples for
  each of those operations]
 
 
 
  On Tue, Sep 2, 2014 at 2:39 PM, Vijay Lulla vijaylu...@gmail.com
 wrote:
   Just out of curiosity, why is { not included? I use it extensively for
  my J
   explorations. Also, it is much more regular and useful(flexible?) than
   indexing in other languages. For e.g., You cannot mix +ve and -ve
 indexes
   in R but it works as expected (at least for me) in J. Regardless, nice
  work.
  
   Thanks,
   Vijay.
  
  
   On Tue, Sep 2, 2014 at 1:16 PM, Devon McCormick devon...@gmail.com
  wrote:
  
   Based on Skip's suggestion, this  page is now here -
   http://www.jsoftware.com/jwiki/DevonMcCormick/MinimalBeginningJ - and
  is
   titled Minimal J for Beginners.
  
  
   On Tue, Sep 2, 2014 at 1:10 PM, Devon McCormick devon...@gmail.com
   wrote:
  
Good point - I picked up the J Kernel label from the discussion.
   
   
On Tue, Sep 2, 2014 at 12:36 PM, Skip Cave s...@caveconsulting.com
 
wrote:
   
Devon, nice job of putting together a reduced set of primitives for
  rhe
beginner. The only issue I see is the name. As a beginner, I would
  never
think to find a set of most-commonly-used primitives under the name
  J
Kernel That actually sounds like a discussion of the internals of
 J,
which
is what I thought when I read the subject of your email. I doubt
  that a
beginner would check out a page with that label. A title like J's
  Basic
Commands for Beginners or equivalent, would be more likely to
  attract
   the
intended audience.
   
Skp
   
Skip Cave
Cave Consulting LLC
   
   
On Tue, Sep 2, 2014 at 9:54 AM, Devon McCormick 
 devon...@gmail.com
wrote:
   
 Based on some feedback from Greg Borota last year on his
  experiences
 learning J, I've put together a page on the J Wiki -
 http://www.jsoftware.com/jwiki/DevonMcCormick/JKernel - that
 has a
   few
 selected things from J on which a beginner can concentrate to
 avoid
being
 overwhelmed by the language in full.

 It's a pretty bare minimum and I couldn't find a good link that
   explains
 J's use of single quote for quoted strings but everyone should
 feel
free to
 add to it - sparingly, as it's supposed to be a reduced set of
 the
 language.

 It might make sense to leave the existing page much as it is and
 to
think
 about a 2nd tier of slightly more advanced verbs and such.  There
  were
good
 suggestions in the original discussion -


   
  
 
 http://jsoftware.2058.n7.nabble.com/Learning-J-language-initial-thoughts-td52786.html#a52793
 - that I elided as I consider them more than the bare minimum
  (things
like
 rank modifiers and logic verbs).

 --
 Devon McCormick, CFA

  --
 For information about J forums see
   http://www.jsoftware.com/forums.htm

   
  --
For information about J forums see
  http://www.jsoftware.com/forums.htm
   
   
   
   
--
Devon McCormick, CFA
   
   
  
  
   --
   Devon McCormick, CFA
   --
   For information about J forums see
 http://www.jsoftware.com/forums.htm
  
   --
   For information about J

[Jprogramming] Need help with defining a verb

2014-08-31 Thread Vijay Lulla
Dear J-ers,

How would I define a verb 'definedwhere' which finds out where a particular
item got defined?  I.e. using 4!:3 and 4!:4 utilities...but dynamically.
For e.g.,

   definedwhere 'nl'
/Users/v/j64-802/system/main/stdlib.ijs
   NB. This is similar to
   (4!:4 'nl') { 4!:3''
/Users/v/j64-802/system/main/stdlib.ijs

So, I defined the following in my startup script.

   definedwhere=: (4!:3''){~ boxopen

but it does not work because 4!:3'' gets executed during the definition.  I
need it to be done dynamically because the script list will change in the
interactive session.  How can I go about this?

Thanks,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Need help with defining a verb

2014-08-31 Thread Vijay Lulla
Nice. Thank you.


On Sun, Aug 31, 2014 at 11:46 AM, Henry Rich henryhr...@nc.rr.com wrote:

 Apply 4!:3 to the result of a verb rather than a noun.  This delays
 execution.

 whichscript =: (('Not from script') ,~ 4!:3@(0#)) {~ 4!:4@boxopen

 Henry Rich


 On 8/31/2014 11:37 AM, Vijay Lulla wrote:

 Dear J-ers,

 How would I define a verb 'definedwhere' which finds out where a
 particular
 item got defined?  I.e. using 4!:3 and 4!:4 utilities...but dynamically.
 For e.g.,

 definedwhere 'nl'
 /Users/v/j64-802/system/main/stdlib.ijs
 NB. This is similar to
 (4!:4 'nl') { 4!:3''
 /Users/v/j64-802/system/main/stdlib.ijs

 So, I defined the following in my startup script.

 definedwhere=: (4!:3''){~ boxopen

 but it does not work because 4!:3'' gets executed during the definition.
 I
 need it to be done dynamically because the script list will change in the
 interactive session.  How can I go about this?

 Thanks,
 Vijay.
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

  --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Design goals readability and writeability?

2014-07-13 Thread Vijay Lulla
Amongst many other reasons that I like J (very consistent, expressive and
mind bending!) better than most other languages is the ability to easily
modify the shapes of all sorts of data to see how function[s] will behave
with the modified data. I'm by no means an expert programmer (doing it as a
hobby for about 10 years now...and J only since 2012...no APL experience!!)
but this one aspect makes experimenting for solutions so much better than
any other alternatives! If lisp/perl/python/ruby make a programmer more
productive/efficient by providing REPL then J/APL make a programmer more
enlightened by providing a set of functions to easily modify/reshape data
for exploration. At least, in my opinion. I still cannot do anything useful
in J (yet! I'll get there though...I think) but it has helped me get better
(enormously) in R and python (with numpy/scipy)! So, for the benefits that
I get from learning J I'm willing to pay the costs (uncertainty, and the
constant necessity to reference documentation...more so than other
languages).

On a side note check out
https://research.microsoft.com/en-us/um/people/lamport/pubs/euclid.pdf (by
Leslie Lamport ... of LaTeX fame) describe what Euclid would feel of
contemporary programming.

Pardon me if I've merely created noise.


On Sun, Jul 13, 2014 at 7:19 PM, Raul Miller rauldmil...@gmail.com wrote:

 This is not unique to APL. I've seen similar issues with .Net
 programs, with C programs, with Java programs with Ruby programs, with
 CP/M programs, etc. etc.

 For that matter, I've seen analogous issues in non-programming contexts.

 In the context of APL, I've often found that finding representative
 example data, and watching how it gets transformed, tends to help make
 clear all sorts of issues. Ideally you want something complex enough
 to be interesting but small enough that you can see all of it.

 But it really doesn't matter what language I'm working with - I almost
 routinely need to review the definitions and reference documentation.
 Whenever I feel I don't understand something adequately it's time to
 go back and review the basics. It's a good way of getting unstuck (but
 not the only way - for example: performing experiments is also
 important, and sometimes sketching out details on a piece of paper or
 in a text editor or just talking with someone can be the right thing
 to do).

 FYI,

 --
 Raul



 On Sun, Jul 13, 2014 at 6:58 PM, Erling Hellenäs
 erl...@erlinghellenas.se wrote:
  Yes. and I remember an APL program neither I nor anyone else available
 could
  understand. Terse code, all one or two character variables. Without any
  documentation whatsoever. With one for the customer very annoying bug.
 After
  quite some time someone made an interpreter for the output where he could
  patch it to get rid of the bug. /Erling
 
 
  On 2014-07-14 00:43, Don Kelly wrote:
 
  Absolutely!!
  J suffers from the same problem as its precurser APL- in spades.. One
 can
  write very terse code because of its power. Often, 6 moths later the
  original writer has to spend time interpreting what was written. I have
 come
  up with some terse code and , more often terse code from others- all of
  which has been put in a utility script wrapped in  comments so that
 when I
  want to use it-I do have such guidance. This is something one has to do
 to a
  great extent with any programming language. It is even more important
 with J
  tacit.
 
  Don Kelly
 
  On 12/07/2014 11:44 AM, Don Guinn wrote:
 
  Readability depends on a person's background. I can't read Chinese.
 Does
  that mean it's not a readable language?
 
  When writing a program or a document one must assume some level of
  knowledge of the reader. J tends to assume readers have a greater
  knowledge
  of mathematics than most other programming languages require.
 
  But readability is a real problem. What is usually missing from many
  programs, especially J tacit, is the intent of something. Say I see
  something like this:
 
   @ (({. + i.@{:)@[ { ] )
 
  It would certainly help to have some idea what this is supposed to do.
  What
  its arguments are and what it returns. Documentation really helps.
 
  But J expressions can be intimidating. It has always bothered me that I
  could attack a FORTRAN program spanning several pages comfortably. But
 a
  J
  program of just a few lines which do exactly the same thing is hard for
  me
  to get into.
 
 
  On Sat, Jul 12, 2014 at 12:23 PM, Erling Hellenäs
  erl...@erlinghellenas.se
  wrote:
 
  Hi all !
 
  Yes, maybe we should all be concerned about writing readable code
  instead
  of the shortest and most cryptic code? Maybe we should also write
  writeable
  code? Find a way to write that allows us to get the expressions right
  the
  first time?
  J is more of a notation than a language? The value of a notation is
  determined by clarity, but also readability? Maybe readability and
  writeability, in the sense I explained above, should get higher
 

[Jprogramming] How to get Jqt.app to read env variables correctly?

2014-07-09 Thread Vijay Lulla
Hi all,
On my macbook pro I get this strange behavior:

In a Jqt.app (either from finder or icon docked in my dock bar):
#;._1 ':', getenv 'PATH' NB. yields 4

In jconsole (from terminal):
#;._1 ':', getenv 'PATH' NB. yields 18

I.e. Jqt.app doesn't get the env variables (slightly modified for my
convenience) from my account. Why? Or more pertinently how do I get Jqt.app
to read the correct env variables? Am I doing something wrong?

JVERSION yields:

VERSION

Engine: j701/2011-01-10/11:25 build: Feb 6 2011 16:16:29

Library: 8.02.10

Qt IDE: 1.1.3/5.3.0

Platform: Darwin 64

Installer: J802 install

InstallPath: /users/vijay/code/apl/j64-802


Thanks,

Vijay
PS: Pardon me if this isn't the right forum to post this question.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] How to get Jqt.app to read env variables correctly?

2014-07-09 Thread Vijay Lulla
Thanks. You're right. This has got to do with how apps get launched in mac.
To get this to work you can fiddle with either launchd.conf or launchctl
(man launchctl). I added launchctl to the end of my .zshrc file and it now
works. This is the line I added:

launchctl setenv PATH $PATH

and the Jqt.app now gets the PATH variable (the one I was primarily
interested in) correctly.


On Wed, Jul 9, 2014 at 9:04 PM, bill lam bbill@gmail.com wrote:

 Since jqt and jconsole use the same j engine so I think this is un-related
 to J itself.
 On Jul 10, 2014 8:04 AM, Vijay Lulla vijaylu...@gmail.com wrote:

  Hi all,
  On my macbook pro I get this strange behavior:
 
  In a Jqt.app (either from finder or icon docked in my dock bar):
  #;._1 ':', getenv 'PATH' NB. yields 4
 
  In jconsole (from terminal):
  #;._1 ':', getenv 'PATH' NB. yields 18
 
  I.e. Jqt.app doesn't get the env variables (slightly modified for my
  convenience) from my account. Why? Or more pertinently how do I get
 Jqt.app
  to read the correct env variables? Am I doing something wrong?
 
  JVERSION yields:
 
  VERSION
 
  Engine: j701/2011-01-10/11:25 build: Feb 6 2011 16:16:29
 
  Library: 8.02.10
 
  Qt IDE: 1.1.3/5.3.0
 
  Platform: Darwin 64
 
  Installer: J802 install
 
  InstallPath: /users/vijay/code/apl/j64-802
 
 
  Thanks,
 
  Vijay
  PS: Pardon me if this isn't the right forum to post this question.
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Maximum totient ratio

2014-06-12 Thread Vijay Lulla
Maybe this?

:@{. \: @:(] % totient)1+i.100

http://www.jsoftware.com/help/dictionary/d432.htm
or slightly more novice (me too!) friendly:
http://www.jsoftware.com/jwiki/Vocabulary/slashco


On Thu, Jun 12, 2014 at 1:37 AM, Jon Hough jgho...@outlook.com wrote:

 Another Project Euler...

 This time PE #69:  http://projecteuler.net/problem=69

 Essentially, find n which has the maximum of n/totient(n), for all
 positive integers, n, up to 100.

 At first this seemed easy. I have a verb to calculate the ratio:
 totient=: (- ~:).q:
 func =.   ] % totient
 then I can find the maximum:
 max=. (./)1@:((] % totient)0)

 max 1+i.100
 5.53939
 But this gives me the ratio. I need to find n.
 This is a problem, because finding the maximum, the verb, ./ , collapsed
 the array so I don't think I can use I. or similar verb to get the index
 which gave the maximum ratio. So I am not sure how to find the n which gave
 this ratio.

 A second issue is I think my method seems to not be well thought out
 memory-wise. My method first calculates the ratio for every integer up to 1
 million and holds them all in memory. Surely a better way would be to do
 them one at a time and find the maximum as we go.
 In J I am not sure how to do this. I am guessing the recursion verb $:
 will need to be used.
 Any help appreciated.
 Regards.
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Android Keyboard

2014-06-10 Thread Vijay Lulla
Not quite pertinent to the problems that are being discussed in this thread
but interesting nonetheless:
http://swatouch.hpi.uni-potsdam.de/BP2012H2_Theses.pdf especially 2nd and
3rd.


On Tue, Jun 10, 2014 at 11:25 AM, William Tanksley, Jr 
wtanksle...@gmail.com wrote:

 Alex Giannakopoulos aeg...@blueyonder.co.uk wrote:
  Skip, I am glad you mentioned this.  I've been suffering too.  (It's not
  just Samsung, BTW, all Android devices have some sort of smart keyboard
  that interferes, even if they (the keyboards) are not always the same.

 The current solution is to install a keyboard that doesn't interfere
 -- there are happy hacker keyboards, or Bluetooth hardware, or
 MessageEase. As I've mentioned, I recommend the latter.

 -Wm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Segmented Strings

2014-04-11 Thread Vijay Lulla
Some more observations:

 (,: 3 4) ;.0 'abcdefghijklmnop'

|length error

| (,:3 4) ;.0'abcdefghijklmnop'


(,. 3 4) ;.0 'abcdefghijklmnop'

┌┐

│defg│

└┘


Following Henry's advice is always a great idea!


On Fri, Apr 11, 2014 at 5:44 AM, Linda Alvord lindaalv...@verizon.netwrote:

 Henry,  Here's what seems strange to me.

 f=: 13 :'(,:x)];.0 y'

f
 ] ];.0~ [: ,: [

5!:6 'f'
 ] ((];.0)~) ([: ,: [)

4 5 (] (g=:(];.0)~) (B=:[: ,: [))A=:'abcdefghijk'
 efghi

A
 abcdefghijk

B
 [: ,: [

]C=:4 5 B A
 4 5

$C
 1 2

g
 ];.0~

A g C
 efghi

5!:4 'g'
  -- ]
 -- ~ --- ;. -+- 0

h=: 13 :'x(];.0~)y'

h
 ];.0~

A h C
 efghi

i=: 13 :'x((D=:]);.0~)y'

A i C
 efghi

i
 4 : 'x((D=:]);.0~)y'

type 'g'
 -┐
 │verb│
 L-
type 'h'
 -┐
 │verb│
 L-
type 'i'
 -┐
 │verb│
 L-

 When I write  I  and display  I   it  begins  4 :

 But when I ask for the type of  I   it is a verb.

 Linda


 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Henry Rich
 Sent: Thursday, April 10, 2014 9:01 PM
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] Segmented Strings

 Can anyone explain why
 (,:3 4) ];.0 'abcdefghijklmnop'
 defg

 works?

 According to Ye Dic, 0{x gives the starting point, and 1{x gives the
 length.  But

 0 { (,:3 4)
 3 4
 1 { (,:3 4)
 |index error

 AFAICS a table with one row is treated as if it were a table with one
 column.

 In any case, to conform to the definition you should use
 substr =: (];.0~ ,.)~1 _

 ,. not ,:

 Henry Rich

 On 4/10/2014 8:23 PM, Don Guinn wrote:
  Yes. I used those for a long time. I think. ;. is faster.
On Apr 10, 2014 6:06 PM, Raul Miller rauldmil...@gmail.com wrote:
 
  I'm going to be building hashes, but currently it looks like it'll be
  faster to generate them after finding the unique values rather than
  before.
 
  Hashes have great sales pitches in favor of them, but generating them
  takes time.
 
  Meanwhile, getting lots and lots of real memory is relatively cheap.
  According to https://aws.amazon.com/ec2/pricing/ I can use a machine
  with 244 gigabytes of ram for $3.50 an hour. I do not think I'll need
  that much memory, even for a short time.
 
  If it helps, though, there's other ways to get a substring:
 
  4{.3}. 'abcdefghijk'
  defg
  (3+i.4){'abcdefghijk'
  defg
 
  Thanks,
 
  --
  Raul
 
 
  On Thu, Apr 10, 2014 at 6:45 PM, Don Guinn dongu...@gmail.com wrote:
 
 
  Sounds like you can format the data as you want once you get it all.
  Given
  the amount of data there is no way to read it
  the entire file
in an interactive environment. So it has to be indexed or in a
 database.
  If you really want to use a segmented string you could keep the index
 to
  the start of each line to
  quickly get
the line. Also, build a hash for the keys you intend to search on
 rather
  than trying to search the actual file.
  This index and hash should fit in memory quite easily.
  When you talk about a file that big, mapped or not, it's still going to
  require the amount of virtual storage the size of the file, which will
  need
  to be moved from the file or swap into real storage to process.
  Scanning the entire file
will be very slow unless you have lots and lots of real memory.
 
  I haven't seen anyone mention an easy way to substring from a text
 file.
  It
  took me a long time to find it in the dictionary.
  It really exists.
  And it was not obvious when I finally did find it. So I will post it
 here
  for anyone who hasn't found it.
 
 
  substr=:4 : 0 NB. x: start and length, y: string
 
  (,:x)];.0 y
 
  )
 
  3 4 substr 'abcdefghijk'
 
  defg
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Segmented Strings

2014-04-08 Thread Vijay Lulla
I second memory mapped files and mapped file database.


On Tue, Apr 8, 2014 at 4:51 PM, Raul Miller rauldmil...@gmail.com wrote:

 It's available for free now, with some limitations:

 http://kx.com/software-download.php

 It'll take me a few years, though, to develop a fluency in K (Q actually,
 or kdb+ ...) which approaches my fluency in other languages. Anyways, it's
 not at all clear that K (or Q or KDB+) would be any better for this
 application than J. The grass is always greener on the other side of the
 fence, especially after you've crossed it?

 Also, if I do my job properly, the language itself becomes irrelevant and
 the data structures are straightforward enough to allow any arbitrary
 language to be used.

 (Meanwhile, I've got J running on OpenBSD, which pleases me.)

 --
 Raul

 Thanks,

 --
 Raul


 On Tue, Apr 8, 2014 at 2:54 PM, km k...@math.uh.edu wrote:

  I think I would pay for k's database capability.  --Kip Murray
 
  Sent from my iPad
 
   On Apr 8, 2014, at 12:46 PM, Björn Helgason gos...@gmail.com wrote:
  
   I would take a look at the mapped file database lab to get ideas.
  
   -
   Björn Helgason
   gsm:6985532
   skype:gosiminn
   On 8.4.2014 15:34, Raul Miller rauldmil...@gmail.com wrote:
  
   I have thought about using symbols, but the only way to delete symbols
  that
   I know of involves exiting J. And, my starting premise was that I
 would
   have too much data to fit into memory.
  
   For some computations it does make sense to start up an independent J
   session for each part of the calculation (and, in fact, that is what I
  am
   doing in a different aspect of dealing with this dataset - it's about
 10
   terabytes, or so I am told - I've not actually seen it all yet and it
  takes
   time to upload it). But for some calculations you need to be able to
   correlate between pieces which have been dealt with elsewhere.
  
   A have similar reservations about fixed-width fields. There's just too
  much
   data for me to predict how wide the fields are going to be. In some
  cases I
   might actually be going with fixed-width, but that might be too
  inefficient
   for the general case. I've one field which would have to be over 100k
 in
   width if it was fixed width, even though typical cases are shorter
 than
  1k.
   At some point I might go with fixed width, and I expect that doing so
  will
   cause me to lose a few records which will be discovered later in
   processing. That might not be a big deal, for this large of a data
 set,
  but
   if it's not necessary why bother?
  
   Finally, Bjorn's suggestion of using mapped files does seem like a
 good
   idea, at least for the character data. But that is an optimization and
   optimizations speed up some operations at the expense of slowing down
  other
   optimizations. So what really matters is the workload.
  
   Ultimately, for a dataset this large, it's going to take time.
  
   Thanks,
  
   --
   Raul
  
  
  
  
   On Tue, Apr 8, 2014 at 6:06 AM, Joe Bogner joebog...@gmail.com
  wrote:
  
   It seems this representation is somewhat similar to how the symbol
  table
   stores strings:
  
   http://m.jsoftware.com/help/dictionary/dsco.htm
  
   Also, did you consider using symbols? I've used symbols for string
   columns
   that contain highly repetitive data, for example, an invoice table
 with
   an
   alpha-numeric SKU.
  
   Thanks for sharing
  
  
  
  
  
  
   On Tue, Apr 8, 2014 at 2:40 AM, Raul Miller rauldmil...@gmail.com
   wrote:
  
   Consider this example:
  
   table=:;._2;._2]0 :0
   First Name,Last Name,Sum,
   Adam,Wallace,19,
   Travis,Smith,10,
   Donald,Barnell,8,
   Gary,Wallace,27,
   James,Smith,10,
   Sam,Johnson,10,
   Travis,Neal,11,
   Adam,Campbell,11,
   Walter,Abbott,13,
   )
  
   Using boxed strings works great for relatively small sets of data.
 But
   when
   things get big, their overhead starts to hurt to much.  (Big means:
 so
   much
   data that you'll probably not be able to fit it all in memory at the
   same
   time. So you need to plan on relatively frequent delays while
 reading
   from
   disk.)
  
   One alternative to boxed strings is segmented strings. A segmented
   string
   is an argument which could be passed to ;._1. It's basically just a
   string
   with a prefix delimiter. You can work with these sorts of strings
   directly,
   and achieve results similar to what you would achieve with boxed
   arrays.
  
   Segmented strings are a bit clumsier than boxed arrays - you lose a
  lot
   of
   the integrity checks, so if you mess up you probably will not see an
   error.
   So it's probably a good idea to model your code using boxed arrays
 on
  a
   small set of data and then convert to segmented representation once
   you're
   happy with how things work (and once you see a time cost that makes
 it
   worth spending the time to rework your code).
  
   Also, to avoid having to use f;._2 (or whatever) every time, it's
 good
   to
   do an initial 

Re: [Jprogramming] J in 5 minutes

2014-03-30 Thread Vijay Lulla
I agree with Raul. This is nice!

I also agree about mentioning that the supporting code (crypt, int2rgb,
etc.) is in the JoJ link somewhere in the youtube description (About
page?). Others not on the mailing list will not have the luxury of knowing
about JoJ. In fact, I also hurriedly went to the video without reading your
full email and had to return to see if there was somewhere to find more
about supporting code.

Thanks for making this nice video.
Vijay.


On Sun, Mar 30, 2014 at 3:40 PM, Raul Miller rauldmil...@gmail.com wrote:

 (I just noticed that this half-finished message was sitting in my drafts
 folder. Sending it now, incomplete, I need to focus on other things right
 now..)

 This is nice!

 If I may, though, I was looking through your journal of J code, and I just
 itch to make improvements to it. It's not that it's nonfunctional or
 anything, and I'm not even sure if my changes make it faster. And I
 certainly have not presented anything with any near your polish - and we
 need polish, while my work has tended to look crude and minimalistic -
 but...

int2rgb=: [: . 256 256 256#:
rgb2int=: [: . 256#.@(3{.1)

 You could even make them inverses of one another:

int2rgb=: ([: . 256 256 256#:)   :.rgb2int
rgb2int=: ([: . 256#.@(3{.1))  :.int2rgb

 I'm not sure that this is any more readable. Someone new to J but with a
 background in some other computer programming language might be more
 comfortable with your expressions than with mine.

 Anyways, it's probably worth noting - as you have already done, but I
 wanted to emphasize it - that the support code for that video is in the
 Journal of J article you linked.

 Thanks,

 --
 Raul








 On Sun, Mar 30, 2014 at 5:54 AM, Martin Saurer martin.sau...@bluewin.ch
 wrote:

  Hello all,
 
 
 
  A new J in 10 minutes Video is online.
 
 
 
  https://www.youtube.com/watch?v=eQfxSKTUls4
 
 
 
  If you are interested in Steganography, take a look.
 
  The new video is a sequel to the article in
 
  Journal of J Vol.2 No.2 - October 2013 /
 
  Steganography - the J way.
 
  http://www.journalofj.com/index.php/vol-2-no-2-october-2013
 
 
 
  The work on adding narration (spoken words) to the
 
  videos is in progress.
 
  But there are some technical issues with the audio
 
  quality which have to be fixed, before going online.
 
  So please be patient on this. Thanks.
 
 
 
  Cheers
 
 
 
  Martin Saurer
 
 
 
 
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J in 5 minutes

2014-03-13 Thread Vijay Lulla
Not programming related but definitely worth checking out...
http://www.youtube.com/watch?v=qtMVpL3B_6Y

Pardon me.


On Thu, Mar 13, 2014 at 2:31 PM, Raul Miller rauldmil...@gmail.com wrote:

 p.s. I am going to have to admit that after watching all those videos I am
 starting to get tired of that particular sound track. But all music does
 that to me, sooner or later.

 So what I did was turn the volume down and in another window and loaded up
 https://www.youtube.com/watch?v=idvt-J0M5WU (88 beats per minute - blue
 stahli)

 That worked out about right on timing, because I was near the end by that
 point. For the next segment, I went with
 https://www.youtube.com/watch?v=LBZ-3Ugj1AQ (love death immortality -
 glitch mob). Maybe not quite a perfect match (especially the change-up
 which hits a 4:15), but what is?

 Thanks,

 --
 Raul



 On Thu, Mar 13, 2014 at 2:03 PM, Raul Miller rauldmil...@gmail.com
 wrote:

  I got it to work by switching browsers.
 
  Thanks,
 
  --
  Raul
 
 
 
  On Thu, Mar 13, 2014 at 11:44 AM, Martin Saurer 
 martin.sau...@bluewin.chwrote:
 
  Raul,
 
 
 
  The videos are all mp4 encoded with default settings of iMovie on my
 Mac.
 
  So no flash, and no other special things.
 
  I tried to view the videos on a Mac, and on Windows 7.
 
  Everything seems to work right.
 
 
 
  Maybe it's a temporary youtube glitch.
 
 
 
  Please let me know, if the problem persists.
 
 
 
  Martin
 
 
 
 
 
   I am getting a video is currently unavailable message.
 
  
 
   I'm not sure if that's because of the codec you used, a problem on
  youtube's side of things or something else.  I currently have  the
 flash
  player turned off - it was acting up on me - but usually youtube has
  displayed a different message when the issue is   lack of html5
 support
  for that video.
 
  
 
   Since there's a lot of people nowadays using systems which do not
  support
  flash (Adobe seems to be caught in the usual bind that  older tech
  companies tend to find themselves in, where good customer support
  conflicts
  with good user experience), I think it's  important to at least test
 for
  html5 support.
 
  
 
   Thanks,
 
  
 
   --
 
   Raul
 
 
 
 
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J in 5 minutes

2014-03-07 Thread Vijay Lulla
Impressive, Martin! Like Joe, I'm impressed with your impeccable typing too.


On Fri, Mar 7, 2014 at 11:43 AM, Stefano Lanzavecchia s...@apl.it wrote:

  -Original Message-
  From: programming-boun...@forums.jsoftware.com [mailto:programming-
  boun...@forums.jsoftware.com] On Behalf Of Martin Saurer
  Sent: Friday, March 7, 2014 2:12 PM
  To: programm...@jsoftware.com
  Subject: Re: [Jprogramming] J in 5 minutes
 
  Hello all Jers,
  My two cents (or 15 minutes) to show what J can do.

  https://www.youtube.com/watch?v=VSJpJt3c11c

 Quite nice!
 There are some things I find slightly misleading, but before I list them, I
 acknowledge the fact that some might be conscious choices to avoid possible
 confusion in an unprepared audience. This said...
 About Euler problem 1.
 Why use E. and not the simpler =? I can see that = can be
 misleading
 (to quote myself), but = is so common in J that one might as well get
 used
 to it from the beginning.
 So, my first suggestion would be to recast the solution as:
+/ (i.1000) * (0 = 3|i.1000) +. (0 = 5|i.1000)
 Then, the similarity of the expressions in the brackets screams to me to be
 re-factored as:
0 = 3 5|/i.1000
 to get to:
+/ (i.1000) * +./0 = 3 5|/i.1000

 Here I can see, even more than before, that this is overloading the meaning
 of /. Still, in Euler 20 you go for an explicit rank, which you could use
 here to remove the ambiguity on the last /.

 +/ (i.1000) * +./0 = 3 5|0 _ ] i.1000

 The cost for the beginner is the introduction of the bizzare ] (which can
 be replaced safely with a + here):
+/ (i.1000) * +./0 = 3 5|0 _ + i.1000

 and an early exposure to a reduction of a multidimensional array (the +./).
 Pros and cons...


 About Euler problem 20.
 If I had to write the code I'd definitely not  go for the ,0 and the
 execute. Instead I would:

 +/'0123456789' i. : !100x
 648
 which I find more idiomatic.

 Or I would even go as far as using the inverse of 10 base. In other words,
 I'd show that:

 10 #.^:_1 ]  134898
 1 3 4 8 9 8
 leads naturally to
+/ 10 #.^:_1  !100x
 648

 My 1c worth

 All the best,
 --
 Stefano

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] bug in ?

2014-03-02 Thread Vijay Lulla
9!:3 [ 2 4

+++:
┌───┬─┬──┐
│┌─┬─┬─┐││+:│
││+││+││ │  │
│└─┴─┴─┘│ │  │
└───┴─┴──┘
┌─ +
  ┌─  ─┴─ +
──  ─┴─ +:

And looking at compose page (
http://www.jsoftware.com/help/dictionary/d630v.htm) we get

(+: 2) ++ (+: 3)

I still don't understand the parsing rules enough to know how more
complicated expressions/trains get parsed by J.
Pardon if this is mere noise.


On Sun, Mar 2, 2014 at 10:33 AM, Pascal Jasmin godspiral2...@yahoo.cawrote:

 That is indeed the problem, but the code

  2  +++: 3


 is not2 + 2 ++: 3

 but rather
0 + 2 ++: 3
 10
 when it should be:
 + 2 ++: 3
 10

 There doesn't seem to be a good reason to insert 0 v in it.  This is weird
 though:

  2 ([: +: ])(++:) 3
 12

 I don't think it is:

  2+  2 ++:3

 which seems to have nothing to do with supplied verbs. So more likely:

 +: (+ +: 3)

 and x argument is discarded completely. (it should have applied to 2 ++:
 3, and above result should be 20)


 - Original Message -
 From: Don Guinn dongu...@gmail.com
 To: Programming forum programm...@jsoftware.com
 Cc:
 Sent: Sunday, March 2, 2014 10:02:31 AM
 Subject: Re: [Jprogramming] bug in  ?

 I think the problem is that the left-most +: is not-or and only accepts
 boolean arguments.

0 +:++: 0
 1



 On Sun, Mar 2, 2014 at 7:53 AM, Pascal Jasmin godspiral2...@yahoo.ca
 wrote:

  +:++: 3
  12
 2  +++: 3
  10
 
 
   2  +:++: 3
  |domain error
  |   2+:++:3
 
 
  The 3rd verb (leftmost) is called dyadically (with 0 element? like /?)
  even though it sees only a monadic expression.
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] jqt.exe won't start after latest update

2014-02-25 Thread Vijay Lulla
It doesn't work on my mac too! I keep getting segfaults.


On Tue, Feb 25, 2014 at 1:28 PM, Tom Arneson t...@tomarneson.com wrote:

 I tried: install'all' from jconsole and didn't get the update, so I used
 the
 installer.

 Now jqt  JVERSION is:

 Engine: j701/2011-01-10/11:25
 Library: 8.01.021
 Qt IDE: 1.0.24/4.8.5
 Platform: Win 64
 Installer: j801 install
 InstallPath: c:/users/tom arneson/j64-801



 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Pascal
 Jasmin
 Sent: Tuesday, February 25, 2014 10:51
 To: programm...@jsoftware.com
 Subject: Re: [Jprogramming] jqt.exe won't start after latest update

 I can confirm that I cannot start a 2nd copy of jqt 8, after running
 install
 'all' in the first instance's terminal window.

 windows 8.0 64 bit.


 - Original Message -
 From: Amit Roy shredder...@hotmail.com
 To: programm...@jsoftware.com programm...@jsoftware.com
 Cc:
 Sent: Tuesday, February 25, 2014 11:35:06 AM
 Subject: [Jprogramming] jqt.exe won't start after latest update

 Hello,
 This morning I noticed that there was an update available for the jqt IDE.
 I applied it (as I had done so many times in the past), but now, jqt won't
 start up.  I'm using Windows 8.1 64-bit, and I have all the latest updates
 for Windows.
 Any idea on how I might go back to a working version?
 Thanks in advance.
 Amit Roy


 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] selecting from array

2014-02-19 Thread Vijay Lulla
(*./1 a10) # a

maybe?


On Wed, Feb 19, 2014 at 5:40 PM, Joe Bogner joebog...@gmail.com wrote:

 This is an easy one, but it's escaping me after searching and trying
 several things

 How can I mimic this with a 2d array? I want to only return the rows the
 match a boolean expression

 Works
a=: i. 10
   (a  5) # a
 0 1 2 3 4


 Does not work the way I want...

  a=:i. 5 10
a
  0  1  2  3  4  5  6  7  8  9
 10 11 12 13 14 15 16 17 18 19
 20 21 22 23 24 25 26 27 28 29
 30 31 32 33 34 35 36 37 38 39
 40 41 42 43 44 45 46 47 48 49

 (a  10)
 1 1 1 1 1 1 1 1 1 1
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0

(a  10) # a
 |length error


 This kind of does it:

 (a  10) #1 a
 0 1 2 3 4 5 6 7 8 9
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] wat? (seems like a spurious value error from f.)

2014-02-18 Thread Vijay Lulla
Looking at definition of 18!:2 it states If a name sought in locale f is
not found in f , then it is sought in the locales in the path of f (but not
searching *their* paths). Hence

(;: 'writenif z') copath coname ''

fixes the issue. I don't understand locales completely though!


On Tue, Feb 18, 2014 at 4:37 PM, Raul Miller rauldmil...@gmail.com wrote:

 Yes - in fact it does fix if I switch to that locale.

 What's odd is that I have had no problems with similar verbs in other
 locales.



 --
 Raul


 On Tue, Feb 18, 2014 at 4:31 PM, Pascal Jasmin godspiral2...@yahoo.ca
 wrote:

  this would fix in the current locale. (?) put is probably not in the
  current locale.  f. is used as ducktyping in J for crosslocales, and is
  needed behaviour for coinsert to work like inheritance.
 
 
  - Original Message -
  From: Raul Miller rauldmil...@gmail.com
  To: Programming forum programm...@jsoftware.com
  Cc:
  Sent: Tuesday, February 18, 2014 4:14:47 PM
  Subject: [Jprogramming] wat? (seems like a spurious value error from f.)
 
  Here is the definition of a verb defined in the writenif locale:
 write_int_writenif_
  put@(2ic)
 
  Here are the definitions of the two verbs named in that definition:
 put_writenif_
  3 : '  0 0$WRITENIF=:WRITENIF,,y'
 ic_writenif_
  3!:4
 
  Here is what happens when I try to fix that definition:
 write_int_writenif_ f.
  |value error: put
  |   write_int_writenif_ f.
 
  I get similar errors when I try to use those verbs, which is why I was
  using fix - to try and isolate the error.
 
  I'm not seeing what I did wrong here. Can someone help me out?
 
  Thanks,
 
  --
  Raul
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] wat? (seems like a spurious value error from f.)

2014-02-18 Thread Vijay Lulla
I'm not entirely sure but I think your answer lies somewhere in slides 52
and 55-62 of the Locales lab.


On Tue, Feb 18, 2014 at 7:18 PM, Raul Miller rauldmil...@gmail.com wrote:

 But that would mean that I am storing variables in the wrong locale and
 defeats the point of using separate locales in the first place.

 I will use a workaround, but I would like to understand what has gone wrong
 here. Here's how to reproduce:

cocurrent 'writenif'

put=: 3 : '  0 0$WRITENIF=:WRITENIF,,y'

ic=: 3!:4

write_int=: put@(2ic)

cocurrent 'base'

write_int_writenif_ f.

 |value error: put

 Thanks,

 --
 Raul


 On Tue, Feb 18, 2014 at 5:18 PM, Vijay Lulla vijaylu...@gmail.com wrote:

  Looking at definition of 18!:2 it states If a name sought in locale f is
  not found in f , then it is sought in the locales in the path of f (but
 not
  searching *their* paths). Hence
 
  (;: 'writenif z') copath coname ''
 
  fixes the issue. I don't understand locales completely though!
 
 
  On Tue, Feb 18, 2014 at 4:37 PM, Raul Miller rauldmil...@gmail.com
  wrote:
 
   Yes - in fact it does fix if I switch to that locale.
  
   What's odd is that I have had no problems with similar verbs in other
   locales.
  
  
  
   --
   Raul
  
  
   On Tue, Feb 18, 2014 at 4:31 PM, Pascal Jasmin godspiral2...@yahoo.ca
   wrote:
  
this would fix in the current locale. (?) put is probably not in the
current locale.  f. is used as ducktyping in J for crosslocales, and
 is
needed behaviour for coinsert to work like inheritance.
   
   
- Original Message -
From: Raul Miller rauldmil...@gmail.com
To: Programming forum programm...@jsoftware.com
Cc:
Sent: Tuesday, February 18, 2014 4:14:47 PM
Subject: [Jprogramming] wat? (seems like a spurious value error from
  f.)
   
Here is the definition of a verb defined in the writenif locale:
   write_int_writenif_
put@(2ic)
   
Here are the definitions of the two verbs named in that definition:
   put_writenif_
3 : '  0 0$WRITENIF=:WRITENIF,,y'
   ic_writenif_
3!:4
   
Here is what happens when I try to fix that definition:
   write_int_writenif_ f.
|value error: put
|   write_int_writenif_ f.
   
I get similar errors when I try to use those verbs, which is why I
 was
using fix - to try and isolate the error.
   
I'm not seeing what I did wrong here. Can someone help me out?
   
Thanks,
   
--
Raul
   
 --
For information about J forums see
 http://www.jsoftware.com/forums.htm
   
   
 --
For information about J forums see
 http://www.jsoftware.com/forums.htm
   
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] wat? (seems like a spurious value error from f.)

2014-02-18 Thread Vijay Lulla
You're right. I'm sorry.


On Tue, Feb 18, 2014 at 7:52 PM, Raul Miller rauldmil...@gmail.com wrote:

 I am not comfortable with this line of thought, which has to do with paths
 and searching other locales. All the names are in the writenif locale and I
 am referencing a verb in that locale for its fully qualified name. So, for
 the purpose of resolving names in its definition, the current locale should
 be the writenif locale.

 See also slides 17, 19, 25 and 26 of the Locales lab.

 So I feel like something else has to be the issue here.

 Thanks,

 --
 Raul




 On Tue, Feb 18, 2014 at 7:29 PM, Vijay Lulla vijaylu...@gmail.com wrote:

  I'm not entirely sure but I think your answer lies somewhere in slides 52
  and 55-62 of the Locales lab.
 
 
  On Tue, Feb 18, 2014 at 7:18 PM, Raul Miller rauldmil...@gmail.com
  wrote:
 
   But that would mean that I am storing variables in the wrong locale and
   defeats the point of using separate locales in the first place.
  
   I will use a workaround, but I would like to understand what has gone
  wrong
   here. Here's how to reproduce:
  
  cocurrent 'writenif'
  
  put=: 3 : '  0 0$WRITENIF=:WRITENIF,,y'
  
  ic=: 3!:4
  
  write_int=: put@(2ic)
  
  cocurrent 'base'
  
  write_int_writenif_ f.
  
   |value error: put
  
   Thanks,
  
   --
   Raul
  
  
   On Tue, Feb 18, 2014 at 5:18 PM, Vijay Lulla vijaylu...@gmail.com
  wrote:
  
Looking at definition of 18!:2 it states If a name sought in locale
 f
  is
not found in f , then it is sought in the locales in the path of f
 (but
   not
searching *their* paths). Hence
   
(;: 'writenif z') copath coname ''
   
fixes the issue. I don't understand locales completely though!
   
   
On Tue, Feb 18, 2014 at 4:37 PM, Raul Miller rauldmil...@gmail.com
wrote:
   
 Yes - in fact it does fix if I switch to that locale.

 What's odd is that I have had no problems with similar verbs in
 other
 locales.



 --
 Raul


 On Tue, Feb 18, 2014 at 4:31 PM, Pascal Jasmin 
  godspiral2...@yahoo.ca
 wrote:

  this would fix in the current locale. (?) put is probably not in
  the
  current locale.  f. is used as ducktyping in J for crosslocales,
  and
   is
  needed behaviour for coinsert to work like inheritance.
 
 
  - Original Message -
  From: Raul Miller rauldmil...@gmail.com
  To: Programming forum programm...@jsoftware.com
  Cc:
  Sent: Tuesday, February 18, 2014 4:14:47 PM
  Subject: [Jprogramming] wat? (seems like a spurious value error
  from
f.)
 
  Here is the definition of a verb defined in the writenif locale:
 write_int_writenif_
  put@(2ic)
 
  Here are the definitions of the two verbs named in that
 definition:
 put_writenif_
  3 : '  0 0$WRITENIF=:WRITENIF,,y'
 ic_writenif_
  3!:4
 
  Here is what happens when I try to fix that definition:
 write_int_writenif_ f.
  |value error: put
  |   write_int_writenif_ f.
 
  I get similar errors when I try to use those verbs, which is why
 I
   was
  using fix - to try and isolate the error.
 
  I'm not seeing what I did wrong here. Can someone help me out?
 
  Thanks,
 
  --
  Raul
 
   --
  For information about J forums see
   http://www.jsoftware.com/forums.htm
 
 
   --
  For information about J forums see
   http://www.jsoftware.com/forums.htm
 

  --
 For information about J forums see
  http://www.jsoftware.com/forums.htm

   
 --
For information about J forums see
 http://www.jsoftware.com/forums.htm
   
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J in 5 minutes

2014-02-15 Thread Vijay Lulla
I came across
http://waterstreetgm.org/throwing-in-the-towel-on-becomming-a-programmer/this
on HN. And
http://sdawncasey.wordpress.com/about/ in that page. Maybe these pages
might be useful to consider how newcomers take to concepts. These pages are
fascinating to me because it shows that even though these people have had
prior experience with other languages they claim that they still don't
understand programming. IMO, the emphasis on concepts and how J/APL can aid
in these explorations is the best approach to teach programming. Actually
Ken Iverson's explanation of Under (.) [I read this on Ken Iverson's
Quotations page] is one of the best explanations of a very commonly
occurring programming idiom.


On Sat, Feb 15, 2014 at 12:51 PM, robert therriault
bobtherria...@mac.comwrote:

 Hi Henry and Raul,

 I think that the audience being young programmers is a good start towards
 the issues that Raul raises. As an additional challenge, I think that we
 would want to use an example that is user friendly once their interest has
 been attracted. There are some areas of J that have more overhanging
 learning curves than others :)  I don't think we would want to get them
 interested and then send them into the teeth of image processing unless we
 also provided a good road map.

 Cheers, bob

 On Feb 15, 2014, at 9:36 AM, Henry Rich henryhr...@nc.rr.com wrote:

  My idea about that is, we need to appeal to young programmers.  The more
 experience people have with scalar languages, the less able they are to
 learn J.  The more experience they have with other languages in a class
 with J, the less they need to learn J.
 
  The application needs to be of obvious interest to a non-mathematical,
 non-financial user.  My target would be a scientist/engineer/IT person who
 has a computation to perform and no canned package to do it, so they have
 to write a little code.
 
  Henry Rich
 
  On 2/15/2014 12:30 PM, Raul Miller wrote:
  Perhaps it is also worth noting that we are not going to impress
 everyone,
  nor should we want to.
 
  J currently caters to some high powered wallstreet types, high quality
  engineering types and so on. But it's hardly the only language in use
 for
  any of those categories.
 
  ... anyways we should probably think a bit about qualities of the sort
 of
  people we think we want to attract with this video (or videos, since we
  might want to attract different kinds of people).
 
  I'd also be tempted to enlist Cathrine Lathwell's advice on video
 creation
  - she has more than a little relevant experience.
 
  Thanks,
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] J in 5 minutes

2014-02-15 Thread Vijay Lulla
Raul, I fully agree with everything you've said.

Brian, Sorry for the link mangling. You have the correct link in your
message.


On Sat, Feb 15, 2014 at 1:49 PM, Raul Miller rauldmil...@gmail.com wrote:

 That was probably my fault.

 I tried to show him how I used J, not realizing that he had a very strong
 preference for a different style of coding.

 :(

 --
 Raul



 On Sat, Feb 15, 2014 at 1:44 PM, Jim Russell jimsruss...@yahoo.com
 wrote:

  Someone recently linked to Ron Jeffery's blog re throwing in the towel on
  learning J. I developed a respect for Ron back when I hung out on Ward
  Cunningham's original Wiki. Ward once raved about J, even though he
 thought
  he had fully groked it in a weekend or so.
 
   On Feb 15, 2014, at 1:16 PM, Vijay Lulla vijaylu...@gmail.com wrote:
  
   I came across
  
 
 http://waterstreetgm.org/throwing-in-the-towel-on-becomming-a-programmer/this
   on HN. And
   http://sdawncasey.wordpress.com/about/ in that page. Maybe these pages
   might be useful to consider how newcomers take to concepts. These pages
  are
   fascinating to me because it shows that even though these people have
 had
   prior experience with other languages they claim that they still don't
   understand programming. IMO, the emphasis on concepts and how J/APL can
  aid
   in these explorations is the best approach to teach programming.
 Actually
   Ken Iverson's explanation of Under (.) [I read this on Ken Iverson's
   Quotations page] is one of the best explanations of a very commonly
   occurring programming idiom.
  
  
   On Sat, Feb 15, 2014 at 12:51 PM, robert therriault
   bobtherria...@mac.comwrote:
  
   Hi Henry and Raul,
  
   I think that the audience being young programmers is a good start
  towards
   the issues that Raul raises. As an additional challenge, I think that
 we
   would want to use an example that is user friendly once their interest
  has
   been attracted. There are some areas of J that have more overhanging
   learning curves than others :)  I don't think we would want to get
 them
   interested and then send them into the teeth of image processing
 unless
  we
   also provided a good road map.
  
   Cheers, bob
  
   On Feb 15, 2014, at 9:36 AM, Henry Rich henryhr...@nc.rr.com
 wrote:
  
   My idea about that is, we need to appeal to young programmers.  The
  more
   experience people have with scalar languages, the less able they are
 to
   learn J.  The more experience they have with other languages in a
 class
   with J, the less they need to learn J.
  
   The application needs to be of obvious interest to a
 non-mathematical,
   non-financial user.  My target would be a scientist/engineer/IT person
  who
   has a computation to perform and no canned package to do it, so they
  have
   to write a little code.
  
   Henry Rich
  
   On 2/15/2014 12:30 PM, Raul Miller wrote:
   Perhaps it is also worth noting that we are not going to impress
   everyone,
   nor should we want to.
  
   J currently caters to some high powered wallstreet types, high
 quality
   engineering types and so on. But it's hardly the only language in
 use
   for
   any of those categories.
  
   ... anyways we should probably think a bit about qualities of the
 sort
   of
   people we think we want to attract with this video (or videos, since
  we
   might want to attract different kinds of people).
  
   I'd also be tempted to enlist Cathrine Lathwell's advice on video
   creation
   - she has more than a little relevant experience.
  
   Thanks,
  
 --
   For information about J forums see
 http://www.jsoftware.com/forums.htm
  
   --
   For information about J forums see
 http://www.jsoftware.com/forums.htm
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Clarification of results

2014-02-08 Thread Vijay Lulla
I get different results for the example listed on the page
http://www.jsoftware.com/help/dictionary/samp18.htm

   (length=: +/.:*:)
   disp=: ] - 1|.1
   sides=: length@disp
   sides 0 0 4 ,: 3 4 7
1 5 5.65685 NB. The page shows 0.5 3.5 4

Why?

Similarly I get different results for semiper and HERON too (obvious
because they both use sides).

BTW, I'm using J701.

Thanks,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] math requests

2014-01-30 Thread Vijay Lulla
It is calling __mul__ which is just above the __rmul__ portion of the code.
According to documentation of __rmul__ (
http://docs.python.org/3.3/reference/datamodel.html#object.__rmul__) it
just calls the implementation of __mul__ (
https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py#L109-138
)

HTH,
Vijay.


On Thu, Jan 30, 2014 at 12:32 PM, Raul Miller rauldmil...@gmail.com wrote:

 I have been looking at this, and I did a straightforward conversion of
 the python code to J (not quite complete). And I have a couple issues
 I would like to talk through before proceeding (I've also not yet
 studied Cliff Reiter's code).

 First, I would like to quibble with what I assume is the underlying
 standards document. The value INFINITY behaves like a zero in the
 context of addition. That strikes me as a bit odd.

 Second, though, I would like to understand python's rules a bit better
 - what happens when one multiples a Point with integer?

 Specifically, consider this excerpt from
 https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py
 :

   p192 = Point( c192, Gx, Gy, r )

   # Checking against some sample computations presented
   # in X9.62:

   d = 651056770906015076056810763456358567190100156695615665659
   Q = d * p192

 The definitions of p192 and d are trivial for me to translate:

   p192=. (c192;Gx;Gy;r) conew 'Point'

   d=. 651056770906015076056810763456358567190100156695615665659x

 But how do I translate Q?

 In the definition of Point, I saw the following bit of python:

   def __rmul__( self, other ):
 Multiply a point by an integer.

 return self * other

 But if that is the relevant code, all it is telling me is that
 multiplication is defined in terms of multiplication - as far as I can
 see, there is no other definition for multiplying a Point and an
 integer, nor have I seen any constructor for constructing a Point from
 an integer.

 Before I spend too much time chasing down rabbit holes (I really
 should be working on some other issues), can someone explain to me
 what is supposed to happen here?

 Thanks,

 --
 Raul

 On Wed, Jan 29, 2014 at 11:35 AM, Pascal Jasmin godspiral2...@yahoo.ca
 wrote:
 
 
  With all of the mathematicians on this list, these functions have likely
 been implemented before in J.
 
  elyptic curve point add, multiplication and double
  a python reference implementation:
 https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py
 
  the functions are: __add__  __mul__ and double
 
  if I may suggest J explicit signatures for the first 2 functions as:
 
  F =: 4 : 0
  'yx yy yo' =. y
  'xx xy xo' =. x
  )
 
  Some other methods than the python reference could be considered here:
 
  http://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication
 
 
  also appreciated if you have in implementation of inverse_mod
  for reference function of same nate at:
 https://github.com/warner/python-ecdsa/blob/master/ecdsa/numbertheory.py
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] more fork examples

2014-01-24 Thread Vijay Lulla
I second Joe. I'll also be very interested in viewing it remotely, if
possible. Even though I don't participate much in this list (or
programming@jsoftware) I follow it very closely. This list is enlightening
and very educating. J is awesome and this list is awesome! I love it!


On Fri, Jan 24, 2014 at 7:29 AM, Joe Bogner joebog...@gmail.com wrote:

  I'd be happy to give the talk, or some variant of it, any time I find a
  willing audience.

 I'd be very interested if there was an opportunity to see it remotely.
 I wonder if there's any interest for a virtual J user group since the
 community is somewhat small and spread out beyond a few pockets (NYC
 and others?). The J conference will bring people together but alas I
 won't be able to make it this year.
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] frename: file rename

2013-12-21 Thread Vijay Lulla
Aren't your arguments reversed? Shouldn't you call frename as

(jpath d,'comb.png') frename~ jpath d,'1.png'

?
The line
0=((unxlib 'c'), ' rename  i *c *c') 15!:0 y;x
has reversed the parameters of what `rename' expects. Please see `man
rename'

HTH,
Vijay.



On Sat, Dec 21, 2013 at 4:40 PM, Brian Schott schott.br...@gmail.comwrote:

 In a chat thread we have been discussing a task to rename the files in a
 directory. I am using J6, and to do so I want to use the verb frename from
 the standard j files script inside 'j602/system/main/files.ijs' on my Mac
 (which is considered a Unix -- IFUNIX -- box). But the verb frename is not
 working for me.

 Below is my demonstration that frename is not working for me.

d=.'~temp/archive1/'
fboxname=: ([:  8 u: ) :: ]  NB. needed by frename,fexist
fexist=: (1:@(1!:4) :: 0:) @ (fboxname ) @ boxopen
fexist jpath d,'comb.png'
 1
 (jpath d,'comb.png') frename '1.png' NB. why not a result '1'?
 0
 (jpath d,'comb.png') frename jpath d,'1.png' NB. why not a result '1'?
 0


 NB. =
 NB. *frename v newname frename oldname - return 1 if rename ok
 frename=: 4 : 0
 x=.  fboxname x
 y=.  fboxname y
 if. x -: y do. 1 return. end.
 if. IFUNIX do.
   0=((unxlib 'c'),' rename  i *c *c') 15!:0 y;x
 else.
   'kernel32 MoveFileW  i *w *w' 15!:0 (uucp y);uucp x
 end.
 )

 Any ideas about what is causing my error?

 TIA,

 --
 (B=)
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] dirtree like hash utility

2013-11-26 Thread Vijay Lulla
Slightly modified from Joe's answer:

find . -exec openssl md5 {} \+
find . -exec openssl sha1 {} \+

See section 2.3 on
http://www.dwheeler.com/essays/filenames-in-shell.htmlif you intend to
use find!


On Tue, Nov 26, 2013 at 1:22 PM, Devon McCormick devon...@gmail.com wrote:

 Can you use this:

 http://www.jsoftware.com/jwiki/NYCJUG/2009-09-08?highlight=%28walkDir%29#General_Walk_Tree
 ?

 It's an adverb that applies its verb to each level of a tree; it works by
 first building the tree, then traversing it.  Doing in in two steps like
 this simplifies implementation of a flag to walk the tree breadth- or
 depth- first.


 On Tue, Nov 26, 2013 at 1:02 PM, Joe Bogner joebog...@gmail.com wrote:

  How about just
 
  find . | xargs md5sum
 
  Works on cygwin, linux and I assume mac
 
 
 
  On Tue, Nov 26, 2013 at 12:59 PM, Björn Helgason gos...@gmail.com
 wrote:
   I used some years ago a utility called treesize.
  
   It was very useful.
   On Nov 26, 2013 5:54 PM, John Baker bakerj...@gmail.com wrote:
  
   I'm looking for a portable nonGUI utility that will traverse entire
   directories like dirtree and compute hashes (MD5, SHA1) on the
 contents
  of
   the files. It would be nice if the same tool worked on the three
 major J
   platforms, win, mac, linux. The tool must scale to directories
  containing
   100,000 files.
  
   Any suggestions?
  
   --
   John D. Baker
   --
   For information about J forums see
 http://www.jsoftware.com/forums.htm
  
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 



 --
 Devon McCormick, CFA
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Possible discrepancy in i: description (for monad)

2013-10-30 Thread Vijay Lulla
Dear list,
The page for i: (http://www.jsoftware.com/help/dictionary/dico.htm) lists:

in general, i: a j. b produces the list of numbers from -a to a in b equal
steps (or in 1+2*a steps if b is 0).

Shouldn't it be 1+2*|a? For e.g., consider the second example listed on the
page:

   i: _2  yields _2 _1 0 1 2

whereas according to the definition it should yield only 3 elements. Also
there is no mention of reversal.

IMO, the definition of i. does a similar description more precisely. It
also states that using negative number causes reversal.

Have I missed something here? If so, please point me in the right direction.
Thanks,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Possible discrepancy in i: description (for monad)

2013-10-30 Thread Vijay Lulla
Nice catch Linda. I messed up in my original writeup. Sorry.


On Wed, Oct 30, 2013 at 7:44 PM, Linda Alvord lindaalv...@verizon.netwrote:

 Note:

i: _2
 2 1 0 _1 _2

 Lins

 -Original Message-
 From: programming-boun...@forums.jsoftware.com
 [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Vijay Lulla
 Sent: Wednesday, October 30, 2013 12:02 PM
 To: programm...@jsoftware.com
 Subject: [Jprogramming] Possible discrepancy in i: description (for monad)

 Dear list,
 The page for i: (http://www.jsoftware.com/help/dictionary/dico.htm) lists:

 in general, i: a j. b produces the list of numbers from -a to a in b equal
 steps (or in 1+2*a steps if b is 0).

 Shouldn't it be 1+2*|a? For e.g., consider the second example listed on the
 page:

i: _2  yields _2 _1 0 1 2

 whereas according to the definition it should yield only 3 elements. Also
 there is no mention of reversal.

 IMO, the definition of i. does a similar description more precisely. It
 also
 states that using negative number causes reversal.

 Have I missed something here? If so, please point me in the right
 direction.
 Thanks,
 Vijay.
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Sparse with extended integers yields domain error???

2013-08-22 Thread Vijay Lulla
Thanks Raul. I read those two posts and they were very helpful. Especially
the paragraph which explains the philosophy of implementation of the J
interpreter:
quote
So, first off, my understanding is that the J interpreter, while written in
C, is structured much like a J program.  It's doing J things.  So, to
understand what it's doing, we should start with J.
/quote
I've been using J only for a year now (no prior APL experience) and I still
don't think in J. Maybe I should expend more effort in becoming really
comfortable with J before taking on the interpreter's C code.

Regardless, I appreciate your help.
Vijay.


On Wed, Aug 21, 2013 at 11:57 AM, Raul Miller rauldmil...@gmail.com wrote:

 I wrote a couple pages, last year, which might be relevant here:

 http://r-nd-m.blogspot.com/2012/03/1-2-3-nb-six.html
 http://r-nd-m.blogspot.com/2012/03/2-3-nb-five.html

 I have been thinking about writing more, but I've not stumbled over a
 specific question yet that has the right combination of frustration
 and interest to really get me going.

 Good luck,

 --
 Raul


 On Wed, Aug 21, 2013 at 11:50 AM, Vijay Lulla vijaylu...@gmail.com
 wrote:
  Thanks all. That's what I thought too. I've never studied J's C code so
  I'll have to first study it to evaluate how long it will take to
 implement
  something like this. From perusing Roger's paper about the c programming
  style used for J implementation (http://nsl.com/papers/origins.htm) it
  appears that it'll take a little while to wrap my head around this style
 of
  programming. I'll give it a try. Any pointers pertaining to pages
  explaining the structure of interpreter's c code will be very helpful.
 
  Once again, thanks all for clarifying my doubts.
 
 
  On Wed, Aug 21, 2013 at 1:14 AM, Gilles Kirouac gkiro...@riq.qc.ca
 wrote:
 
 
   Why do I get a domain error? Are sparse arrays not implemented for
  extended
   integers?
 
On the page you refer to (d211.htm), one can read:
 
  A sparse array y may be boolean, integer, floating point, complex,
  literal,
  or boxed 
 
No extended integers here.
 
You may also look at 3!:0, you'll see.
 
They are not implemented and Roger (the implementer) did not plan
  for them. Could it be? Probably; roll up your sleeves!
 
   ~ Gilles
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Sparse with extended integers yields domain error???

2013-08-21 Thread Vijay Lulla
Thanks all. That's what I thought too. I've never studied J's C code so
I'll have to first study it to evaluate how long it will take to implement
something like this. From perusing Roger's paper about the c programming
style used for J implementation (http://nsl.com/papers/origins.htm) it
appears that it'll take a little while to wrap my head around this style of
programming. I'll give it a try. Any pointers pertaining to pages
explaining the structure of interpreter's c code will be very helpful.

Once again, thanks all for clarifying my doubts.


On Wed, Aug 21, 2013 at 1:14 AM, Gilles Kirouac gkiro...@riq.qc.ca wrote:


  Why do I get a domain error? Are sparse arrays not implemented for
 extended
  integers?

   On the page you refer to (d211.htm), one can read:

 A sparse array y may be boolean, integer, floating point, complex,
 literal,
 or boxed 

   No extended integers here.

   You may also look at 3!:0, you'll see.

   They are not implemented and Roger (the implementer) did not plan
 for them. Could it be? Probably; roll up your sleeves!

  ~ Gilles
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] What is .*?

2013-07-10 Thread Vijay Lulla
Hi all,
Forgive me if this has been answered somewhere else previously.

I was reading the essay on Bernoulli Numbers (
http://www.jsoftware.com/jwiki/Essays/Bernoulli%20Numbers) and came across
.* (in the third code example block). I don't know what it does and I
couldn't find anything in either the vocabulary or parts of speech pages.
Any explanations/pointers are highly appreciated.

On a side note, how do I search list archives for particular keyword or
topic?
Thanks in advance,
Vijay.
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] String Template

2013-02-18 Thread Vijay Lulla
Won't

str sprintf nmsdts

suffice? Why should we use sprintf1?

On Mon, Feb 18, 2013 at 10:17 AM, Devon McCormick devon...@gmail.comwrote:

 I like the sprintf method, Martin - I hadn't known about that.  It makes
 my multiple cases version neater:
]str=. 'Hello, %s.',LF,'Nice to meet you.',LF,'%s'
 Hello, %s.
 Nice to meet you.
 %s

]nmsdts=. _2\'Dave';'1/1/2001';'Fred';'2/18/2013'
 ++-+
 |Dave|1/1/2001 |
 ++-+
 |Fred|2/18/2013|
 ++-+

str sprintf1 nmsdts
 Hello, Dave.
 Nice to meet you.
 1/1/2001
 Hello, Fred.
 Nice to meet you.
 2/18/2013

$str sprintf1 nmsdts
 2 40



 On Mon, Feb 18, 2013 at 8:32 AM, Raul Miller rauldmil...@gmail.com
 wrote:

  Here's a quick implementation:
 
  template=:1 :0
assert. -. 0 e. }., I. '{}' =/ m NB. {} syntax check
assert. (,2) -: }.$y NB. need two cols: names; values
nams=. {.1 ,.y
vals=.  {:1 ,.y
subst=. vals {::~ nams i. a
;(+/\@e.'{}' @({. subst@]^:('{'=[) }.)/. ]) m
  )
 
  Example use:
 
 '{this} food' template ,:'this';'that'
  that food
 
  or, given
 
  example=: 0 :0 template
   Hello {name},
   Nice to meet you.
   {date}
  )
 
  This would also be an example:
 
 example (;:'name date'),.'George';'today'
 
  FYI,
 
  --
  Raul
 
  On Mon, Feb 18, 2013 at 12:18 AM, June Kim (김창준) junea...@gmail.com
  wrote:
   Hello
  
   I am looking for a string template library in J. Is there something
 like
   what's following(it's in Python):
  
   
   ... Hello {name},
   ... Nice to meet you.
   ... {date}
   ... .format(**dict(name=David, date=2013.2.18))
   '\nHello David,\nNice to meet you.\n2013.2.18\n'
   print _
  
   Hello David,
   Nice to meet you.
   2013.2.18
  
  
   I think I can write a verb in J, but firstly I wanted to check if there
  is
   something out there already.
  
   June
   --
   For information about J forums see http://www.jsoftware.com/forums.htm
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 



 --
 Devon McCormick, CFA
 ^me^ at acm.
 org is my
 preferred e-mail
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm