Re: [Jprogramming] scan replace

2015-01-29 Thread Linda Alvord
When you read and write code like this I often need to change the session font. In addirion to the sample letters a list like this would be useful: =-~-`,.,;:!i|1{cC( Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.c

Re: [Jprogramming] scan replace

2015-01-29 Thread 'Pascal Jasmin' via Programming
Another rework of Raul's function, this time using double adverbs ( http://www.jsoftware.com/jwiki/PascalJasmin/double%20adverbs%20vs%20conjunctions) f=: (3##\@])`(,@])`[} 0 1 2 +/~I. c2da =: 1 : ( 'a =. (m ,'' u'') label_. 1 : (''u 1 :'' , quote a)') tie =. '`'c2da F=: (3 # #\@]) ,@] [ tie tie}

Re: [Jprogramming] an intro to double adverbs

2015-01-29 Thread Jose Mario Quintana
An adverb can also take a fixed number of arguments or even a variable number of arguments using a sentinel (a good use of [:) in the same fashion. Moreover, the adverb can be defined tacitly and it is not too difficult if one is willing to come to the dark side ;) See the adverbs sna and Recur d

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread Jose Mario Quintana
"Is it possible to define f tacitly?" J tacit programming is Turing complete; thus, any verb can be defined tacitly. It can be difficult sometimes but this case is easy... If one is prepared to venture to the dark side. an=. <@:((,'0') ,&< ]) NB. Dark side of the force... Cloak=. ((5

Re: [Jprogramming] Recalling and editing lines in jqt

2015-01-29 Thread Nimp O
Another problem I see regarding editing lines: Sometimes in jqt a have a bunch of results on my screen that I want to look. I then proceed to do some incorrect calculation and I want to undo it (as in erase the result). The current way I do it is usig Ctrl-Z, but there are 2 problems: 1) It take

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread 'Pascal Jasmin' via Programming
a version of at that works with linear rather than atomic representations at =: 1 : ' ;: inv (,@(({.`[:)&,.)@}: , {:) cut m' '1&+ +: 1&+' at [: 1&+ [: +: 1&+ '1&+ +: 1&+' at apply 2 4 6 7 11 15 or eval =: 1 : ' a: 1 : m' '1&+ +: 1&+' at eval NB. makes verb instead of string

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread Joe Bogner
For laughs or face palming: I was experimenting with a way to apply a series of verbs to an argument f(g(h(arr))) I didn't want it to follow any rules of a train This was my best explicit attempt: ; }. (3 :'(([: }. >&{.)y);(({.@:>&{.y)`:0 (>&}.y))')^:(({.@:$@:>@:{.)) ((1&+)`+:`(1&+);(2 4 6)) 7

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread Raul Miller
Another approach uses, for example, ]^:] with an introspecting gerund. Needless to say, this is more complex than the explicit form. But you can transform nouns to nouns with verbs and gerunds are nouns. Thanks, -- Raul On Thu, Jan 29, 2015 at 1:55 PM, Joe Bogner wrote: > Cool, I was just o

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread 'Pascal Jasmin' via Programming
a version with double adverb h c2da =: 1 : ( 'a =. (m ,'' u'') label_. 1 : (''u 1 :'' , quote a)') hook_z_ =: 2 : '([: u v) : (u v) ' h =. 'hook' c2da '2&' (1 Y apply~ [ , 0 Y h 0 Y) ((;: '+ *:');i.5) 2 3 4 5 6 - Original Message - From: Joe Bogner To: programm...@jsoftware.c

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread Joe Bogner
Cool, I was just on http://jsoftware.com/jwiki/PascalJasmin/tacit%20programming%20functions trying to figure out how to apply it to this problem. I figured you'd have a solution. Thanks! On Thu, Jan 29, 2015 at 1:48 PM, 'Pascal Jasmin' via Programming wrote: > gerund and non-gerund solution, > >

Re: [Jprogramming] conjunction in tacit verb

2015-01-29 Thread 'Pascal Jasmin' via Programming
gerund and non-gerund solution, Y =: 1 : '(m&{::@:])' (( 0 Y 0 Y) apply 1 Y ) (+:`*:;i.5) 0 2 4 6 8 (( 0 Y 0 Y) apply 1 Y ) ((;: '+: *:');i.5) 0 2 4 6 8 trickier for dyadic '2&' (1 Y apply~ [ , ] 0 Y 0 Y) ((;: '+ *:');i.5) 2 3 4 5 6 From: Joe B

[Jprogramming] conjunction in tacit verb

2015-01-29 Thread Joe Bogner
Is it possible to define f tacitly? f=: 3 : '({.@:>@:{.y)`:0 (>@:}.y)' f (+:`*:;i.5) 0 2 4 6 8 It's meant to take the first gerund from a box that contains a list of gerunds and data to operate on It's an odd circumstance that needed it. I could probably rework the logic but now I'm curious if

Re: [Jprogramming] 3!:5 loses accuracy

2015-01-29 Thread Jon Hough
Thanks for the replies. I don't have a computer at hand now but I will check this tomorrow. --- Original Message --- From: "Rob Hodgkinson" Sent: January 29, 2015 9:05 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] 3!:5 loses accuracy John, check Print Precision affecting your out

Re: [Jprogramming] scan replace

2015-01-29 Thread Henry Rich
f is a hook, so you need to put parens around the definition when you use it separately: ((3 # #\@])`(,@])`[} (0 1 2 +/~ I.))0 1 0 0 0 0 1 0 0 0 1 1 1 0 0 2 2 2 dissect ' ((3 # #\@])`(,@])`[} (0 1 2 +/~ I.))0 1 0 0 0 0 1 0 0' works, though dissect doesn't (yet) look inside m} Henry Rich

Re: [Jprogramming] 3!:5 loses accuracy

2015-01-29 Thread Rob Hodgkinson
John, check Print Precision affecting your output … 9!:10 (8)NB: Default is 6 significant figures 6 9!:11 (8)NB: Change to 8 sig figs 9!:10 ‘’ NB: Check 8 e d 3.434345 3.434345 Rob > On 29 Jan 2015, at 10:43 pm, Jon Hough wrote: > > I'm

Re: [Jprogramming] 3!:5 loses accuracy

2015-01-29 Thread Brian Schott
I suspect you are dealing with a print precision problem. See 9!:11 at http://jsoftware.com/help/dictionary/dx009.htm 3.434345 3.43434 ":!.8] 3.434345 3.434345 -- (B=) -- For information about J forums see http://www.js

[Jprogramming] 3!:5 loses accuracy

2015-01-29 Thread Jon Hough
I'm not sure what the cause of this is, or what the solution is: d =: 2& (3!:5) e =: _2&(3!:5) e d 3.434345 The result is: 3.43434 My float was truncated, losing my final 5. (I'm working on a 64-bit Mac) Any hints about what's going on appreciated.

Re: [Jprogramming] scan replace

2015-01-29 Thread Linda Alvord
Raul, Your function doesn't seem to dissect. Here's what happens. require 'debug/dissect' dissect ',`([ , 0 1})@.(0<[)/@:(* +/\) 0 1 0 0 0 0 0 0 1 0 0' f=: (3##\@])`(,@])`[} 0 1 2 +/~I. f A 0 1 1 1 0 0 0 0 2 2 2 f (3 # #\@])`(,@])`[} (0 1 2 +/~ I.) (3 # #\@])`(,@])`[} (0