This page is no longer maintained — Please continue to the home page at www.scala-lang.org

the ultimate scala cheat sheet

37 replies
H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.

hi community,

i felt the desire to put together a scala cheat sheet. the reason is
that even after two years, i still find new features/tricks which don't
seem to be clearly documented - they exist, but are scattered across the
internet. there is already a cheat sheet, but it only covers a fraction
of what i am imagining here. there are some examples on scala-lang, but
i had to read them several times since they are not very clear. there
are some good blogs, but again, you have to look for them. i believe
that having a single, well structured pdf will make people more
comfortable with scala if they are new, should make it easier to
convince heretics to believe in scala :) and take away the fear of the
unknown complexity.

it's probably going to be bigger than the usual cheat sheet so it's more
like a wallpaper, but splitting it up into subsections should help.
also, i want to focus on productivity boost features and keep it on a
level that a random java dev should be able to understand (i am thinking
about avoiding scary method signatures here and use java code as
examples of how this would look like in java or maybe other languages as
well)

send your findings/knowledge to me/this list :)
i'll collect them and put them together.

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

i didn't know i could change it directly. this cheat sheet will be
extended then :)

Am 21.12.2011 21:16, schrieb Daniel Sobral:
> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
> do contribute to it if you think there's things missing in it. You can
> contribute directly through this link:
> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...
>
> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath wrote:
>> hi community,
>>
>> i felt the desire to put together a scala cheat sheet. the reason is
>> that even after two years, i still find new features/tricks which don't
>> seem to be clearly documented - they exist, but are scattered across the
>> internet. there is already a cheat sheet, but it only covers a fraction
>> of what i am imagining here. there are some examples on scala-lang, but
>> i had to read them several times since they are not very clear. there
>> are some good blogs, but again, you have to look for them. i believe
>> that having a single, well structured pdf will make people more
>> comfortable with scala if they are new, should make it easier to
>> convince heretics to believe in scala :) and take away the fear of the
>> unknown complexity.
>>
>> it's probably going to be bigger than the usual cheat sheet so it's more
>> like a wallpaper, but splitting it up into subsections should help.
>> also, i want to focus on productivity boost features and keep it on a
>> level that a random java dev should be able to understand (i am thinking
>> about avoiding scary method signatures here and use java code as
>> examples of how this would look like in java or maybe other languages as
>> well)
>>
>> send your findings/knowledge to me/this list :)
>> i'll collect them and put them together.
>
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

On Wed, Dec 21, 2011 at 18:38, HamsterofDeath wrote:
> i didn't know i could change it directly. this cheat sheet will be
> extended then :)

The whole docs.scala-lang.org site was intended to be easily
contributed to. Well, almost all of it. :-)

>
> Am 21.12.2011 21:16, schrieb Daniel Sobral:
>> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
>> do contribute to it if you think there's things missing in it. You can
>> contribute directly through this link:
>> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...
>>
>> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath wrote:
>>> hi community,
>>>
>>> i felt the desire to put together a scala cheat sheet. the reason is
>>> that even after two years, i still find new features/tricks which don't
>>> seem to be clearly documented - they exist, but are scattered across the
>>> internet. there is already a cheat sheet, but it only covers a fraction
>>> of what i am imagining here. there are some examples on scala-lang, but
>>> i had to read them several times since they are not very clear. there
>>> are some good blogs, but again, you have to look for them. i believe
>>> that having a single, well structured pdf will make people more
>>> comfortable with scala if they are new, should make it easier to
>>> convince heretics to believe in scala :) and take away the fear of the
>>> unknown complexity.
>>>
>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>> like a wallpaper, but splitting it up into subsections should help.
>>> also, i want to focus on productivity boost features and keep it on a
>>> level that a random java dev should be able to understand (i am thinking
>>> about avoiding scary method signatures here and use java code as
>>> examples of how this would look like in java or maybe other languages as
>>> well)
>>>
>>> send your findings/knowledge to me/this list :)
>>> i'll collect them and put them together.
>>
>>
>

Som Snytt
Joined: 2011-09-19,
User offline. Last seen 42 years 45 weeks ago.
Re: the ultimate scala cheat sheet
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

On Wed, Dec 21, 2011 at 20:59, Som Snytt wrote:
> Thanks for the link!
>
> But for some reason, it starts with
> val x = 5
> instead of
> val 1 = 2

We assume "val 1 = 2" is so basic and obvious that no cheat on it is
required. ;-)

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
uNq5FGe4W0wXSA [at] mail [dot] gmail [dot] com" type="cite">Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" rel="nofollow">dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.


H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
4EF2D0DF [dot] 7050403 [at] gmx [dot] de" type="cite"> i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
uNq5FGe4W0wXSA [at] mail [dot] gmail [dot] com" type="cite">Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" rel="nofollow">dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.



Tomygun
Joined: 2008-11-27,
User offline. Last seen 3 years 48 weeks ago.
Re: the ultimate scala cheat sheet
Hi great work!

I wanted to report just a few typos I found:

def method(s:String)(s2:String) = s+" "+s2)

"=" means modify mutable collection xor assign new immutable collection to var

"comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)  // Should be just "" instead of "0".

class CoVariant[-A] // Should be ContraVariant

class having a contravariant type parameter, meaning val CoVariant[SubClass] = coVariantWithSuperclass compiles

On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star@gmx.de> wrote:
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.




H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
Am 24.12.2011 05:38, schrieb Tomás Lázaro:
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">Hi great work!

I wanted to report just a few typos I found:

def method(s:String)(s2:String) = s+" "+s2)

*check*

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
"=" means modify mutable collection xor assign new immutable collection to var

i really meant XOR since it cannot be both at the same time :). i'll rewrite it so it's clear to people not thinking like me.

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
"comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)  // Should be just "" instead of "0".

probably more clear that way, yes.

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
class CoVariant[-A] // Should be ContraVariant
*check*
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
class having a contravariant type parameter, meaning val CoVariant[SubClass] = coVariantWithSuperclass compiles

*check*
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" target="_blank" rel="nofollow">dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" target="_blank" rel="nofollow">h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.





H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
added some more stuff.
how many of you did know about

val List(head, rest@_*) = someList

?

in clojure i do this all the time and i had no idea i can do it in scala, too.

Am 24.12.2011 10:07, schrieb HamsterofDeath:
4EF5965C [dot] 9060901 [at] gmx [dot] de" type="cite"> Am 24.12.2011 05:38, schrieb Tomás Lázaro:
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">Hi great work!

I wanted to report just a few typos I found:

def method(s:String)(s2:String) = s+" "+s2)

*check*

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
"=" means modify mutable collection xor assign new immutable collection to var

i really meant XOR since it cannot be both at the same time :). i'll rewrite it so it's clear to people not thinking like me.

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
"comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)  // Should be just "" instead of "0".

probably more clear that way, yes.

0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
class CoVariant[-A] // Should be ContraVariant
*check*
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
class having a contravariant type parameter, meaning val CoVariant[SubClass] = coVariantWithSuperclass compiles

*check*
0Fosz0c3ewR5xdWEj-TW3ZQZFiRvcYburTws02w [at] mail [dot] gmail [dot] com" type="cite">
On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" target="_blank" rel="nofollow">dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" target="_blank" rel="nofollow">h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.






Alec Zorab
Joined: 2010-05-18,
User offline. Last seen 42 years 45 weeks ago.
Re: the ultimate scala cheat sheet

I didn't know you could do that (and don't have the repl to hand to
check) but is that not just a more complicated way of writing

val hd :: tl = someList

?

On 24 December 2011 12:11, HamsterofDeath wrote:
> added some more stuff.
> how many of you did know about
>
> val List(head, rest@_*) = someList
>
> ?
>
> in clojure i do this all the time and i had no idea i can do it in scala,
> too.
>
> Am 24.12.2011 10:07, schrieb HamsterofDeath:
>
> Am 24.12.2011 05:38, schrieb Tomás Lázaro:
>
> Hi great work!
>
> I wanted to report just a few typos I found:
>
> def method(s:String)(s2:String) = s+" "+s2)
>
>
> *check*
>
>
> "=" means modify mutable collection xor assign new immutable collection to
> var
>
>
> i really meant XOR since it cannot be both at the same time :). i'll rewrite
> it so it's clear to people not thinking like me.
>
>
> "comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)
> // Should be just "" instead of "0".
>
>
> probably more clear that way, yes.
>
>
> class CoVariant[-A] // Should be ContraVariant
>
> *check*
>
>
> class having a contravariant type parameter, meaning val CoVariant[SubClass]
> = coVariantWithSuperclass compiles
>
>
> *check*
>
>
> On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath wrote:
>>
>> what i got so far
>>
>>
>> https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsh...
>>
>> if you find an error, report it to me.
>> todos:
>> option
>> tuples
>> pattern matching, apply, unapply
>> objects, companion objects
>> abstract types
>> implicit conversions
>>
>>
>>
>>
>> Am 22.12.2011 07:40, schrieb HamsterofDeath:
>>
>> i'll put that right at the top. what about val 1 = "hello number"?
>>
>> Am 21.12.2011 23:59, schrieb Som Snytt:
>>
>> Thanks for the link!
>>
>> But for some reason, it starts with
>> val x = 5
>> instead of
>> val 1 = 2
>>
>> :)
>>
>> On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral
>> wrote:
>>>
>>> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
>>> do contribute to it if you think there's things missing in it. You can
>>> contribute directly through this link:
>>>
>>> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...
>>>
>>> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath wrote:
>>> > hi community,
>>> >
>>> > i felt the desire to put together a scala cheat sheet. the reason is
>>> > that even after two years, i still find new features/tricks which don't
>>> > seem to be clearly documented - they exist, but are scattered across
>>> > the
>>> > internet. there is already a cheat sheet, but it only covers a fraction
>>> > of what i am imagining here. there are some examples on scala-lang, but
>>> > i had to read them several times since they are not very clear. there
>>> > are some good blogs, but again, you have to look for them. i believe
>>> > that having a single, well structured pdf will make people more
>>> > comfortable with scala if they are new, should make it easier to
>>> > convince heretics to believe in scala :) and take away the fear of the
>>> > unknown complexity.
>>> >
>>> > it's probably going to be bigger than the usual cheat sheet so it's
>>> > more
>>> > like a wallpaper, but splitting it up into subsections should help.
>>> > also, i want to focus on productivity boost features and keep it on a
>>> > level that a random java dev should be able to understand (i am
>>> > thinking
>>> > about avoiding scary method signatures here and use java code as
>>> > examples of how this would look like in java or maybe other languages
>>> > as
>>> > well)
>>> >
>>> > send your findings/knowledge to me/this list :)
>>> > i'll collect them and put them together.
>>>
>>>
>>>
>>> --
>>> Daniel C. Sobral
>>>
>>> I travel to the future all the time.
>>
>>
>>
>>
>
>
>

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

in that special case, a :: tl is simpler, yes.

but:

val List(_, a,b,_,tl@_*) = ... // discard the head and 4th element
val Vector(...) = ..... // works also on other collection types

both not possible the :: way

Am 24.12.2011 14:37, schrieb Alec Zorab:
> I didn't know you could do that (and don't have the repl to hand to
> check) but is that not just a more complicated way of writing
>
> val hd :: tl = someList
>
> ?
>
> On 24 December 2011 12:11, HamsterofDeath wrote:
>> added some more stuff.
>> how many of you did know about
>>
>> val List(head, rest@_*) = someList
>>
>> ?
>>
>> in clojure i do this all the time and i had no idea i can do it in scala,
>> too.
>>
>> Am 24.12.2011 10:07, schrieb HamsterofDeath:
>>
>> Am 24.12.2011 05:38, schrieb Tomás Lázaro:
>>
>> Hi great work!
>>
>> I wanted to report just a few typos I found:
>>
>> def method(s:String)(s2:String) = s+" "+s2)
>>
>>
>> *check*
>>
>>
>> "=" means modify mutable collection xor assign new immutable collection to
>> var
>>
>>
>> i really meant XOR since it cannot be both at the same time :). i'll rewrite
>> it so it's clear to people not thinking like me.
>>
>>
>> "comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)
>> // Should be just "" instead of "0".
>>
>>
>> probably more clear that way, yes.
>>
>>
>> class CoVariant[-A] // Should be ContraVariant
>>
>> *check*
>>
>>
>> class having a contravariant type parameter, meaning val CoVariant[SubClass]
>> = coVariantWithSuperclass compiles
>>
>>
>> *check*
>>
>>
>> On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath wrote:
>>> what i got so far
>>>
>>>
>>> https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsh...
>>>
>>> if you find an error, report it to me.
>>> todos:
>>> option
>>> tuples
>>> pattern matching, apply, unapply
>>> objects, companion objects
>>> abstract types
>>> implicit conversions
>>>
>>>
>>>
>>>
>>> Am 22.12.2011 07:40, schrieb HamsterofDeath:
>>>
>>> i'll put that right at the top. what about val 1 = "hello number"?
>>>
>>> Am 21.12.2011 23:59, schrieb Som Snytt:
>>>
>>> Thanks for the link!
>>>
>>> But for some reason, it starts with
>>> val x = 5
>>> instead of
>>> val 1 = 2
>>>
>>> :)
>>>
>>> On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral
>>> wrote:
>>>> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
>>>> do contribute to it if you think there's things missing in it. You can
>>>> contribute directly through this link:
>>>>
>>>> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...
>>>>
>>>> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath wrote:
>>>>> hi community,
>>>>>
>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>> that even after two years, i still find new features/tricks which don't
>>>>> seem to be clearly documented - they exist, but are scattered across
>>>>> the
>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>> i had to read them several times since they are not very clear. there
>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>> that having a single, well structured pdf will make people more
>>>>> comfortable with scala if they are new, should make it easier to
>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>> unknown complexity.
>>>>>
>>>>> it's probably going to be bigger than the usual cheat sheet so it's
>>>>> more
>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>> level that a random java dev should be able to understand (i am
>>>>> thinking
>>>>> about avoiding scary method signatures here and use java code as
>>>>> examples of how this would look like in java or maybe other languages
>>>>> as
>>>>> well)
>>>>>
>>>>> send your findings/knowledge to me/this list :)
>>>>> i'll collect them and put them together.
>>>>
>>>>
>>>> --
>>>> Daniel C. Sobral
>>>>
>>>> I travel to the future all the time.
>>>
>>>
>>>
>>
>>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet
On Sat, Dec 24, 2011 at 11:58, HamsterofDeath <h-star@gmx.de> wrote:
in that special case, a :: tl is simpler, yes.

but:

val List(_, a,b,_,tl@_*) = ... // discard the head and 4th element

var _ :: a :: b :: _ :: tl = ... 
val Vector(...) = ..... // works also on other collection types

both not possible the :: way

Well, one out of two is not bad. And, by the way, I did know it. :-)
Speaking of "a xor b", write it "either a or b".  

Am 24.12.2011 14:37, schrieb Alec Zorab:
> I didn't know you could do that (and don't have the repl to hand to
> check) but is that not just a more complicated way of writing
>
> val hd :: tl = someList
>
> ?
>
> On 24 December 2011 12:11, HamsterofDeath <h-star@gmx.de> wrote:
>> added some more stuff.
>> how many of you did know about
>>
>> val List(head, rest@_*) = someList
>>
>> ?
>>
>> in clojure i do this all the time and i had no idea i can do it in scala,
>> too.
>>
>> Am 24.12.2011 10:07, schrieb HamsterofDeath:
>>
>> Am 24.12.2011 05:38, schrieb Tomás Lázaro:
>>
>> Hi great work!
>>
>> I wanted to report just a few typos I found:
>>
>> def method(s:String)(s2:String) = s+" "+s2)
>>
>>
>> *check*
>>
>>
>> "=" means modify mutable collection xor assign new immutable collection to
>> var
>>
>>
>> i really meant XOR since it cannot be both at the same time :). i'll rewrite
>> it so it's clear to people not thinking like me.
>>
>>
>> "comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)
>> // Should be just "" instead of "0".
>>
>>
>> probably more clear that way, yes.
>>
>>
>> class CoVariant[-A] // Should be ContraVariant
>>
>> *check*
>>
>>
>> class having a contravariant type parameter, meaning val CoVariant[SubClass]
>> = coVariantWithSuperclass compiles
>>
>>
>> *check*
>>
>>
>> On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star@gmx.de> wrote:
>>> what i got so far
>>>
>>>
>>> https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md
>>>
>>> if you find an error, report it to me.
>>> todos:
>>> option
>>> tuples
>>> pattern matching, apply, unapply
>>> objects, companion objects
>>> abstract types
>>> implicit conversions
>>>
>>>
>>>
>>>
>>> Am 22.12.2011 07:40, schrieb HamsterofDeath:
>>>
>>> i'll put that right at the top. what about val 1 = "hello number"?
>>>
>>> Am 21.12.2011 23:59, schrieb Som Snytt:
>>>
>>> Thanks for the link!
>>>
>>> But for some reason, it starts with
>>> val x = 5
>>> instead of
>>> val 1 = 2
>>>
>>> :)
>>>
>>> On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral@gmail.com>
>>> wrote:
>>>> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
>>>> do contribute to it if you think there's things missing in it. You can
>>>> contribute directly through this link:
>>>>
>>>> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md
>>>>
>>>> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star@gmx.de> wrote:
>>>>> hi community,
>>>>>
>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>> that even after two years, i still find new features/tricks which don't
>>>>> seem to be clearly documented - they exist, but are scattered across
>>>>> the
>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>> i had to read them several times since they are not very clear. there
>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>> that having a single, well structured pdf will make people more
>>>>> comfortable with scala if they are new, should make it easier to
>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>> unknown complexity.
>>>>>
>>>>> it's probably going to be bigger than the usual cheat sheet so it's
>>>>> more
>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>> level that a random java dev should be able to understand (i am
>>>>> thinking
>>>>> about avoiding scary method signatures here and use java code as
>>>>> examples of how this would look like in java or maybe other languages
>>>>> as
>>>>> well)
>>>>>
>>>>> send your findings/knowledge to me/this list :)
>>>>> i'll collect them and put them together.
>>>>
>>>>
>>>> --
>>>> Daniel C. Sobral
>>>>
>>>> I travel to the future all the time.
>>>
>>>
>>>
>>
>>




--
Daniel C. Sobral

I travel to the future all the time.
H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
i'm going to polish the sheet once more - after my cheat sheet blindness has healed - to eliminate typos, errors and add missing stuff if i notice anything, but i think i got pretty much everything covered. take a look.

Am 24.12.2011 21:14, schrieb Daniel Sobral:
v0w3fpwFjbAFGc95Fot2nT5Uvodyg+6uoTHgK-Enmw [at] mail [dot] gmail [dot] com" type="cite"> On Sat, Dec 24, 2011 at 11:58, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
in that special case, a :: tl is simpler, yes.

but:

val List(_, a,b,_,tl@_*) = ... // discard the head and 4th element

var _ :: a :: b :: _ :: tl = ...
even this works: val _ :: _ = List(1,2)
i'll mention it in the "obvious" section right after val 1 = 2


v0w3fpwFjbAFGc95Fot2nT5Uvodyg+6uoTHgK-Enmw [at] mail [dot] gmail [dot] com" type="cite">  
val Vector(...) = ..... // works also on other collection types

both not possible the :: way

Well, one out of two is not bad. And, by the way, I did know it. :-)



v0w3fpwFjbAFGc95Fot2nT5Uvodyg+6uoTHgK-Enmw [at] mail [dot] gmail [dot] com" type="cite">
Speaking of "a xor b", write it "either a or b".  

Am 24.12.2011 14:37, schrieb Alec Zorab:
> I didn't know you could do that (and don't have the repl to hand to
> check) but is that not just a more complicated way of writing
>
> val hd :: tl = someList
>
> ?
>
> On 24 December 2011 12:11, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
>> added some more stuff.
>> how many of you did know about
>>
>> val List(head, rest@_*) = someList
>>
>> ?
>>
>> in clojure i do this all the time and i had no idea i can do it in scala,
>> too.
>>
>> Am 24.12.2011 10:07, schrieb HamsterofDeath:
>>
>> Am 24.12.2011 05:38, schrieb Tomás Lázaro:
>>
>> Hi great work!
>>
>> I wanted to report just a few typos I found:
>>
>> def method(s:String)(s2:String) = s+" "+s2)
>>
>>
>> *check*
>>
>>
>> "=" means modify mutable collection xor assign new immutable collection to
>> var
>>
>>
>> i really meant XOR since it cannot be both at the same time :). i'll rewrite
>> it so it's clear to people not thinking like me.
>>
>>
>> "comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)
>> // Should be just "" instead of "0".
>>
>>
>> probably more clear that way, yes.
>>
>>
>> class CoVariant[-A] // Should be ContraVariant
>>
>> *check*
>>
>>
>> class having a contravariant type parameter, meaning val CoVariant[SubClass]
>> = coVariantWithSuperclass compiles
>>
>>
>> *check*
>>
>>
>> On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
>>> what i got so far
>>>
>>>
>>> https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md
>>>
>>> if you find an error, report it to me.
>>> todos:
>>> option
>>> tuples
>>> pattern matching, apply, unapply
>>> objects, companion objects
>>> abstract types
>>> implicit conversions
>>>
>>>
>>>
>>>
>>> Am 22.12.2011 07:40, schrieb HamsterofDeath:
>>>
>>> i'll put that right at the top. what about val 1 = "hello number"?
>>>
>>> Am 21.12.2011 23:59, schrieb Som Snytt:
>>>
>>> Thanks for the link!
>>>
>>> But for some reason, it starts with
>>> val x = 5
>>> instead of
>>> val 1 = 2
>>>
>>> :)
>>>
>>> On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" rel="nofollow">dcsobral@gmail.com>
>>> wrote:
>>>> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
>>>> do contribute to it if you think there's things missing in it. You can
>>>> contribute directly through this link:
>>>>
>>>> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md
>>>>
>>>> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
>>>>> hi community,
>>>>>
>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>> that even after two years, i still find new features/tricks which don't
>>>>> seem to be clearly documented - they exist, but are scattered across
>>>>> the
>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>> i had to read them several times since they are not very clear. there
>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>> that having a single, well structured pdf will make people more
>>>>> comfortable with scala if they are new, should make it easier to
>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>> unknown complexity.
>>>>>
>>>>> it's probably going to be bigger than the usual cheat sheet so it's
>>>>> more
>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>> level that a random java dev should be able to understand (i am
>>>>> thinking
>>>>> about avoiding scary method signatures here and use java code as
>>>>> examples of how this would look like in java or maybe other languages
>>>>> as
>>>>> well)
>>>>>
>>>>> send your findings/knowledge to me/this list :)
>>>>> i'll collect them and put them together.
>>>>
>>>>
>>>> --
>>>> Daniel C. Sobral
>>>>
>>>> I travel to the future all the time.
>>>
>>>
>>>
>>
>>




--
Daniel C. Sobral

I travel to the future all the time.

Sophie
Joined: 2011-11-10,
User offline. Last seen 42 years 45 weeks ago.
Re: the ultimate scala cheat sheet

On 2011-12-21 16:59:14 -0600, Som Snytt said:

> Thanks for the link!
>
> But for some reason, it starts with
> val x = 5
> instead of
> val 1 = 2

OK, I'll ask. What does

val 1 = 2
do? or mean?

>
> :)
>
> On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral
> wrote:
> You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
> do contribute to it if you think there's things missing in it. You can
> contribute directly through this link:
> https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/inde...
>
> On Wed, Dec 21, 2011 at 18:02, HamsterofDeath
> wrote:
> > hi community,
> >
> > i felt the desire to put together a scala cheat sheet. the reason is
> > that even after two years, i still find new features/tricks which don't
> > seem to be clearly documented - they exist, but are scattered across the
> > internet. there is already a cheat sheet, but it only covers a fraction
> > of what i am imagining here. there are some examples on scala-lang, but
> > i had to read them several times since they are not very clear. there
> > are some good blogs, but again, you have to look for them. i believe
> > that having a single, well structured pdf will make people more
> > comfortable with scala if they are new, should make it easier to
> > convince heretics to believe in scala :) and take away the fear of the
> > unknown complexity.
> >
> > it's probably going to be bigger than the usual cheat sheet so it's more
> > like a wallpaper, but splitting it up into subsections should help.
> > also, i want to focus on productivity boost features and keep it on a
> > level that a random java dev should be able to understand (i am thinking
> > about avoiding scary method signatures here and use java code as
> > examples of how this would look like in java or maybe other languages as
> > well)
> >
> > send your findings/knowledge to me/this list :)
> > i'll collect them and put them together.
>
>
>
> --
> Daniel C. Sobral
>
> I travel to the future all the time.

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: the ultimate scala cheat sheet

More importantly you can do this for any sequence not just lists.

case Seq(head, tail @_*) => ....

On Dec 24, 2011 7:11 AM, "HamsterofDeath" <h-star@gmx.de> wrote:
added some more stuff.
how many of you did know about

val List(head, rest@_*) = someList

?

in clojure i do this all the time and i had no idea i can do it in scala, too.

Am 24.12.2011 10:07, schrieb HamsterofDeath:
Am 24.12.2011 05:38, schrieb Tomás Lázaro:
Hi great work!

I wanted to report just a few typos I found:

def method(s:String)(s2:String) = s+" "+s2)

*check*


"=" means modify mutable collection xor assign new immutable collection to var

i really meant XOR since it cannot be both at the same time :). i'll rewrite it so it's clear to people not thinking like me.


"comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)  // Should be just "" instead of "0".

probably more clear that way, yes.


class CoVariant[-A] // Should be ContraVariant
*check*

class having a contravariant type parameter, meaning val CoVariant[SubClass] = coVariantWithSuperclass compiles

*check*

On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star@gmx.de> wrote:
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.






ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: Re: the ultimate scala cheat sheet


On Mon, Dec 26, 2011 at 10:57 AM, Sophie <itsme213@hotmail.com> wrote:
On 2011-12-21 16:59:14 -0600, Som Snytt said:

Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

OK, I'll ask. What does

       val 1 = 2
do? or mean?

It does nothing, but it is a degenerate case of a pattern match.  If you have

  val (a,1) = ("hi",1)

you assign "hi" to the variable a (via pattern matching); if you

  val (a,1) = ("hi",2)

then you get a MatchError (because 1 does not match 2).  However, when there are no variables to match, Scala accepts the match syntax _but doesn't check the values_, so

  val (1,2) = (1,3)

and even

  val 1 = 2

silently do nothing instead of throwing a MatchError.  Personally, I'd have changed the behavior so that variable-free matches still get tested, but for now this is the way it works.

  --Rex

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
i mentioned it somewhere before you did :p
but i only succeeded if the matched sequence had the same type as the one in the case. other than toList anything, is there a more general way to match?

Am 26.12.2011 17:17, schrieb Josh Suereth:
CAFLqJky1R5QMktDn8q67pbZ_3WURxnVUuTGN3V0BSTF6W2f3gg [at] mail [dot] gmail [dot] com" type="cite">

More importantly you can do this for any sequence not just lists.

case Seq(head, tail @_*) => ....

On Dec 24, 2011 7:11 AM, "HamsterofDeath" <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
added some more stuff.
how many of you did know about

val List(head, rest@_*) = someList

?

in clojure i do this all the time and i had no idea i can do it in scala, too.

Am 24.12.2011 10:07, schrieb HamsterofDeath:
Am 24.12.2011 05:38, schrieb Tomás Lázaro:
Hi great work!

I wanted to report just a few typos I found:

def method(s:String)(s2:String) = s+" "+s2)

*check*


"=" means modify mutable collection xor assign new immutable collection to var

i really meant XOR since it cannot be both at the same time :). i'll rewrite it so it's clear to people not thinking like me.


"comma separated numbers: " + List(1, 2, 3, 4, 5).fold("0")(_ + ", " + _)  // Should be just "" instead of "0".

probably more clear that way, yes.


class CoVariant[-A] // Should be ContraVariant
*check*

class having a contravariant type parameter, meaning val CoVariant[SubClass] = coVariantWithSuperclass compiles

*check*

On Fri, Dec 23, 2011 at 6:36 PM, HamsterofDeath <h-star [at] gmx [dot] de" target="_blank" rel="nofollow">h-star@gmx.de> wrote:
what i got so far

https://github.com/HamsterofDeath/scala.github.com/blob/gh-pages/cheatsheets/index.md

if you find an error, report it to me.
todos:
option
tuples
pattern matching, apply, unapply
objects, companion objects
abstract types
implicit conversions




Am 22.12.2011 07:40, schrieb HamsterofDeath:
i'll put that right at the top. what about val 1 = "hello number"?

Am 21.12.2011 23:59, schrieb Som Snytt:
Thanks for the link!

But for some reason, it starts with
val x = 5
instead of
val 1 = 2

:)

On Wed, Dec 21, 2011 at 12:16 PM, Daniel Sobral <dcsobral [at] gmail [dot] com" target="_blank" rel="nofollow">dcsobral@gmail.com> wrote:
You do know http://docs.scala-lang.org/cheatsheets/, I assume? Please,
do contribute to it if you think there's things missing in it. You can
contribute directly through this link:
https://github.com/scala/scala.github.com/blob/gh-pages/cheatsheets/index.md

On Wed, Dec 21, 2011 at 18:02, HamsterofDeath <h-star [at] gmx [dot] de" target="_blank" rel="nofollow">h-star@gmx.de> wrote:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.



--
Daniel C. Sobral

I travel to the future all the time.







H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

hi again,

i am stuck. i was told to compile my stuff and take a look at the result
before creating a pull request. i followed the instructions, but i get
this error message:

S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
iconv will be deprecated in the future, use String#encode in
stead.
Configuration from
S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
-> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
_site
C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
parse YAML at line 3 column 20 (Psych::SyntaxError)
from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
`read_yaml'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
`initialize'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
`new'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
`block in read_directories'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
`each'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
`read_directories'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
`block in read_directories'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
`each'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
`read_directories'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
`read'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
`process'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
`'
from C:/Ruby193/bin/jekyll:19:in `load'
from C:/Ruby193/bin/jekyll:19:in `'

my experience considering ruby, YAML, jekyll or whatever i'm doing there
is zero. i just blindly followed some readme. how can i fix this?

Am 21.12.2011 21:02, schrieb HamsterofDeath:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

Did you check if it didn't start up anyway? Whenever I run it, I get
tons of error messages, but it still starts up and it still serves the
pages fine.

On Sat, Jan 7, 2012 at 11:19, HamsterofDeath wrote:
> hi again,
>
> i am stuck. i was told to compile my stuff and take a look at the result
> before creating a pull request. i followed the instructions, but i get
> this error message:
>
> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
> iconv will be deprecated in the future, use String#encode in
> stead.
> Configuration from
> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
> _site
> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
> parse YAML at line 3 column 20 (Psych::SyntaxError)
>        from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>        from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>        from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
> `read_yaml'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
> `initialize'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
> `new'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
> `block in read_directories'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `each'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `read_directories'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
> `block in read_directories'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `each'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `read_directories'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
> `read'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
> `process'
>        from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
> `'
>        from C:/Ruby193/bin/jekyll:19:in `load'
>        from C:/Ruby193/bin/jekyll:19:in `'
>
> my experience considering ruby, YAML, jekyll or whatever i'm doing there
> is zero. i just blindly followed some readme. how can i fix this?
>
> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>> hi community,
>>
>> i felt the desire to put together a scala cheat sheet. the reason is
>> that even after two years, i still find new features/tricks which don't
>> seem to be clearly documented - they exist, but are scattered across the
>> internet. there is already a cheat sheet, but it only covers a fraction
>> of what i am imagining here. there are some examples on scala-lang, but
>> i had to read them several times since they are not very clear. there
>> are some good blogs, but again, you have to look for them. i believe
>> that having a single, well structured pdf will make people more
>> comfortable with scala if they are new, should make it easier to
>> convince heretics to believe in scala :) and take away the fear of the
>> unknown complexity.
>>
>> it's probably going to be bigger than the usual cheat sheet so it's more
>> like a wallpaper, but splitting it up into subsections should help.
>> also, i want to focus on productivity boost features and keep it on a
>> level that a random java dev should be able to understand (i am thinking
>> about avoiding scary method signatures here and use java code as
>> examples of how this would look like in java or maybe other languages as
>> well)
>>
>> send your findings/knowledge to me/this list :)
>> i'll collect them and put them together.
>>
>

heathermiller
Joined: 2011-04-27,
User offline. Last seen 22 weeks 12 hours ago.
Re: the ultimate scala cheat sheet

Hi,

> i am stuck. i was told to compile my stuff and take a look at the result
> before creating a pull request.

Very very very sound advice :)

> i followed the instructions, but i get
> this error message:

I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.

Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.

Cheers,
Heather

> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
> iconv will be deprecated in the future, use String#encode in
> stead.
> Configuration from
> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
> _site
> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
> parse YAML at line 3 column 20 (Psych::SyntaxError)
> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
> `read_yaml'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
> `initialize'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
> `new'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
> `block in read_directories'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `each'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `read_directories'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
> `block in read_directories'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `each'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
> `read_directories'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
> `read'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
> `process'
> from
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
> `'
> from C:/Ruby193/bin/jekyll:19:in `load'
> from C:/Ruby193/bin/jekyll:19:in `'
>
> my experience considering ruby, YAML, jekyll or whatever i'm doing there
> is zero. i just blindly followed some readme. how can i fix this?
>
> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>> hi community,
>>
>> i felt the desire to put together a scala cheat sheet. the reason is
>> that even after two years, i still find new features/tricks which don't
>> seem to be clearly documented - they exist, but are scattered across the
>> internet. there is already a cheat sheet, but it only covers a fraction
>> of what i am imagining here. there are some examples on scala-lang, but
>> i had to read them several times since they are not very clear. there
>> are some good blogs, but again, you have to look for them. i believe
>> that having a single, well structured pdf will make people more
>> comfortable with scala if they are new, should make it easier to
>> convince heretics to believe in scala :) and take away the fear of the
>> unknown complexity.
>>
>> it's probably going to be bigger than the usual cheat sheet so it's more
>> like a wallpaper, but splitting it up into subsections should help.
>> also, i want to focus on productivity boost features and keep it on a
>> level that a random java dev should be able to understand (i am thinking
>> about avoiding scary method signatures here and use java code as
>> examples of how this would look like in java or maybe other languages as
>> well)
>>
>> send your findings/knowledge to me/this list :)
>> i'll collect them and put them together.
>>
>

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

no, didn't start

Am 07.01.2012 22:20, schrieb Daniel Sobral:
> Did you check if it didn't start up anyway? Whenever I run it, I get
> tons of error messages, but it still starts up and it still serves the
> pages fine.
>
> On Sat, Jan 7, 2012 at 11:19, HamsterofDeath wrote:
>> hi again,
>>
>> i am stuck. i was told to compile my stuff and take a look at the result
>> before creating a pull request. i followed the instructions, but i get
>> this error message:
>>
>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>> iconv will be deprecated in the future, use String#encode in
>> stead.
>> Configuration from
>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>> _site
>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>> `read_yaml'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>> `initialize'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>> `new'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>> `block in read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `each'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>> `block in read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `each'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>> `read'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>> `process'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>> `'
>> from C:/Ruby193/bin/jekyll:19:in `load'
>> from C:/Ruby193/bin/jekyll:19:in `'
>>
>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>> is zero. i just blindly followed some readme. how can i fix this?
>>
>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>> hi community,
>>>
>>> i felt the desire to put together a scala cheat sheet. the reason is
>>> that even after two years, i still find new features/tricks which don't
>>> seem to be clearly documented - they exist, but are scattered across the
>>> internet. there is already a cheat sheet, but it only covers a fraction
>>> of what i am imagining here. there are some examples on scala-lang, but
>>> i had to read them several times since they are not very clear. there
>>> are some good blogs, but again, you have to look for them. i believe
>>> that having a single, well structured pdf will make people more
>>> comfortable with scala if they are new, should make it easier to
>>> convince heretics to believe in scala :) and take away the fear of the
>>> unknown complexity.
>>>
>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>> like a wallpaper, but splitting it up into subsections should help.
>>> also, i want to focus on productivity boost features and keep it on a
>>> level that a random java dev should be able to understand (i am thinking
>>> about avoiding scary method signatures here and use java code as
>>> examples of how this would look like in java or maybe other languages as
>>> well)
>>>
>>> send your findings/knowledge to me/this list :)
>>> i'll collect them and put them together.
>>>
>
>

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

Am 07.01.2012 23:03, schrieb Miller Heather:
> Hi,
>
>> i am stuck. i was told to compile my stuff and take a look at the result
>> before creating a pull request.
> Very very very sound advice :)
>
>> i followed the instructions, but i get
>> this error message:
> I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.

why don't i see any errors when previewing my page online?
>
> Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.
what's the difference between a clean pull request and a "normal" one?

>
> Cheers,
> Heather
>
>
>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>> iconv will be deprecated in the future, use String#encode in
>> stead.
>> Configuration from
>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>> _site
>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>> `read_yaml'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>> `initialize'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>> `new'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>> `block in read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `each'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>> `block in read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `each'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>> `read_directories'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>> `read'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>> `process'
>> from
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>> `'
>> from C:/Ruby193/bin/jekyll:19:in `load'
>> from C:/Ruby193/bin/jekyll:19:in `'
>>
>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>> is zero. i just blindly followed some readme. how can i fix this?
>>
>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>> hi community,
>>>
>>> i felt the desire to put together a scala cheat sheet. the reason is
>>> that even after two years, i still find new features/tricks which don't
>>> seem to be clearly documented - they exist, but are scattered across the
>>> internet. there is already a cheat sheet, but it only covers a fraction
>>> of what i am imagining here. there are some examples on scala-lang, but
>>> i had to read them several times since they are not very clear. there
>>> are some good blogs, but again, you have to look for them. i believe
>>> that having a single, well structured pdf will make people more
>>> comfortable with scala if they are new, should make it easier to
>>> convince heretics to believe in scala :) and take away the fear of the
>>> unknown complexity.
>>>
>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>> like a wallpaper, but splitting it up into subsections should help.
>>> also, i want to focus on productivity boost features and keep it on a
>>> level that a random java dev should be able to understand (i am thinking
>>> about avoiding scary method signatures here and use java code as
>>> examples of how this would look like in java or maybe other languages as
>>> well)
>>>
>>> send your findings/knowledge to me/this list :)
>>> i'll collect them and put them together.
>>>
>

heathermiller
Joined: 2011-04-27,
User offline. Last seen 22 weeks 12 hours ago.
Re: the ultimate scala cheat sheet

On Jan 7, 2012, at 11:15 PM, HamsterofDeath wrote:

> Am 07.01.2012 23:03, schrieb Miller Heather:
>> Hi,
>>
>>> i am stuck. i was told to compile my stuff and take a look at the result
>>> before creating a pull request.
>> Very very very sound advice :)
>>
>>> i followed the instructions, but i get
>>> this error message:
>> I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.
>
> why don't i see any errors when previewing my page online?

Read the list of errors that are generated above the stack trace- this is what I'm referring to. To repeat- regardless, I think the problem would be most quickly resolved by starting fresh with the original cheat sheet on docs.scala-lang, adding sections one-by-one, and incrementally building. This is the normal approach, whether your generating documentation or writing code, so it makes sense, right?

>>
>> Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.
> what's the difference between a clean pull request and a "normal" one?

A clean one is from scratch. Have a look at the workflow for submitting scaladoc pull requests- it's the same in the case of docs.scala-lang.org, with the only difference being that the repository URL is different. In particular, it's a good idea to create a topic branch. See: https://wiki.scala-lang.org/display/SW/Workflow#Workflow-Submittinggithu...

There are a few dozen commits in your current pull request, and it can't be automatically be merged as it is. Which, for me and other docs.scala-lang maintainers, is a big hassle to have to deal with on our end.

Cheers,
Heather

>
>>
>> Cheers,
>> Heather
>>
>>
>>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>>> iconv will be deprecated in the future, use String#encode in
>>> stead.
>>> Configuration from
>>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>>> _site
>>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (): couldn't
>>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>>> from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>>> `read_yaml'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>>> `initialize'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `new'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `block in read_directories'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>>> `block in read_directories'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>>> `read'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>>> `process'
>>> from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>>> `'
>>> from C:/Ruby193/bin/jekyll:19:in `load'
>>> from C:/Ruby193/bin/jekyll:19:in `'
>>>
>>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>>> is zero. i just blindly followed some readme. how can i fix this?
>>>
>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>> hi community,
>>>>
>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>> that even after two years, i still find new features/tricks which don't
>>>> seem to be clearly documented - they exist, but are scattered across the
>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>> i had to read them several times since they are not very clear. there
>>>> are some good blogs, but again, you have to look for them. i believe
>>>> that having a single, well structured pdf will make people more
>>>> comfortable with scala if they are new, should make it easier to
>>>> convince heretics to believe in scala :) and take away the fear of the
>>>> unknown complexity.
>>>>
>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>> like a wallpaper, but splitting it up into subsections should help.
>>>> also, i want to focus on productivity boost features and keep it on a
>>>> level that a random java dev should be able to understand (i am thinking
>>>> about avoiding scary method signatures here and use java code as
>>>> examples of how this would look like in java or maybe other languages as
>>>> well)
>>>>
>>>> send your findings/knowledge to me/this list :)
>>>> i'll collect them and put them together.
>>>>
>>
>

Maxime Lévesque
Joined: 2009-08-18,
User offline. Last seen 42 years 45 weeks ago.
Re: the ultimate scala cheat sheet

I see you're running Jekyll on Windows, I had problems before using jekyll on this os
and they went away with a reinstall  of Jekyll, Ruby and dependencies with a slightly different version mix.

You might be able to use Github pages http://pages.github.com/
to render your fork, I've done it before with another project,
this way you don't have to install anything else other than git.

ML

2012/1/7 Miller Heather <heather.miller@epfl.ch>

On Jan 7, 2012, at 11:15 PM, HamsterofDeath wrote:

> Am 07.01.2012 23:03, schrieb Miller Heather:
>> Hi,
>>
>>> i am stuck. i was told to compile my stuff and take a look at the result
>>> before creating a pull request.
>> Very very very sound advice :)
>>
>>> i followed the instructions, but i get
>>> this error message:
>> I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.
>
> why don't i see any errors when previewing my page online?

Read the list of errors that are generated above the stack trace- this is what I'm referring to. To repeat- regardless, I think the problem would be most quickly resolved by starting fresh with the original cheat sheet on docs.scala-lang, adding sections one-by-one, and incrementally building. This is the normal approach, whether your generating documentation or writing code, so it makes sense, right?

>>
>> Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.
> what's the difference between a clean pull request and a "normal" one?

A clean one is from scratch. Have a look at the workflow for submitting scaladoc pull requests- it's the same in the case of docs.scala-lang.org, with the only difference being that the repository URL is different. In particular, it's a good idea to create a topic branch. See: https://wiki.scala-lang.org/display/SW/Workflow#Workflow-SubmittinggithubPullRequests

There are a few dozen commits in your current pull request, and it can't be automatically be merged as it is. Which, for me and other docs.scala-lang maintainers, is a big hassle to have to deal with on our end.

Cheers,
Heather


>
>>
>> Cheers,
>> Heather
>>
>>
>>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>>> iconv will be deprecated in the future, use String#encode in
>>> stead.
>>> Configuration from
>>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>>> _site
>>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (<unknown>): couldn't
>>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>>> `read_yaml'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>>> `initialize'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `new'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>>> `read'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>>> `process'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>>> `<top (required)>'
>>>       from C:/Ruby193/bin/jekyll:19:in `load'
>>>       from C:/Ruby193/bin/jekyll:19:in `<main>'
>>>
>>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>>> is zero. i just blindly followed some readme. how can i fix this?
>>>
>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>> hi community,
>>>>
>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>> that even after two years, i still find new features/tricks which don't
>>>> seem to be clearly documented - they exist, but are scattered across the
>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>> i had to read them several times since they are not very clear. there
>>>> are some good blogs, but again, you have to look for them. i believe
>>>> that having a single, well structured pdf will make people more
>>>> comfortable with scala if they are new, should make it easier to
>>>> convince heretics to believe in scala :) and take away the fear of the
>>>> unknown complexity.
>>>>
>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>> like a wallpaper, but splitting it up into subsections should help.
>>>> also, i want to focus on productivity boost features and keep it on a
>>>> level that a random java dev should be able to understand (i am thinking
>>>> about avoiding scary method signatures here and use java code as
>>>> examples of how this would look like in java or maybe other languages as
>>>> well)
>>>>
>>>> send your findings/knowledge to me/this list :)
>>>> i'll collect them and put them together.
>>>>
>>
>


H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet
Am 08.01.2012 00:51, schrieb Maxime Lévesque:
tw [at] mail [dot] gmail [dot] com" type="cite">
I see you're running Jekyll on Windows, I had problems before using jekyll on this os
and they went away with a reinstall  of Jekyll, Ruby and dependencies with a slightly different version mix.

so basically, the error is random. my installation is a completely fresh one, so a reinstall would probably change nothing. looks like i'll have to look for an alternate route
tw [at] mail [dot] gmail [dot] com" type="cite">
You might be able to use Github pages http://pages.github.com/
to render your fork, I've done it before with another project,
this way you don't have to install anything else other than git.

ML

2012/1/7 Miller Heather <heather [dot] miller [at] epfl [dot] ch" rel="nofollow">heather.miller@epfl.ch>

On Jan 7, 2012, at 11:15 PM, HamsterofDeath wrote:

> Am 07.01.2012 23:03, schrieb Miller Heather:
>> Hi,
>>
>>> i am stuck. i was told to compile my stuff and take a look at the result
>>> before creating a pull request.
>> Very very very sound advice :)
>>
>>> i followed the instructions, but i get
>>> this error message:
>> I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.
>
> why don't i see any errors when previewing my page online?

Read the list of errors that are generated above the stack trace- this is what I'm referring to. To repeat- regardless, I think the problem would be most quickly resolved by starting fresh with the original cheat sheet on docs.scala-lang, adding sections one-by-one, and incrementally building. This is the normal approach, whether your generating documentation or writing code, so it makes sense, right?

>>
>> Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.
> what's the difference between a clean pull request and a "normal" one?

A clean one is from scratch. Have a look at the workflow for submitting scaladoc pull requests- it's the same in the case of docs.scala-lang.org, with the only difference being that the repository URL is different. In particular, it's a good idea to create a topic branch. See: https://wiki.scala-lang.org/display/SW/Workflow#Workflow-SubmittinggithubPullRequests

There are a few dozen commits in your current pull request, and it can't be automatically be merged as it is. Which, for me and other docs.scala-lang maintainers, is a big hassle to have to deal with on our end.

Cheers,
Heather


>
>>
>> Cheers,
>> Heather
>>
>>
>>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>>> iconv will be deprecated in the future, use String#encode in
>>> stead.
>>> Configuration from
>>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>>> _site
>>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (<unknown>): couldn't
>>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>>> `read_yaml'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>>> `initialize'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `new'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>>> `read'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>>> `process'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>>> `<top (required)>'
>>>       from C:/Ruby193/bin/jekyll:19:in `load'
>>>       from C:/Ruby193/bin/jekyll:19:in `<main>'
>>>
>>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>>> is zero. i just blindly followed some readme. how can i fix this?
>>>
>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>> hi community,
>>>>
>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>> that even after two years, i still find new features/tricks which don't
>>>> seem to be clearly documented - they exist, but are scattered across the
>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>> i had to read them several times since they are not very clear. there
>>>> are some good blogs, but again, you have to look for them. i believe
>>>> that having a single, well structured pdf will make people more
>>>> comfortable with scala if they are new, should make it easier to
>>>> convince heretics to believe in scala :) and take away the fear of the
>>>> unknown complexity.
>>>>
>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>> like a wallpaper, but splitting it up into subsections should help.
>>>> also, i want to focus on productivity boost features and keep it on a
>>>> level that a random java dev should be able to understand (i am thinking
>>>> about avoiding scary method signatures here and use java code as
>>>> examples of how this would look like in java or maybe other languages as
>>>> well)
>>>>
>>>> send your findings/knowledge to me/this list :)
>>>> i'll collect them and put them together.
>>>>
>>
>



heathermiller
Joined: 2011-04-27,
User offline. Last seen 22 weeks 12 hours ago.
Re: the ultimate scala cheat sheet
If Jekyll runs and gives you output, I doubt that the error is random. The problem is most likely that you added so many new lines without incrementally building the page that it's now a bit of a mess to debug. Once again, start clean with the unchanged source from docs.scala-lang, if it builds and generates the "_site" folder, then Jekyll isn't your problem. Add each new section one-by-one, build each time. When done, submit a clean pull request. It should take you 30 minutes, tops.

On Jan 8, 2012, at 9:36 AM, HamsterofDeath wrote:
Am 08.01.2012 00:51, schrieb Maxime Lévesque:
tw [at] mail [dot] gmail [dot] com" type="cite">
I see you're running Jekyll on Windows, I had problems before using jekyll on this os
and they went away with a reinstall  of Jekyll, Ruby and dependencies with a slightly different version mix.

so basically, the error is random. my installation is a completely fresh one, so a reinstall would probably change nothing. looks like i'll have to look for an alternate route
tw [at] mail [dot] gmail [dot] com" type="cite">
You might be able to use Github pages http://pages.github.com/
to render your fork, I've done it before with another project,
this way you don't have to install anything else other than git.

ML

2012/1/7 Miller Heather <heather [dot] miller [at] epfl [dot] ch" rel="nofollow">heather.miller@epfl.ch>

On Jan 7, 2012, at 11:15 PM, HamsterofDeath wrote:

> Am 07.01.2012 23:03, schrieb Miller Heather:
>> Hi,
>>
>>> i am stuck. i was told to compile my stuff and take a look at the result
>>> before creating a pull request.
>> Very very very sound advice :)
>>
>>> i followed the instructions, but i get
>>> this error message:
>> I don't see anything useful in the below- usually Jekyll returns a more verbose error above the stack trace. I just forked your repo and tried to build it and at least in my case (from the most recently committed version in your repo, 5 days ago) it looks like you've confused jekyll into thinking you've got a head with two columns somewhere, though no idea where.
>
> why don't i see any errors when previewing my page online?

Read the list of errors that are generated above the stack trace- this is what I'm referring to. To repeat- regardless, I think the problem would be most quickly resolved by starting fresh with the original cheat sheet on docs.scala-lang, adding sections one-by-one, and incrementally building. This is the normal approach, whether your generating documentation or writing code, so it makes sense, right?

>>
>> Regardless, the best thing to do is to perhaps start clean, add sections from your version of the cheatsheet one-by-one, and incrementally build. I would also suggest submitting a clean pull-request eventually as well.
> what's the difference between a clean pull request and a "normal" one?

A clean one is from scratch. Have a look at the workflow for submitting scaladoc pull requests- it's the same in the case of docs.scala-lang.org, with the only difference being that the repository URL is different. In particular, it's a good idea to create a topic branch. See: https://wiki.scala-lang.org/display/SW/Workflow#Workflow-SubmittinggithubPullRequests

There are a few dozen commits in your current pull request, and it can't be automatically be merged as it is. Which, for me and other docs.scala-lang maintainers, is a big hassle to have to deal with on our end.

Cheers,
Heather


>
>>
>> Cheers,
>> Heather
>>
>>
>>> S:\scala_github\HamsterofDeath-scala.github.com-671225d>jekyll --server
>>> C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
>>> iconv will be deprecated in the future, use String#encode in
>>> stead.
>>> Configuration from
>>> S:/scala_github/HamsterofDeath-scala.github.com-671225d/_config.yml
>>> Building site: S:/scala_github/HamsterofDeath-scala.github.com-671225d
>>> -> S:/scala_github/HamsterofDeath-scala.github.com-671225d/
>>> _site
>>> C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse': (<unknown>): couldn't
>>> parse YAML at line 3 column 20 (Psych::SyntaxError)
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:125:in `parse'
>>>       from C:/Ruby193/lib/ruby/1.9.1/psych.rb:112:in `load'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in
>>> `read_yaml'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/page.rb:24:in
>>> `initialize'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `new'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:140:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:135:in
>>> `block in read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `each'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:130:in
>>> `read_directories'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:98:in
>>> `read'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in
>>> `process'
>>>       from
>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in
>>> `<top (required)>'
>>>       from C:/Ruby193/bin/jekyll:19:in `load'
>>>       from C:/Ruby193/bin/jekyll:19:in `<main>'
>>>
>>> my experience considering ruby, YAML, jekyll or whatever i'm doing there
>>> is zero. i just blindly followed some readme. how can i fix this?
>>>
>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>> hi community,
>>>>
>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>> that even after two years, i still find new features/tricks which don't
>>>> seem to be clearly documented - they exist, but are scattered across the
>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>> i had to read them several times since they are not very clear. there
>>>> are some good blogs, but again, you have to look for them. i believe
>>>> that having a single, well structured pdf will make people more
>>>> comfortable with scala if they are new, should make it easier to
>>>> convince heretics to believe in scala :) and take away the fear of the
>>>> unknown complexity.
>>>>
>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>> like a wallpaper, but splitting it up into subsections should help.
>>>> also, i want to focus on productivity boost features and keep it on a
>>>> level that a random java dev should be able to understand (i am thinking
>>>> about avoiding scary method signatures here and use java code as
>>>> examples of how this would look like in java or maybe other languages as
>>>> well)
>>>>
>>>> send your findings/knowledge to me/this list :)
>>>> i'll collect them and put them together.
>>>>
>>
>




Chris Reeves
Joined: 2009-10-26,
User offline. Last seen 42 years 45 weeks ago.
Re: the ultimate scala cheat sheet

On Mon, Dec 26, 2011 at 11:17 AM, Josh Suereth wrote:
> More importantly you can do this for any sequence not just lists.
>
> case Seq(head, tail @_*) => ....
>

For what it's worth, this works with anything with unapply or
unapplySeq in this particular case.

You can use this to destructure anything with an unapply method, like
case classes, tuples, collections, options, and you can write your
own:

case class Foo(x: String, y: Int)
val foo = Foo("foo", 1)
val Foo(a, b) = foo // a: String = "foo", b: Int = 1

val tuple = (1, "test", 23L)
val (x, y, z) = tuple // x: Int = 1, y: String = "test", z: Long = 23L

val x: Option[String] = Some("test")
val Option(y) = x // y is now a string "test"

with most HList implementations (with appropriate imports):
val hlist = "test" :: false :: 10 :: HNil
val x :: y :: z :: HNil = hlist // x: String = "test", y: Boolean =
false, z: Int = 10

roll your own:
object Bippy {
def unapply(in: String): Option[Int] = try { Some(in.toInt) } catch
{ case _ => None }
}
val Bippy(i) = "123"

That's a terrible application of this feature, but it shows what you
can accomplish if you're a fan of sugar. Note that this will throw a
match error if you return None, so in this case any time there is an
exception with in.toInt.

You can even do it directly with instances:
// move a string to an optional int with a value if the int value of
the string matches the value passed into the constructor
class Bar(i: Int) {
def unapply(in: String): Option[Option[Int]] = try {
Some(Some(in.toInt).filter(_ == i)) } catch { case _ => Some(None) }
}
val bar = new Bar(10)
val bar(b) = "123" // = None: Option[String]
val bar(c) = "10" // = Some(10): Option[String]
val bar2 = new Bar(123)
val bar2(d) = "123" // = Some(123): Option[String]
val bar2(e) = "10" // = None: Option[String]

You can also stack destructurers to you hearts content:
val deepStructure = (Some("test"), Some(10), (Foo("foo", 1), Seq(1, 2, 3)))
val (Some(x), Some(y), (Foo(a, b), Seq(p, q, r))) = deepStructure //
x: String = "test", y: Int = 10, a: String = "foo", b: Int = 1, p: Int
= 1, q: Int = 2, r: Int = 3

Note that destructuring with :: as in
val a :: b :: c :: Nil = list
is actually deep destructuring with a case class (::) and is equivalent to
val ::(a, ::(b, ::(c, Nil))) = list
and the HList version uses the same sugary trick.
It's unfortunate that most HList implementations use the same case
class name (::) though, since it means you cannot destructure a List
when the HList class is imported. However, you can still build one.

Thanks, Chris

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

Am 09.01.2012 20:31, schrieb Chris Reeves:
> On Mon, Dec 26, 2011 at 11:17 AM, Josh Suereth wrote:
>> More importantly you can do this for any sequence not just lists.
>>
>> case Seq(head, tail @_*) => ....
>>
> For what it's worth, this works with anything with unapply or
> unapplySeq in this particular case.
>
> You can use this to destructure anything with an unapply method, like
> case classes, tuples, collections, options, and you can write your
> own:
>
> case class Foo(x: String, y: Int)
> val foo = Foo("foo", 1)
> val Foo(a, b) = foo // a: String = "foo", b: Int = 1
>
> val tuple = (1, "test", 23L)
> val (x, y, z) = tuple // x: Int = 1, y: String = "test", z: Long = 23L
>
> val x: Option[String] = Some("test")
> val Option(y) = x // y is now a string "test"
>
> with most HList implementations (with appropriate imports):
> val hlist = "test" :: false :: 10 :: HNil
> val x :: y :: z :: HNil = hlist // x: String = "test", y: Boolean =
> false, z: Int = 10
>
> roll your own:
> object Bippy {
> def unapply(in: String): Option[Int] = try { Some(in.toInt) } catch
> { case _ => None }
> }
> val Bippy(i) = "123"
>
> That's a terrible application of this feature, but it shows what you
> can accomplish if you're a fan of sugar. Note that this will throw a
> match error if you return None, so in this case any time there is an
> exception with in.toInt.
>
> You can even do it directly with instances:
> // move a string to an optional int with a value if the int value of
> the string matches the value passed into the constructor
> class Bar(i: Int) {
> def unapply(in: String): Option[Option[Int]] = try {
> Some(Some(in.toInt).filter(_ == i)) } catch { case _ => Some(None) }
> }
> val bar = new Bar(10)
> val bar(b) = "123" // = None: Option[String]
> val bar(c) = "10" // = Some(10): Option[String]
> val bar2 = new Bar(123)
> val bar2(d) = "123" // = Some(123): Option[String]
> val bar2(e) = "10" // = None: Option[String]
>
> You can also stack destructurers to you hearts content:
> val deepStructure = (Some("test"), Some(10), (Foo("foo", 1), Seq(1, 2, 3)))
> val (Some(x), Some(y), (Foo(a, b), Seq(p, q, r))) = deepStructure //
> x: String = "test", y: Int = 10, a: String = "foo", b: Int = 1, p: Int
> = 1, q: Int = 2, r: Int = 3
>
> Note that destructuring with :: as in
> val a :: b :: c :: Nil = list
> is actually deep destructuring with a case class (::) and is equivalent to
> val ::(a, ::(b, ::(c, Nil))) = list
> and the HList version uses the same sugary trick.
> It's unfortunate that most HList implementations use the same case
> class name (::) though, since it means you cannot destructure a List
> when the HList class is imported. However, you can still build one.
>
> Thanks, Chris
>
the nested and works-on-instance-cases are worth noting, imho. it's
obvious when you think about it, but sometimes you don't...

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

i did some research and wrote an example showing how implicits are
resolved. take a look at it and if there is a mistake, please notify me :)

https://gist.github.com/1649497

Am 21.12.2011 21:02, schrieb HamsterofDeath:
> hi community,
>
> i felt the desire to put together a scala cheat sheet. the reason is
> that even after two years, i still find new features/tricks which don't
> seem to be clearly documented - they exist, but are scattered across the
> internet. there is already a cheat sheet, but it only covers a fraction
> of what i am imagining here. there are some examples on scala-lang, but
> i had to read them several times since they are not very clear. there
> are some good blogs, but again, you have to look for them. i believe
> that having a single, well structured pdf will make people more
> comfortable with scala if they are new, should make it easier to
> convince heretics to believe in scala :) and take away the fear of the
> unknown complexity.
>
> it's probably going to be bigger than the usual cheat sheet so it's more
> like a wallpaper, but splitting it up into subsections should help.
> also, i want to focus on productivity boost features and keep it on a
> level that a random java dev should be able to understand (i am thinking
> about avoiding scary method signatures here and use java code as
> examples of how this would look like in java or maybe other languages as
> well)
>
> send your findings/knowledge to me/this list :)
> i'll collect them and put them together.
>

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

since no one objected, here's the whole thing as a pdf:
https://rapidshare.com/files/3045603786/scc.pdf

Am 20.01.2012 21:54, schrieb HamsterofDeath:
> i did some research and wrote an example showing how implicits are
> resolved. take a look at it and if there is a mistake, please notify me :)
>
> https://gist.github.com/1649497
>
> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>> hi community,
>>
>> i felt the desire to put together a scala cheat sheet. the reason is
>> that even after two years, i still find new features/tricks which don't
>> seem to be clearly documented - they exist, but are scattered across the
>> internet. there is already a cheat sheet, but it only covers a fraction
>> of what i am imagining here. there are some examples on scala-lang, but
>> i had to read them several times since they are not very clear. there
>> are some good blogs, but again, you have to look for them. i believe
>> that having a single, well structured pdf will make people more
>> comfortable with scala if they are new, should make it easier to
>> convince heretics to believe in scala :) and take away the fear of the
>> unknown complexity.
>>
>> it's probably going to be bigger than the usual cheat sheet so it's more
>> like a wallpaper, but splitting it up into subsections should help.
>> also, i want to focus on productivity boost features and keep it on a
>> level that a random java dev should be able to understand (i am thinking
>> about avoiding scary method signatures here and use java code as
>> examples of how this would look like in java or maybe other languages as
>> well)
>>
>> send your findings/knowledge to me/this list :)
>> i'll collect them and put them together.
>>
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

It told me the file was not available.

On Wed, Jan 25, 2012 at 17:34, HamsterofDeath wrote:
> since no one objected, here's the whole thing as a pdf:
> https://rapidshare.com/files/3045603786/scc.pdf
>
>
> Am 20.01.2012 21:54, schrieb HamsterofDeath:
>> i did some research and wrote an example showing how implicits are
>> resolved. take a look at it and if there is a mistake, please notify me :)
>>
>> https://gist.github.com/1649497
>>
>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>> hi community,
>>>
>>> i felt the desire to put together a scala cheat sheet. the reason is
>>> that even after two years, i still find new features/tricks which don't
>>> seem to be clearly documented - they exist, but are scattered across the
>>> internet. there is already a cheat sheet, but it only covers a fraction
>>> of what i am imagining here. there are some examples on scala-lang, but
>>> i had to read them several times since they are not very clear. there
>>> are some good blogs, but again, you have to look for them. i believe
>>> that having a single, well structured pdf will make people more
>>> comfortable with scala if they are new, should make it easier to
>>> convince heretics to believe in scala :) and take away the fear of the
>>> unknown complexity.
>>>
>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>> like a wallpaper, but splitting it up into subsections should help.
>>> also, i want to focus on productivity boost features and keep it on a
>>> level that a random java dev should be able to understand (i am thinking
>>> about avoiding scary method signatures here and use java code as
>>> examples of how this would look like in java or maybe other languages as
>>> well)
>>>
>>> send your findings/knowledge to me/this list :)
>>> i'll collect them and put them together.
>>>
>>
>

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

rapidshare lies, i can download it.

Am 25.01.2012 20:45, schrieb Daniel Sobral:
> It told me the file was not available.
>
> On Wed, Jan 25, 2012 at 17:34, HamsterofDeath wrote:
>> since no one objected, here's the whole thing as a pdf:
>> https://rapidshare.com/files/3045603786/scc.pdf
>>
>>
>> Am 20.01.2012 21:54, schrieb HamsterofDeath:
>>> i did some research and wrote an example showing how implicits are
>>> resolved. take a look at it and if there is a mistake, please notify me :)
>>>
>>> https://gist.github.com/1649497
>>>
>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>> hi community,
>>>>
>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>> that even after two years, i still find new features/tricks which don't
>>>> seem to be clearly documented - they exist, but are scattered across the
>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>> i had to read them several times since they are not very clear. there
>>>> are some good blogs, but again, you have to look for them. i believe
>>>> that having a single, well structured pdf will make people more
>>>> comfortable with scala if they are new, should make it easier to
>>>> convince heretics to believe in scala :) and take away the fear of the
>>>> unknown complexity.
>>>>
>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>> like a wallpaper, but splitting it up into subsections should help.
>>>> also, i want to focus on productivity boost features and keep it on a
>>>> level that a random java dev should be able to understand (i am thinking
>>>> about avoiding scary method signatures here and use java code as
>>>> examples of how this would look like in java or maybe other languages as
>>>> well)
>>>>
>>>> send your findings/knowledge to me/this list :)
>>>> i'll collect them and put them together.
>>>>
>
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: the ultimate scala cheat sheet

I don't like calling the value classes "primitives", because it
implies the distinction Java has and Scala doesn't.

On Wed, Jan 25, 2012 at 18:30, HamsterofDeath wrote:
> rapidshare lies, i can download it.
>
> Am 25.01.2012 20:45, schrieb Daniel Sobral:
>> It told me the file was not available.
>>
>> On Wed, Jan 25, 2012 at 17:34, HamsterofDeath wrote:
>>> since no one objected, here's the whole thing as a pdf:
>>> https://rapidshare.com/files/3045603786/scc.pdf
>>>
>>>
>>> Am 20.01.2012 21:54, schrieb HamsterofDeath:
>>>> i did some research and wrote an example showing how implicits are
>>>> resolved. take a look at it and if there is a mistake, please notify me :)
>>>>
>>>> https://gist.github.com/1649497
>>>>
>>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>>> hi community,
>>>>>
>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>> that even after two years, i still find new features/tricks which don't
>>>>> seem to be clearly documented - they exist, but are scattered across the
>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>> i had to read them several times since they are not very clear. there
>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>> that having a single, well structured pdf will make people more
>>>>> comfortable with scala if they are new, should make it easier to
>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>> unknown complexity.
>>>>>
>>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>> level that a random java dev should be able to understand (i am thinking
>>>>> about avoiding scary method signatures here and use java code as
>>>>> examples of how this would look like in java or maybe other languages as
>>>>> well)
>>>>>
>>>>> send your findings/knowledge to me/this list :)
>>>>> i'll collect them and put them together.
>>>>>
>>
>>
>

ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: the ultimate scala cheat sheet
If you don't realize that they're primitives on the JVM, you are going to get bitten pretty quickly (with performance, with specialization, with Java interop, with...).  Also, the differences between value and reference types are pretty hard to understand outside of that context.

I'm afraid Scala can't yet offer the level of abstraction where you don't have to worry about such things.  I'd rather be open about it up front than pretend it doesn't exist.

  --Rex

On Wed, Jan 25, 2012 at 4:02 PM, Daniel Sobral <dcsobral@gmail.com> wrote:
I don't like calling the value classes "primitives", because it
implies the distinction Java has and Scala doesn't.

On Wed, Jan 25, 2012 at 18:30, HamsterofDeath <h-star@gmx.de> wrote:
> rapidshare lies, i can download it.
>
> Am 25.01.2012 20:45, schrieb Daniel Sobral:
>> It told me the file was not available.
>>
>> On Wed, Jan 25, 2012 at 17:34, HamsterofDeath <h-star@gmx.de> wrote:
>>> since no one objected, here's the whole thing as a pdf:
>>> https://rapidshare.com/files/3045603786/scc.pdf
>>>
>>>
>>> Am 20.01.2012 21:54, schrieb HamsterofDeath:
>>>> i did some research and wrote an example showing how implicits are
>>>> resolved. take a look at it and if there is a mistake, please notify me :)
>>>>
>>>> https://gist.github.com/1649497
>>>>
>>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>>> hi community,
>>>>>
>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>> that even after two years, i still find new features/tricks which don't
>>>>> seem to be clearly documented - they exist, but are scattered across the
>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>> i had to read them several times since they are not very clear. there
>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>> that having a single, well structured pdf will make people more
>>>>> comfortable with scala if they are new, should make it easier to
>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>> unknown complexity.
>>>>>
>>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>> level that a random java dev should be able to understand (i am thinking
>>>>> about avoiding scary method signatures here and use java code as
>>>>> examples of how this would look like in java or maybe other languages as
>>>>> well)
>>>>>
>>>>> send your findings/knowledge to me/this list :)
>>>>> i'll collect them and put them together.
>>>>>
>>
>>
>



--
Daniel C. Sobral

I travel to the future all the time.

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: the ultimate scala cheat sheet

the sheet says
"Automatically boxed and unboxed, no special handling like in java (->
int/Integer)"
right next to it. you can write scala code as if there was no jvm level
distinction between int and integer, but at runtime, there still is. i
think that nails it.

Am 25.01.2012 22:02, schrieb Daniel Sobral:
> I don't like calling the value classes "primitives", because it
> implies the distinction Java has and Scala doesn't.
>
> On Wed, Jan 25, 2012 at 18:30, HamsterofDeath wrote:
>> rapidshare lies, i can download it.
>>
>> Am 25.01.2012 20:45, schrieb Daniel Sobral:
>>> It told me the file was not available.
>>>
>>> On Wed, Jan 25, 2012 at 17:34, HamsterofDeath wrote:
>>>> since no one objected, here's the whole thing as a pdf:
>>>> https://rapidshare.com/files/3045603786/scc.pdf
>>>>
>>>>
>>>> Am 20.01.2012 21:54, schrieb HamsterofDeath:
>>>>> i did some research and wrote an example showing how implicits are
>>>>> resolved. take a look at it and if there is a mistake, please notify me :)
>>>>>
>>>>> https://gist.github.com/1649497
>>>>>
>>>>> Am 21.12.2011 21:02, schrieb HamsterofDeath:
>>>>>> hi community,
>>>>>>
>>>>>> i felt the desire to put together a scala cheat sheet. the reason is
>>>>>> that even after two years, i still find new features/tricks which don't
>>>>>> seem to be clearly documented - they exist, but are scattered across the
>>>>>> internet. there is already a cheat sheet, but it only covers a fraction
>>>>>> of what i am imagining here. there are some examples on scala-lang, but
>>>>>> i had to read them several times since they are not very clear. there
>>>>>> are some good blogs, but again, you have to look for them. i believe
>>>>>> that having a single, well structured pdf will make people more
>>>>>> comfortable with scala if they are new, should make it easier to
>>>>>> convince heretics to believe in scala :) and take away the fear of the
>>>>>> unknown complexity.
>>>>>>
>>>>>> it's probably going to be bigger than the usual cheat sheet so it's more
>>>>>> like a wallpaper, but splitting it up into subsections should help.
>>>>>> also, i want to focus on productivity boost features and keep it on a
>>>>>> level that a random java dev should be able to understand (i am thinking
>>>>>> about avoiding scary method signatures here and use java code as
>>>>>> examples of how this would look like in java or maybe other languages as
>>>>>> well)
>>>>>>
>>>>>> send your findings/knowledge to me/this list :)
>>>>>> i'll collect them and put them together.
>>>>>>
>>>
>
>

d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.
Re: the ultimate scala cheat sheet

On Wed, Jan 25, 2012 at 04:31:22PM -0500, Rex Kerr wrote:
> If you don't realize that they're primitives on the JVM, you are going to
> get bitten pretty quickly (with performance, with specialization, with Java
> interop, with...). Also, the differences between value and reference types
> are pretty hard to understand outside of that context.
>
> I'm afraid Scala can't yet offer the level of abstraction where you don't
> have to worry about such things. I'd rather be open about it up front than
> pretend it doesn't exist.

I agree with Rex here.

I just finished writing a paper where I had to constantly refer to the
ways in which AnyVal and AnyRef types differ. Beyond things like
boxing, stack allocation and specialization there are basic concerns
like whether null is a legal value.

We can call them "primitives" or something else instead, but it's a
useful and important distinction either way.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland