Ok... another approach here might be to use sdselect like jhs does.

https://github.com/jsoftware/ide_jhs/blob/master/core.ijs#L321 for example.

I hope this helps,

-- 
Raul

On Thu, Aug 12, 2021 at 2:39 AM Raul Miller <[email protected]> wrote:
>
> Hmm...
>
> I'm going to have to digest your code before I can know if I have any
> useful suggestions for improving on your approach for handling timer
> events.
>
> As for "relative pathing" ... J was designed to work in an OS
> independent fashion, for the most part. But if you want to get the
> directory of a script, you can put something like this into it:
>
> getThisDir=:3 :0
>   ({.~ i:&'/') rplc&'\/' ;(4!:3''){~4!:4<'getThisDir'
> )
>
> THISDIR=: getThisDir''
>
> This will give you the directory containing the script which contained
> the definition of 'getThisDir'. (It will not be useful if you define
> 'getThisDir' interactively.)
>
> As for TLS, for now I think you would have to use an external
> implementation of TLS. The performance improvements which Henry Rich
> has been introducing may be making it reasonable to have a J native
> implementation of TLS, but that would still be in the future. Going
> with a node proxy should be fine for now. But if you don't mind
> working with external code (which might mean hooking up to a different
> implementation for each OS), you could link to a shared library /
> dynamic library / dll that implements the necessary encryption
> routines. (But I would save this for when you're mostly satisfied with
> the rest of your system.)
>
> I hope this helps,
>
> --
> Raul
>
> On Wed, Aug 11, 2021 at 9:31 PM Kauhentus <[email protected]> wrote:
> >
> > Hello,
> >
> > High-schooler enthusiast here who's taken up learning J as a hobby. I'm
> > currently trying to write a Discord bot in J. I have a working, bare-bones
> > prototype here: https://github.com/Kauhentus/disj, but I have a few
> > questions.
> >
> > I'm currently using sockets to do all the internet/network communications,
> > but they aren't event-driven. I've resorted to using a clunky while loop
> > and constantly blocking/unblocking the thread with sdioctl as needed
> > (the API requires a heartbeat every x interval, so completely blocking the
> > thread is not an option). Is there a better way to do this?
> >
> > Also, Discord's API only works via HTTPS. As far as I know, J does not have
> > an HTTPS library, so I resorted to using node.js and writing a small
> > "proxy". I looked into how one might implement the TLS handshake but it's
> > out of my ability. Am I out of luck if I want to write everything using J?
> >
> > I'm still new to J and 90%+ of my code is not idiomatic, but I'd appreciate
> > any feedback and thoughts. Thanks!
> >
> > Best,
> > Josh Y.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to