Arc Forumnew | comments | leaders | submitlogin
Stupid noob question
6 points by projectileboy 6159 days ago | 9 comments
How do I create a function whose only parameter is a single rest parameter? I would think this:

(def fun (. args) ; ...do stuff with args

...but this is illegal. Thanks for the help, and sorry for the noise.



8 points by pg 6159 days ago | link

(def fun args ...)

-----

2 points by offby1 6159 days ago | link

I have a vague notion that arc would be a good teaching language ... I wonder if anyone else thinks so.

-----

4 points by kens 6159 days ago | link

I think the lack of good debugging support eliminates the current version of Arc as a teaching language. DrScheme is probably a reasonable choice; it's built on MzScheme. http://www.plt-scheme.org/software/drscheme/

-----

1 point by kennytilton 6159 days ago | link

Do either of those support CL-style defmacro?

-----

1 point by Jekyll 6158 days ago | link

Dr Scheme does. Fire it up, click language then choose language. Pick "pretty big", then (define-macro ...) will do pretty much what you expect. http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-...

-----

1 point by mec 6158 days ago | link

Side question here, is there a keybinding anywhere in DrScheme to close all open parentheses? It's driving me crazy trying to find it.

-----

1 point by danielprager 6158 days ago | link

Dunno, but the '[' and ']' keys in DrScheme are clever enough to give you '(' and ')' when you need them (and '[' and ']' at other times).

Since discovering this I just keep tapping ']' until the highlighting tells me I'm done.

-----

1 point by ryantmulligan 6159 days ago | link

Nice. I don't know how this worked in other Lisps, but I like the consistency of how calls map to function definition signatures.

-----

2 points by mec 6159 days ago | link

Thanks for asking the newb question, I've been trying to figure it out too and just gave up and been using (fst . rest).

-----