Arc Forumnew | comments | leaders | submit | mdemare's commentslogin

Did you mean to omit subseq in the last example?

-----

4 points by Xichekolas 6347 days ago | link

Yes, he did.

-----


Both. They use ranges, with have the inclusive (..) and the exclusive notation:

    "ruby"[0 .. -1] #=> "ruby"
    "ruby"[0 ... -1] #=> "rub"

-----

2 points by mdemare 6347 days ago | link | parent | on: Show us your Arc code

List monad in Arc:

    (def list-monad (seq . fns)
      (each f fns 
        (= seq (apply join (map f seq))))
        seq)

    (list-monad '(1 2 3 4 5) 
      [list (- _ 1) _] 
      [list (* 2 _) _])

-----

2 points by mdemare 6347 days ago | link | parent | on: Bug: Infinite Loop

see also: http://arclanguage.org/item?id=368

-----

1 point by mdemare 6347 days ago | link | parent | on: Arc and (slghtly broken) readline

Mmm, had no effect (on OSX). But apparently there's a darwinports mirror up again, so I'll try rlwrap.

-----

1 point by febeling 6347 days ago | link

I use OS X as well, 10.5.1, together with mzscheme 371.

-----

2 points by mdemare 6348 days ago | link | parent | on: Rubylike slice for strings and lists

I've also written my first macro!

    (mac ! (a b . body) (cons b (cons a body)))
It allows you to use a OO-syntax, with the receiver first, and the function name second:

    (! "0123test" slice 1)
I've aliased my slice function as "@", so now I can write:

    (! "hello world!!!" @ 0 -3)  ; => "hello world"

-----


Ascii-only support is explicitly in the release notes, and scares me. But I'm glad that utf-8 happens to work right now.

-----


I read his announcement and I completely disagree. Strings are pretty basic, and getting them right is part of the work of a language designer. They're more important than macros. Not getting strings right can cripple a language.

And to call not supporting unicode "offensive" is missing the point. Only supporting ascii makes the language less powerful. It means you can't use Arc for solving problems involving text manipulation in languages other than English. That's a big space. Only supporting UTF-8 would make more sense.

And for all the Java bashing nowadays, Java got Strings right, and Perl, Python, PHP and Ruby didn't.

-----

1 point by Elfan 6348 days ago | link

Java unicode support has historical been a mess too. They assumed that 16 bits would always and forever be enough for any code point. This was only "fixed" in 2004 and the warts are still there.

I suppose the lesson to take away is that just about every single language has messed up characters sets. It can't then be a fatal mistake but certainly isn't one that makes any sense to repeat.

-----


Ruby's unicode support is acceptable in 1.8, and good in 1.9. I'm not asking for the world, I just want string to be able to contain text in any encoding, and to be able to split a string into chars, given a encoding.

-----

1 point by immanuel 6348 days ago | link

I would like to use numbers in various encoding like reversed (bigendian on little endian machines and vice versa). I also want the language to natively support all these number encondings and to be able to add two numbers, given their encodings.

-----

2 points by mdemare 6348 days ago | link | parent | on: Improve your arc REPL

An installer for mzscheme would also be nice. Or just instructions about where to copy what.

And rlwrap is great, but any repl should have readline built-in.

Also, (quit) to exit is too cumbersome. ctrl-d doesn't work either. Apparently ctrl-c ctrl-d is the quickest solution.

-----