Win a copy of Rust Web Development this week in the Other Languages forum!

Samuel Cox

Ranch Hand
+ Follow
since Nov 16, 2004
Samuel likes ...
Scala VI Editor Ubuntu
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Samuel Cox

Rahul Sudip Bose wrote:
What is the source of this information ?



Me!

Skepticism is good so feel free to exercise your google-fu on:

google python
twitter scala
linkedin scala

etc.
10 years ago

Rahul Sudip Bose wrote:
What about scala and python ? Any important/popular code written in those languages and the job-market ?



Python is used heavily at Google. I'd say that is a pretty good thumbs-up;)

I'm not sure if you count LinkedIn, Twitter and Foursquare as important, but they all use Scala substantially. I won't claim that there are a ton of jobs in Scala, but I think those indicate that 'popular' code has been written in Scala.

At my small company, one of our main products has a decent amount of Scala code.
10 years ago
Ok, I stand corrected.

Furthermore, I just had a colleague tell me that my def b() = i + 1 was not technically a closure; whereas, val b = () => i + 1 is.

Clearly, I have a lot to learn!

The good news is you can do a lot of good stuff with Scala without understanding these finer points. At least, that's my opinion.
10 years ago
I'm glad that I specified I was guessing:)

I think both constructs can classify as closures, since both are essentially creating functions that capture their surrounding scope.



http://jim-mcbeath.blogspot.com/2009/05/scala-functions-vs-methods.html has some info on it, but I don't think it is a 100% match to your question. You might try the mailing list if you can't get a satisfactory answer (but please come back;).
10 years ago
I don't think it matters. My guess is one is syntactic sugar for the other. I'll further guess def is the sugar...

I think most people use the def keyword to define functions unless they are anonymous.

Here are the anonymous function versions:




10 years ago
You might also be curious as to why using:



while



did not. The reason is because the former creates a function (no evaluation), whereas the latter tries to evaluate the function, pow(x, n/2), and assign the value to y. As Jesper pointed out, this evaluation causes the infinite loop. In the former, you are basically doing what you are trying to avoid, which is computing the same value twice. Scala is nice, but it's no Haskell;) Jesper's solution is what I was suggesting.

I don't know about breaking out of infinite loops. I CTRL-C and start over... If that kind of thing was happening a lot, I would put my Scala script in a file or do the normal app thing (def main...).
10 years ago
First, when you run 'scala' in your shell (Powershell), you are running Scala's REPL (interpreter). To exit it, just run 'exit' in the interpreter.


Regarding your question about a y variable, this sounds like homework, so I'll be general.
10 years ago

John Todd wrote:I think in order to be a much better Scala programmer, you have to play with Haskell for some time (which it is absolutely rewarding).



I totally agree. I think every programmer should try to get their minds around Haskell. If nothing else, they might be exposed to one of the best programming tutorials on the web (http://learnyouahaskell.com/). Personally, I have dabbled in Haskell (college, Euler problems and XMonad configuration).

I just meant that the Scala community needs to be mindful of the face it's putting forward. In the world of twitter, facebook, etc., it doesn't take much for people to go negative about any particular thing. Unfortunately, being associated with Haskell/Lisp/Lisp-derivatives/etc. might be viewed as a negative. At least for me, it's reality.
10 years ago
I have been using Scala at work for around 2 years now. While it has been a fairly decent uphill battle, I am fairly confident that Clojure would have been rejected without a thought. Of course, that doesn't mean Clojure is bad. I'm just giving you my guess about my work situation.

I think a big thing that could help Scala is that you can write code that looks a lot like Java. However, as I get more comfortable with Scala, the desire to do things more Scala-like grows;)

A big Scala complaint has been IDE tooling. From what I know, IntelliJ is pretty good, but many people want Eclipse. Supposedly, Scala's creator, Martin Odersky, has recently become personally involved with getting Scala and Eclipse to play nice. For me, I generally do not write Scala code in an IDE. I use Vim + Maven + SBT. However, I use Eclipse to debug Scala code. A co-worker does almost all his Scala development in IntelliJ.

One other thing, I am doing fairly straightforward work with Scala. A lot of times I see Scala mentioned, the conversations seem more Haskell-like than Java-like. I hope this doesn't turn people off to the fact that you can use Scala as Java + some nice control structures + closures, which are things most new languages seem to have.

10 years ago
I'm pretty sure your problem does not lie with Scala. To test this, run Scala's REPL and try to use Source.fromFile on files in the directory from which you started the REPL. I did this and the file loaded fine using relative paths.

If you don't know what the REPL is, you should read up on it. This is a very nice feature of Scala and many other languages.

Anyhow, I'm not sure how you are using Eclipse, but I think you need "test.txt" in the directory that serves as the base when running your application.
11 years ago
Of course, I'm not totally judging interest Scala based on this one forum. As I said, I have been using Scala for a while.

However, it seems pretty obvious to me that monitoring posts here (over a million total posts?) is a better indicator for interesting in JVM-related topics than asking my next door neighbors;)

Anyhow, I will assume the lack of Scala posts indicates that you typically don't need help if you use Scala;)
11 years ago

Garrett Rowe wrote:So how are you guys using Scala where you work?



Nothing real specific. It's just found a home in a C++/Java environment. I do use Scala's XML support quite a bit.

I've been given latitude to use Scala for implementing relatively small things that have Java interfaces.

I do most of my testing in the BDD style with scala-specs.
11 years ago
I hope that means using Scala doesn't require much help;)

I've been happily using Scala at work for the past year and a half. My only main complaint has been debugging in IDEs. I'm currently using Eclipse for this fairly happily, but have used Netbeans and IDEA as well.

Normally, I use forum activity as a measure of a utility's longevity. I must say that I wish there was more activity here...
11 years ago

Martijn Verburg wrote:Have you had a look at the Maven API docs/downloaded the source code? I'm not sure if the Maven team created an API set for this sort of usage...



Yes, I've been playing around with it. I haven't found what I'm looking for, but I'm not done going over it yet.

Thanks.
13 years ago
I'm working on a repository concept that is very similar to Maven's.

Of course, it would be nice if I could leverage Maven for this. Are there API's in Maven or elsewhere that can be used programmatically?

I want to do things like:



So far, I've just played with Maven's Wagon stuff.

Any pointers, links, etc. are appreciated.
13 years ago