When messing around with Haskell using GHC, I can use various meta-commands like :i or :t to find out some information about an identifier. In REBOL, I can use functions like help and sometimes source to get extremely detailed information on a REBOL word.
If such a facility exists for J, I've somehow missed it. Do any J-ers out there know of anything built-in?
Highlight the primitive or J library verb and hit Ctrl-F1. Instant help in html form in your browse if it's a primitive, script documentation for J library verbs.
EDIT:
Or you can use the verb defined to do that, help_j_:
help_j_ 'i.' NB. Opens didot.htm
help_j_ 'help_j_' NB. Opens \system\extras\util\jadefull.ijs in scriptdoc
Related
I'm following along this thing: J Dictionary
It tells me to issue the command d by d over d!/d where d is a list, but my jqt environment tells me value error: over. If the problem is that I'm supposed to import/install/activate a library, I don't see any instructions in the documentation about that. Anyone know what's going on here?
From the documentation you linked:
The verbs over=:({.;}.)#":#, and by=:' '&;#,.#[,.] can be entered as utilities (for use rather than for immediate study)
It's telling you to define those verbs in order for the following code to work.
So they're not part of the standard library nor any other library - you're supposed to define them yourself.
I am attempting to place latex-style math formulas into a haskell diagram.
The documentation pages
http://projects.haskell.org/diagrams/doc/manual.html#essential-concepts
and
http://projects.haskell.org/diagrams/doc/tutorials.html
suggest that one can use something called 'mathjax' to achieve this.
Is there an explanation or example somewhere of how to actually code this?
Attempting to follow the documentation at those links, my best guess for how would be something like:
mathDiagram :: Diagram B
mathDiagram = stroke $ textSVG "`2 + \sqrt{\pi}`:math:" 1
But this of course gives an error:
induction.hs:13:35: error:
lexical error in string/character literal at character 's'
You can do this using the diagrams-pgf backend. Just use the text function and put dollar signs around your text. Also, see here for an explanation of how to include diagrams in a LaTeX document: http://projects.haskell.org/diagrams/doc/latex.html .
I would like to change the behavior of menhir's output in follwoing way:
I want it to look up all grammatical alternatives if it finds any, and put them in a list and get me back this ambigouus interpretation. It shall not reduce conflicts, just store them.
In the source code of menhir, it seems to me, that I have to look in "Engine.ml". The resultant syntactically determined token comes in a variant type item "Accepted v" as a state of a checkpoint of the grammatical automaton. This content is found by a function "accept env prod" before, that is part of a bundle of recursive functions, that change the states.
Do you have a tip, how I could change these functions to put all the possible results in the list here and proceed as if nothing happened? Or do you think, that this wont work anyway?
Thanks.
What you are looking for is a GLR parser generator (G is for generalized). Menhir is not such tool, and I doubt you could modify it easily to do what you want.
However, there is another tool that does exactly what you want: dypgen.
I am wondering why the following failed to work.
(1=$:#([:+/[:*:#"."0":)`]#.(e.&1 4))7
1
and
(({&('no';'yes'))#(1=$:#([:+/[:*:#"."0":)`]#.(e.&1 4)))7
┌──┐
│no│
└──┘
I would expect it to return yes since it is taking the second argument (because the first expression evaluates to 1). Could anybody please explain?
Thanks.
I must admit that it is difficult to figure out what you are trying to do, but the issue i think is your use of Self-Reference ($:).
The description of Self-Reference in the J dictionary states '$: denotes the longest verb that contains it.' http://www.jsoftware.com/help/dictionary/d212.htm
By combining
({&('no';'yes')) with your original verb
(1=$:#([:+/[:*:#"."0":)`]#.(e.&1 4))
You have actually changed the verb that $: self references and I believe this results in the (unexpected) behaviour. I hope that this helps. If you can give a reason for using $: I might be able to give a better answer as to why your verb works this way. I tend to use it very little, as there are usually better solutions in J.
Just another thought. You could define the parts of the verb you are looking to create separately and this would limit the scope of the $: and give you the behaviour that you would like.
choose=: (1=$:#([:+/[:*:#"."0":)`]#.(e.&1 4))
display=:({&('no';'yes'))
display # choose 7
┌───┐
│yes│
└───┘
I'm reading some documentation on IxSet's http://happstack.com/docs/crashcourse/AcidState.html#ixset , and I was wondering about looking at source of Indexable typeclass which is imported from Data.IxSet.
So then I took a repository of Happstack and looked there (darcs get http://patch-tag.com/r/mae/happstack), but that got me to even bigger frustration.
I see the happstack/happstack-ixset/src/Happstack/Data/IxSet.hs file, which creates a module Happstack.Data.IxSet, but I can't see which file creates a module Data.IxSet (and implements class Indexable).
The go-to address for Haskell code is hackage. There is conveniently a link to Hayoo on the front page, the other major Haskell search engine besides Hoogle. Both have advantages above the other.
Hayoo indexes all packages on hackage and the searches by default include all packages on hackage. If you want to search for a known name, e.g. Indexable, that is the more convenient engine, especially if you don't know which package the name comes from. The - currently - fifth hit takes you to Data.IxSet.Indexable. On the right hand side of the Haddock docs, you find a Source link that takes you to the hscoloured sources (in this case, that's not very informative, though, there's only one class member, without default implementation, it tells you nothing above the docs).
Hoogle searches only a small number of packages by default, if you want to include other packages in the search, you have to specify that by adding +packagename to the search - but that restricts the search to the specified package. More about Hoogle searches in the manual. Hoogle's strength is the search by type. Hoogle's search by type applies more transformations to the searched type, and thus finds more matches than Hayoo's if you don't know the exact type (that is not without downsides, however, sometimes you get a lot of irrelevant hits). If you search for example Map k a -> k -> Maybe a, Hoogle's first result is the most likely candidate Data.Map.lookup :: Ord k => k -> Map k a -> Maybe a, whereas Hayoo doesn't find that because it doesn't permute arguments.
Either way, both search engines lead you to hackage's Haddock docs for the queried entity (if the search was successful), from where the Source links take you to the code, if you wish.
Use Haddock documentation, locally-generated or online. Google search usually returns relevant docs near the top. The documentation is cross-linked so you can surf to the module you need. There's a link to the source next to each definition, for example.
This particular module belongs to the base libraries set.