Arc Forumnew | comments | leaders | submitlogin
([+ _ 10]:[* _ 20] 10) = error...
3 points by zitterbewegung 6029 days ago | 5 comments
arc> ([+ _ 10]:[* _ 20] 20) Error: "car: expects argument of type <pair>; given ()" arc> Shouldn't it return 210?


5 points by conanite 6029 days ago | link

it seems ssyntax only works on symbols (see http://arclanguage.org/item?id=6387 )

-----

1 point by PieSquared 6029 days ago | link

An unrelated question about the ':' syntax: does it really compose functions, or does it work with macros as well?

In other words, can I say

  (macro:function arguments)
or does it only work with functions?

-----

2 points by absz 6023 days ago | link

It's actually in-between:

  (f:g a b c)
becomes

  ((compose f g) a b c)
, which normally wouldn't work if f or g were a macro; however, compose is special-cased in ac.scm so that in the head of a list, this becomes

  (f (g a b c))
. Thus, : only works with macros at the head of a list. You can't do

  (f a b macro:function c)

.

-----

1 point by tokipin 6029 days ago | link

it works with macros as well, which makes for a convenient "modifier" syntax

example: http://arclanguage.com/item?id=4436

-----

1 point by almkglor 6028 days ago | link

The "ultimate" modifier being p-m:

http://arclanguage.org/item?id=2556

-----