Re: [Jprogramming] 'if' and 'else' operators

2014-02-05 Thread Michal Wallace
@Raul: It bothered me too that 'if' and 'unless' had the same definition. I considered moving the negation to 'if', which would make 'then' and 'else' the same. I hadn't imagined using this without an 'else' block, or trying to nest them, since there's only so much room on one line... But anothe

Re: [Jprogramming] 'if' and 'else' operators

2014-02-05 Thread Michal Wallace
On Tue, Feb 4, 2014 at 12:08 PM, Pascal Jasmin wrote: > I figured out one notGerund adverb, and an interesting implementation for > if else 0 else -: if (0>]) else +: if (0<]) i:5 > _2.5 _2 _1.5 _1 _0.5 0 2 4 6 8 10 > This is neat, but I have a hard time reading English words right to left, e

Re: [Jprogramming] 'if' and 'else' operators

2014-02-05 Thread Raul Miller
The conflicts start happening when get into variants and try making them work together. This kind of process inherently leads to ambiguities and of course the computer has to have predefined rules that it will use to resolve them. It takes some thought to decide how to best resolve those ambiguiti

Re: [Jprogramming] 'if' and 'else' operators

2014-02-05 Thread Michal Wallace
On Tue, Feb 4, 2014 at 10:22 AM, Raul Miller wrote: > Let me know if you want any explanation of either this variant or of > the variant at http://jsoftware.com/pipermail/programming/2014-February/034884.html > - questions can help. Thanks, but it was pretty readable. :) Once I understood `:6 I

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Pascal Jasmin
2 2 2 2 1 2 3 4 5 - Original Message ----- From: Pascal Jasmin To: "programm...@jsoftware.com" Cc: Sent: Tuesday, February 4, 2014 12:15:54 PM Subject: Re: [Jprogramming] 'if' and 'else' operators the :. trick from Michal is cute. Here is how I would li

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Pascal Jasmin
a single adverb that can handle both m and u (noun/gerund and verb) parameters. - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Tuesday, February 4, 2014 9:43:18 AM Subject: Re: [Jprogramming] 'if' and 'else' operators if=: 2 :0   u"_`(v&

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Raul Miller
On Tue, Feb 4, 2014 at 11:14 AM, Michal Wallace wrote: > Sure! :) If it wasn't clear, I've actually implemented both versions > already, but I've only been doing > J for a few weeks, and kind of wanted some expert feedback. :) It was clear, but... I must admit that I jumped right into coding befo

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Raul Miller
Here's an implementation of your if/then/else variant: else=: 2 :0 |. u`v ) then=: 2 :0 n@.u"((1{n)`:6) ) if=: ] a =: assert a 4 1 0 2 4 -: if (<0:) then (*: else +:) i:2 a 4 1 0 2 4 -: (if (<0:) then (*: else +:)) i:2 a (if ] then (| else -.)) 1 1 0 0 1 0 1 0

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Michal Wallace
On Tue, Feb 4, 2014 at 8:43 AM, Raul Miller wrote: > if=: 2 :0 >u"_`(v"_) > ) > > else=: 2 :0 > v"_`(0{m)@.((1{m)`:6) > ) Wow, thanks! I had considered using a gerund but didn't realize I could use "_ to handle both nouns and verbs uniformly. Very cool. :) > Do you also want to see an impl

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Michal Wallace
On Tue, Feb 4, 2014 at 6:39 AM, Pascal Jasmin wrote: > When selecting among expressions you should look at @. for if. do. u else. v > , and ^:boolean for if. do.u else y > > I can think of syntactic sugar for if else as you put it to > verbs/expressions, but does it have to be parsed left to rig

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Raul Miller
if=: 2 :0 u"_`(v"_) ) else=: 2 :0 v"_`(0{m)@.((1{m)`:6) ) ('O' if (=0:) else ('<' if (<0:) else '>'))"0 i:5 Do you also want to see an implementation for your alternate proposal? Thanks, -- Raul On Tue, Feb 4, 2014 at 3:48 AM, Michal Wallace wrote: >('O' if (=0:) el

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Pascal Jasmin
;<'"_) if (0>])else ('>'"_) if (0<])"0 i:5 <<<<<0>>>>> - Original Message - From: Pascal Jasmin To: "programm...@jsoftware.com" Cc: Sent: Tuesday, February 4, 2014 7:39:32 AM Subject: Re:

Re: [Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Pascal Jasmin
for if else as you put it to verbs/expressions, but does it have to be parsed left to right to be readable? - Original Message - From: Michal Wallace To: programm...@jsoftware.com Cc: Sent: Tuesday, February 4, 2014 3:48:15 AM Subject: [Jprogramming] 'if' and 'else' o

[Jprogramming] 'if' and 'else' operators

2014-02-04 Thread Michal Wallace
('O' if (=0:) else ('<' if (<0:) else '>'))"0 i:5 There are nicer ways to make this output, but how would you code 'if' and 'else' above? Or... 'if'/'then'/'else' below, if you prefer? a =: assert a 4 1 0 2 4 -: if (<0:) then (*: else +:) i:2 a 4 1 0 2 4