coco icon indicating copy to clipboard operation
coco copied to clipboard

explicitly close implicit calls

Open aeosynth opened this issue 12 years ago • 21 comments

eg f a ^^ b -> f(a)(b). i'm not method chaining

currently, i have to write f(a) b, (f a) b

aeosynth avatar Mar 07 '13 21:03 aeosynth

we may use <| to reflect wirh |>

vendethiel avatar Mar 07 '13 21:03 vendethiel

Current paren-free (but ugly) solutions are:

  • f a .call null b
  • f a |>& b

use <|

How'd that help?

satyr avatar Mar 07 '13 22:03 satyr

a b <| c => a(b) c

vendethiel avatar Mar 07 '13 22:03 vendethiel

That's hardly a reverse of |>; doesn't make sense.

satyr avatar Mar 07 '13 22:03 satyr

indeed, we can't use $ etc

vendethiel avatar Mar 07 '13 22:03 vendethiel

F♯ you mean?

Another solution:

Function::$ = -> @apply null, arguments

f a .$ b

which imitates Haskell's $.

satyr avatar Mar 07 '13 22:03 satyr

Huh, that's neat.

michaelficarra avatar Mar 07 '13 22:03 michaelficarra

F♯ you mean?

thanks - had trouble remembering where it was from

which imitates Haskell's $.

indeed, but -- that's horrendously slow :/.

vendethiel avatar Mar 07 '13 22:03 vendethiel

And another:

Function::<<<_:~->@

f a ._ b

Workarounds aside, I guess we can add it if we can find an intuitive symbol for it. The proposed ^^ doesn't feel quite right.

satyr avatar Mar 08 '13 00:03 satyr

EDIT : removed the part where I'm dumb.

any suggest ?

vendethiel avatar Mar 08 '13 00:03 vendethiel

f a >< b

sort of looks like the middle parentheses of

( f a )( b )

if you squint.

qqueue avatar Mar 08 '13 03:03 qqueue

f a |>& b doesn't help if i want to store the final result:

$ coco -bce 'c = f a |>& b'
var x0$, c;
x0$ = c = f(a);
x0$(b);

not sure if this is a bug

aeosynth avatar Mar 08 '13 19:03 aeosynth

no, that's how refs work

vendethiel avatar Mar 08 '13 20:03 vendethiel

Why aren't we just stealing LiveScript's <|?

a b <| c

michaelficarra avatar Mar 08 '13 20:03 michaelficarra

That's hardly a reverse of |>; doesn't make sense.

vendethiel avatar Mar 08 '13 20:03 vendethiel

Sure, but does it have to be?

michaelficarra avatar Mar 08 '13 20:03 michaelficarra

does it have to be what?

vendethiel avatar Mar 08 '13 20:03 vendethiel

Functionally related to |>.

michaelficarra avatar Mar 08 '13 20:03 michaelficarra

variations: >|, |<

aeosynth avatar Mar 08 '13 20:03 aeosynth

Functionally related to |>.

No I agree and I'd +1 the <| but yeah |> is ref in coco

vendethiel avatar Mar 08 '13 20:03 vendethiel

f a >< b sort of looks like the middle parentheses of ( f a )( b )

Nice one. Easily extendable to an existential version: f a >?< b

satyr avatar Mar 09 '13 06:03 satyr