Talk:Puzzles/2147483647

From J Wiki
Jump to: navigation, search
  • The gerund idea is damn clever, Roger! -- Dan Bron <<DateTime(2006-05-16T16:32:25Z)>>
  • Can anyone come up with a solution that leverages the gerund idea and the facts: u ^: v y ↔ u^:( v y) y and u^:( v1`v2)y ↔ u^:(v1 y) (v2 y)? That is, u ^: ] f`g ↔ u^:(f`g) f`g ↔ u^:(f f`g) g f`g. Dyadic invocations u^:]~ f`g provide even more possibilities. Avoid using & because you may end up creating an infinite loop and crashing J (reported on System/Interpreter/Bugs).
  • <:@^^:(2:`2:`5:)~2:`2:`5: works. Do you suppose <:@^^:]~2:`2:`5: would work according to the dictionary? -- B Jonas <<DateTime(2006-05-17T10:43:08Z)>>
  • I've changed the verb in rule 3 to +/@:(#&> * 0"_ = 3 : '4!:0{.;:''u''[".''u=.'',y.'&>)@:;: so that it work with j504 but it still has some problems, notably if the command contains NB. or =:. Thus I've now changed it to an entirely new verb. -- B Jonas <<DateTime(2006-05-17T10:14:41Z)>>
    • Hey, changed constraint 3 again: this version keeps the same meaning as the original, but it'll work in J5. -- Dan Bron <<DateTime(2006-05-17T13:50:13Z)>>
    • "but"? What's the difference in meaning from my +/@:((3 :'1[3 :y.0'::0: * #)@>)@:;:? -- B Jonas <<DateTime(2006-05-17T14:02:32Z)>>
    • The rule is meant to be read and used by people. While 3 :y. does the right thing, 4!:0 __says__ what the right thing is. To put it another way: if you wanted to change constraint 3 to enforce the minimization of characters that compose verbs, how would you modify your verb? I would change 0: to 3:.
    • Ok, that's right, it is more readable. However, wouldn't it be possible to say <''u'' instead of {.;:''u''? Also, for me, it was a bit confusing that the original verb used u as a regular variable but y as a magical variable containing the verb argument. I probably wouldn't have composed an assignment an evaluate it with ". because I have a strong feeling against evaluating strings even though that feeling shouldn't be applicable to J. I'd have done this: #@:;@:(#~ 0: = 3 :'try. t=.a:1 :y. catch. _3 return. end. 4!:0<''t'''@>)@:;: and here you can replace the 0: with whatever word class you want, except that new words are counted as verbs. -- B Jonas <<DateTime(2006-05-17T21:00:30Z)>>
    • Yes, <'u' would work properly. However, as a matter of pratice, I "say what I mean" rather "say what works". In this case, what I mean is "the name u". A name is a token, and monad ;: is the tokenization function. I read 4!:0 {.;:''u'' as "nameclass of the first word in the string 'u'". This future proofs me: notice how I can still use ;: in the suggested constraints below (and note that -. (<'u') -: {.;:'u').

      I share your distaste of monad "., but it's the lesser of two evils here (try. ? Bleh!). And I see you dislike the repetition of &>. I do too, but there are certain cases where I've gotten in the habit, due to performance issues (not that performance is relevant in this situation).

      How do the following strike you?
      • ([: +/ #&> * 0: = 3 : '4!:0 {. (;: [ ". ::]) ''name=.'',y.'&>)@:;:
      • ([: #@; ] #~ 0: = 3 : '4!:0 {. (;: [ ". ::]) ''name=.'',y.'&>)@:;:

-- Dan Bron <<DateTime(2006-05-17T22:20:14Z)>>

  • By the way, congrats on your 16! I had tried <:(#^".){.&>3:`1: but it wasn't an improvement, so I didn't post it. But o2147483647` is clever!
    • That's nice, and it can be combined with 6 to get the better #.*i.".{.&>3:`2:. Much better than the riddiculous #.*i.(3:u:{:){:>?.`? I thought of. -- B Jonas <<DateTime(2006-05-17T13:59:28Z)>>