satyr / coco

Unfancy CoffeeScript
http://satyr.github.com/coco/
MIT License
498 stars 48 forks source link

explicitly close implicit calls #205

Open aeosynth opened 11 years ago

aeosynth commented 11 years ago

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

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

vendethiel commented 11 years ago

we may use <| to reflect wirh |>

satyr commented 11 years ago

Current paren-free (but ugly) solutions are:

use <|

How'd that help?

vendethiel commented 11 years ago

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

satyr commented 11 years ago

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

vendethiel commented 11 years ago

indeed, we can't use $ etc

satyr commented 11 years ago

F♯ you mean?

Another solution:

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

f a .$ b

which imitates Haskell's $.

michaelficarra commented 11 years ago

Huh, that's neat.

vendethiel commented 11 years ago

F♯ you mean?

thanks - had trouble remembering where it was from

which imitates Haskell's $.

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

satyr commented 11 years ago

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.

vendethiel commented 11 years ago

EDIT : removed the part where I'm dumb.

any suggest ?

qqueue commented 11 years ago
f a >< b

sort of looks like the middle parentheses of

( f a )( b )

if you squint.

aeosynth commented 11 years ago

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

vendethiel commented 11 years ago

no, that's how refs work

michaelficarra commented 11 years ago

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

a b <| c
vendethiel commented 11 years ago

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

michaelficarra commented 11 years ago

Sure, but does it have to be?

vendethiel commented 11 years ago

does it have to be what?

michaelficarra commented 11 years ago

Functionally related to |>.

aeosynth commented 11 years ago

variations: >|, |<

vendethiel commented 11 years ago

Functionally related to |>.

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

satyr commented 11 years ago

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