rohitpaulk has quit [Remote host closed the connection]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
sorcus has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam1 has quit [Quit: WeeChat 2.5]
<absolutejam>
what's the easiest way of saying `if foo in array`?
<absolutejam>
basically, what's a method or `in` on an Enumerable?
<absolutejam>
includes?
DTZUZO has quit [Ping timeout: 258 seconds]
waheedi has joined #crystal-lang
<waheedi>
whats up folks, any guidelines to start contributing to crystal?
early has quit [Quit: Leaving]
early has joined #crystal-lang
absolutejam has quit [Ping timeout: 248 seconds]
absolutejam has joined #crystal-lang
absolutejam1 has joined #crystal-lang
<absolutejam>
can I return from a block?
<absolutejam>
so I have a `func` property that I capture from a block
<absolutejam>
and then I call it with @func.call()
<absolutejam>
I want to return the value from that call, but in the method that calls that, it doesn't return the value from the block
<sorcus>
@absolutejam for array you can use `[1,2,3].includes? 2`.
<absolutejam>
ty
<absolutejam>
ohhh, my Proc has output type of Nil
<absolutejam>
derp
<Yxhuvud>
absolutejam: You can use `next` or `break` depending on what you want to acheive.
<Yxhuvud>
.. but then the actual problem was about a Proc and not about blocks x_x
<absolutejam>
how can I go about cloning an object?
<absolutejam>
I'm trying .dup but it looks like the second object is getting mutated too, possibly because of nested objects
<absolutejam>
there's a `.def_clone` macro but no `.clone` method?
<jokke>
hey
<jokke>
is it ever possible to pass structs by reference?
<jokke>
absolutejam: you just call def_clone in your class
<jokke>
then you'll have a clone method
<absolutejam>
so I have to define the clone behaviour? :|
<absolutejam>
and what about if I have nested mutable data structures?
<Yxhuvud>
jokke: you can create a Pointer to it.
<Yxhuvud>
But that is threading unsafe territory. But in general, if you want to pass something by reference, then you use an object. That is *the* big difference between structs and objects.
<jokke>
yeah
<jokke>
i just switched to objects
<jokke>
*classes
<jokke>
i need to mutate them so it's much more straight forward that way
<jokke>
and probably even faster
<jokke>
because i pass them around a lot
<jokke>
and they're nested structures
lucasb has joined #crystal-lang
absolutejam has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
absolutejam has joined #crystal-lang
waheedi has quit [Quit: waheedi]
absolutejam has quit [Quit: WeeChat 2.5]
absolutejam has joined #crystal-lang
<absolutejam1>
can I define `puts` on my class and then still access the Kernel(?) puts?
<dingenskirchen>
try `::puts "whatever"`
<absolutejam1>
weet, thanks
<absolutejam1>
sweet*
<absolutejam1>
I was getting a stack overflow because it was recursing, haha
absolutejam has quit [Ping timeout: 245 seconds]
duane has joined #crystal-lang
absolutejam has joined #crystal-lang
DTZUZO has joined #crystal-lang
ht_ has joined #crystal-lang
absolutejam has quit [Ping timeout: 244 seconds]
<jokke>
hey there i'm stuck on this for hours now... maybe you can help. Any idea what's happening here? https://carc.in/#/r/78zm