Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My irrational preferences fall along the lines of Lisp, and I think Scheme has the right syntactic approach to mutation: Put a '!' on the end so that it's explicit, but don't make it syntactically a mess like Racket does where mutable lists have to be 'mcons-ed up step by step rather than made in one pass (not that there's anything wrong with writing a macro, it just means that there's an additional layer of misdirection when using mutation, and that's exactly the place where you don't want it.

Ordersky's Scala takes an approach similar to Racket in regard to type casting - purposely making the syntax a bit more cumbersome as a flag rather than...well flagging the action explicitly. That said, I like Scala's ML like features, and Ordersky opens Scala by Example [1] by illustrating the transition from imperative to functional style in a Scala implementation of quickSort.

Rust looks interesting. One of the big things though that I look for is an over-abundance of documentation and resources. I'm learning Scala because Ordersky teaches a course on Coursera and the decade of people writing about it in general and the fact that one could write about Scala and potentially make money doing it due to the size of the JVM market, means that the literature about the language isn't so much some necessary evil for people who like writing languages more than documenting them.

[1] http://www.scala-lang.org/docu/files/ScalaByExample.pdf



I'm not sure what you mean by "syntactically a mess" but Racket provides `mlist` which sounds like exactly what you want [1].

[1] http://docs.racket-lang.org/compatibility/mlists.html


Thanks. It's not linked from the Racket Reference. Clicking on "mutable lists" in 4.10 is a 'did you mean recursion?' experience.

http://docs.racket-lang.org/reference/mpairs.html?q=mcons#%2...

That it takes an intimacy with the code base of a regular repo contributor to find it suggests how deeply buried 'mlist is.Or to put it another way, Racket the language does not provide 'mlist. Racket the ecosystem does but deliberately makes it hard to use (by obfuscation) on the moral ground that mutating a list ought incur the pain of iterative 'mcons-ing...and it's associated pretty-print. .


For us that were around when the default changed from mutable to immutable cons cells, known the rule "just prepend an m". I agree that the link in section 4.10 can be improved - but calling it "obfuscation" and "deliberate" is taken it too far. File a bug report, and I bet it will be fixed.


'mcons is part of 'racket/base. 'mlist is part of a library that contains two layers of warnings, is not linked to by the Racket Guide or Racket reference and lives under the 90th of 96 links on the Documentation page. It's lower in the great chain of being than "Unstable May Change without Warning".

(cons 1 (cons 2 (cons 3 '()))) is commonly required in the Racket family of languages for purely pedagogical purposes. That it is the only pattern for 'mcons provided by 'racket is a deliberate statement of community values in regard to mutable lists.

In regards to filing a bug report, the bug is that there is mention of mutable lists and a hyper-link in the documentation for the Racket Language. Because mutable lists are not part of the language the bug fix is properly removing the reference - at least in so far as maintaining consistency with the rest of the documentation because other libraries are not cross linked from the Guide and Reference. Linking "mutable lists" to 'compatibility/mlist, would just replace one bug with another...unless leaving 'mlist out of 'racket/base was itself a bug. That that is the case, is unlikely.


> One of the big things though that I look for is an over-abundance of documentation and resources.

..... stay tuned.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: