I also really enjoy this *func* verb. I've never seen a combination of
documentation, unit tests, and implementation that was so free of
extraneous nonsense.
On Sun, Dec 6, 2015 at 1:12 PM, Brian Schott wrote:
> Yes, now I see that func is executed when it is read in. For some reason in
> this c
Yes, now I see that func is executed when it is read in. For some reason in
this context I thought it was executed indirectly later by something else.
The witchcraft messed up my thinking.
Thanks and also to Raul,
On Sun, Dec 6, 2015 at 11:44 AM, Joe Bogner wrote:
>
> func is a verb, and so it
Hi Brian, the [ shouldn't be required. I think I left it in there when
I was initially building it... For example, paste this into a new
session:
func=: 3 : 0
doc=. (y,'_doc')=: 0 : 0
lines=.dlb each LF cut doc
0!:0 > {: lines
examples=. (y,'_examples')=:3 }. each (#~ (<'ex:') E. 3 {. each [) li
I'm not quite sure what you are saying here, but it works fine for me
without that [
Recap: func grabs a noun script as y,'_doc' with a local copy in doc,
executes the last line, and then grabs, trims, and executes the ex:
lines reporting any errors, and sticks them in y,'_examples'.
Normal use i
Pascal (and Joe),
I had noticed your witchcraft comment before and was impressed then.
Today I noticed in another thread for day 5 of advent... where Joe
referenced the byte code interpreter, the witch crafted definition of the
verb func. I don't think I noticed before the leftmost verb left ([) i
tion def was conj u parameter. name is n.
> )
>
> asdf_examples
> ┌┬──┐
> │(6 ) -: (+/)( 1 2 3)│(3 2$4 5 2 3 2 3) -: (3 1 1)(+/)( 1 2)│
> └┴──┘
>
>
>
>
>
tation header for sum
ex; 6 ; 1 2 3
ex; 3 2$4 5 2 3 2 3 ; 3 1 1 ; 1 2
function def was conj u parameter. name is n.
)
asdf_examples
┌┬──┐
│(6 ) -: (+/)( 1 2 3)│(3 2$4 5 2 3 2 3) -: (3 1 1)(+/)( 1 2)│
└┴──┘
- Original Message -
From: Joe
I have a few moments, and started working through your examples on the
page. First thing I noticed (up at the top of the page) was this:
eval parse ('ADD 1 5',LF)
6
That's not a boxed result, but the page shows it as boxed.
FYI,
--
Raul
On Fri, Nov 13, 2015 at 12:24 PM, Joe Bogner wrote:
Good reads. Each time I read them I pick up more.
I've gone ahead and rewrote the tacit code in a literate, tdd style:
http://code.jsoftware.com/wiki/User:Joe_Bogner/ByteCodeInterpreter#Tacit_Literate.2C_TDD_Version
The code is significantly longer, but the actual fixed representation
is slight
>If someone has a dictionary or other doc reference handy that explains
this I would be grateful to deepen my understanding, although it seems
pretty straightforward
http://code.jsoftware.com/wiki/User:Pascal_Jasmin/3_types_of_adverbs_conjunctions_and_binding
and
http://code.jsoftware.co
> op_pop)^:m ]'
>
> ...and done.
>
>
> 3 popn
> [: ([ ((pC {:: ]) ; (pIP {:: ]) ; ((pV {:: ]) , pV {:: [) ; pS {:: ])
> op_pop)^:3 ]
>
> - Original Message -
> From: Joe Bogner
> To: programm...@jsoftware.com
> Cc:
> Sent: Thursday, November 12,
pn
> [: ([ ((pC {:: ]) ; (pIP {:: ]) ; ((pV {:: ]) , pV {:: [) ; pS {:: ])
> op_pop)^:3 ]
>
> ----- Original Message -
> From: Joe Bogner
> To: programm...@jsoftware.com
> Cc:
> Sent: Thursday, November 12, 2015 8:13 PM
> Subject: Re: [Jprogramming] essay: toy byte code inte
([ (<@:(2&{."1@:(0 {:: ]) i. 6 ,
>> 1 {:: [) 1} ])^:(1 = 2 {:: ]) (0 {:: ]) ; (1 {::
>> ]) ; {.@:(3 {:: ]) ; }.@:(3 {:: ]))`(([: (0 0 $ 1!
>> :2&2)@({"_)&(<;._1 '|exiting|greater than') 1&({::
>> )@:[) ] ])@.(0 {:: [) ])^:(1 = (1 {:
(3 6 5),(0 0 0),:(9 0 0)
>
> maybe this is useful
>
> result =: 2 {:: run@,&(,: 9 0 0)
>
>result (3 6 5),: (0 0 0)
> 11
>
> - Original Message -
> From: Joe Bogner
> To: programm...@jsoftware.com
> Cc:
> Sent: Thursday, November 12, 2015 3:59
])@.(0 {:: [) ])^:(1 = (1 {:: ]) < <:@:#@:
[)^:_ (] ;&(0;'';''))
)
run (3 6 5),(0 0 0),:(9 0 0)
maybe this is useful
result =: 2 {:: run@,&(,: 9 0 0)
result (3 6 5),: (0 0 0)
11
- Original Message -
From: Joe Bogner
To: programm...@jsoftwar
,
>> 1 {:: [) 1} ])^:(1 = 2 {:: ]) (0 {:: ]) ; (1 {::
>> ]) ; {.@:(3 {:: ]) ; }.@:(3 {:: ]))`(([: (0 0 $ 1!
>> :2&2)@({"_)&(<;._1 '|exiting|greater than') 1&({::
>> )@:[) ] ])@.(0 {:: [) ])^:(1 = (1 {:: ]) < <:@:#@:
>> [)^:_ (] ;&am
er of J's tacit engine. A toy
> interpreter like this shows we can write code in an explicit
> mini-language and have it run tacitly. I'm not sure of practical uses
> and I'm not advocating using this for anything serious. J's tacit
> engine acts as a virtual machine
nt system, an object that is a
> combination of queue, stack and dictionary that stores and retrieves results.
>
>
>
>
> - Original Message -
> From: Joe Bogner
> To: programm...@jsoftware.com
> Cc:
> Sent: Tuesday, November 10, 2015 4:49 PM
> Subject: Re:
and retrieves results.
- Original Message -
From: Joe Bogner
To: programm...@jsoftware.com
Cc:
Sent: Tuesday, November 10, 2015 4:49 PM
Subject: Re: [Jprogramming] essay: toy byte code interpreter
Thanks. I don't have any application of it yet other than demystifying
the concept
Dan - good tips. Originally I was thinking the stack may have multiple
types, but I did settle on numbers. I eliminated the boxing but it
didn't speed things up. I'm still happy to get rid of it though
92% of the time is spent just in the looping code (35 out of the 38 seconds)
Executing 50,000 o
In re: performance, probably the biggest bang for your buck would come from
using integers in place of boxes.
From the examples on that page, it appears that stack elements can either be
integers (“ADD 5 2”, “LABEL 100”) or opcodes (“ADD”, “LABEL”). So you could
modify the parse function to con
Thanks. I don't have any application of it yet other than demystifying
the concept of a bytecode interpretation. It does open up some
interesting options of doing cool stuff with stacks in J.
I am also thinking it would be a neat hack to implement a subset of J
in J using interpreted bytecode. I
Its cool.
is your interest to do cool stuff with stacks in J, make a stack language or
interpret bytecode?
If its the first, I have many suggestions.
From: Joe Bogner
To: programm...@jsoftware.com
Sent: Tuesday, November 10, 2015 4:07 PM
Subject: [Jprogrammi
23 matches
Mail list logo