RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
bmcginty has joined #crystal-lang
mati_urunda has quit [Remote host closed the connection]
poikon has quit [Ping timeout: 246 seconds]
poikon has joined #crystal-lang
txdv has quit [Ping timeout: 244 seconds]
txdv has joined #crystal-lang
shawn42 has quit [Quit: Connection closed for inactivity]
<travis-ci> crystal-lang/crystal#4439f2d (master - Spec: explain why comparing against the line is needed): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179616273
<FromGitter> <jwoertink> Are others getting OpenSSL errors when running specs from crystal master branch on macOS?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=583ce6ba444b3778766ae86c]
bmcginty has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
<FromGitter> <drosehn> I'm not even trying to call openssl from crystal, but what version of macOS are you running on? And do you have a version of openssl installed via macports, or homebrew?
<FromGitter> <jwoertink> running macOS 10.12.1
<FromGitter> <jwoertink> Sierra
<FromGitter> <jwoertink> ```[18:50PM] lang (match_data)$ openssl ⏎ OpenSSL> version ⏎ OpenSSL 0.9.8zh 14 Jan 2016``` [https://gitter.im/crystal-lang/crystal?at=583ced1789d179bf4dd91501]
Raimondi has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] jwoertink opened pull request #3606: add match with block method to string. Fixes incorrect usage in docs (master...match_data) https://git.io/v1tdd
vikaton has joined #crystal-lang
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
_whitelogger has joined #crystal-lang
pawnbox has joined #crystal-lang
_whitelogger has joined #crystal-lang
Raimondi has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
Raimondi has quit [Ping timeout: 244 seconds]
pawnbox has quit [Ping timeout: 252 seconds]
<FromGitter> <gamebusterz> Hi all, I just saw this project and I am very keen to get a chance to contribute to a programming language at a young stage. I could start by improving the documentation while I familiarize myself with the codebase. Can anyone point me to specific sections/topics which might require addition/improvement to the documentation ?
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
Philpax has quit [Ping timeout: 268 seconds]
<BlaXpirit> gamebusterz, according to a recent comment, the examples in Regex module might not match what's actually possible with its api
<BlaXpirit> but make sure to look at master branch, because it might have been fixed
<BlaXpirit> sorry, it has been fixed
muelleme has joined #crystal-lang
jsaak has joined #crystal-lang
<FromGitter> <gamebusterz> @BlaXpirit Ok, no problem. I'll keep looking for something. Thanks
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has quit [Ping timeout: 252 seconds]
matp has joined #crystal-lang
bjz has joined #crystal-lang
matp_ has quit [Ping timeout: 246 seconds]
bjz has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
muelleme has quit [Ping timeout: 268 seconds]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
krsh has joined #crystal-lang
vivus-ignis has joined #crystal-lang
A124 has joined #crystal-lang
akwiatkowski has joined #crystal-lang
pawnbox has joined #crystal-lang
olbat has joined #crystal-lang
Philpax has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
krsh has quit [Quit: krsh]
bjz has joined #crystal-lang
Raimondi has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
Raimondi has quit [Ping timeout: 244 seconds]
gloscombe has joined #crystal-lang
bjz has joined #crystal-lang
A124 has quit [Quit: '']
A124 has joined #crystal-lang
vivus-ignis has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
gloscombe has quit [Read error: Connection reset by peer]
Nik736 has joined #crystal-lang
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
matp has quit [Read error: Connection reset by peer]
matp has joined #crystal-lang
soveran has quit [Remote host closed the connection]
optikfluffel has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
optikfluffel has quit [Client Quit]
optikfluffel has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
gloscombe has joined #crystal-lang
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Philpax has quit [Ping timeout: 260 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gloscombe has quit [Read error: Connection reset by peer]
gloscombe has joined #crystal-lang
krsh has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #3606: add match with block method to string. Fixes incorrect usage in docs (master...match_data) https://git.io/v1tdd
<FromGitter> <luislavena> @jwoertink OpenSSL 0.9.8 will be the main issue. If you inspect Crystal source code, it appears to require OpenSSL 1.0.2 and relies on `pkg-config`, you might want to see how to enable that via Homebrew for Crystal to use it instead.
optikfluffel has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has joined #crystal-lang
Raimondi has joined #crystal-lang
ponga has joined #crystal-lang
vivus-ignis has joined #crystal-lang
rolha has joined #crystal-lang
<rolha> hello everyone
<rolha> is there an easy way to do something as scala's 'scanLeft'. It's a fold with accumulator. I've made pastie with my original code logic http://pastie.org/10972592
gloscombe has quit [Ping timeout: 258 seconds]
gloscombe has joined #crystal-lang
<BlaXpirit> rolha, hm how about you explain what needs to happen, not some comparisons :p
<rolha> sure, sorry
<BlaXpirit> rolha, anyway, i'm guessing it's this https://crystal-lang.org/api/0.20.0/Enumerable.html#reduce%28%26block%29-instance-method
<rolha> instead of having 3 separate arrays, updated in the block
<rolha> I could start with one array, with the 3 initial values, say [0, 0, 0]
<rolha> this would be the input of the next step, which will return another array with 3 values
<rolha> which is the input of the next step and so on
<rolha> in the end, instead of having
gloscombe has quit [Client Quit]
<rolha> a = [a1, a2, ...], b = [b1, b2, ...], c = [c1, c2, ...]
gloscombe has joined #crystal-lang
<rolha> I would have [[a1, b1, c1], [a2, b2, c2], ...]
<BlaXpirit> there probably isn't a way to reduce and get an array of results
<rolha> ok, thanks!
krsh has quit [Quit: krsh]
<BlaXpirit> rolha, here's some example that may be helpful https://carc.in/#/r/1ex7
<BlaXpirit> oh woops not exactly what you want but whatever
<BlaXpirit> i think this particular case is not natural with this accumulation thing anyway
<rolha> that's ok, thanks anyway
<rolha> the whole thing was to try to remove the temporary "result"
<rolha> but it's not important, it was more an aesthetic thing than a practical one
<rolha> thanks again!
<BlaXpirit> rolha, maybe u simply want this, i dont know https://carc.in/#/r/1exj
<BlaXpirit> because that's what your example produces i think
<rolha> BlaXpirit can the block reference the array itself? If so, this is just the thing
<BlaXpirit> no, it can't
<rolha> ;(
<BlaXpirit> most idiomatic is to create an empty array and keep pushing to it
shawn42 has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
<rolha> it's probably more efficient than a scan anyway
<FromGitter> <spalladino> :point_up: November 29, 2016 3:38 AM (https://gitter.im/crystal-lang/crystal?at=583d227516207f7b0ebaf555) ⏎ ⏎ Now that openssl is mentioned, I've been using openssl/cipher and noticed it is not documented at all. If you are comfortable with it, and you want to help with documentation, it could be a good candidate. See https://github.com/crystal-lang/crystal/blob/master/src/openssl/cipher.cr, or
<rolha> but it's a good example of what I wanted
<rolha> *if* this where valid syntax, it would be http://pastie.org/10972607
<rolha> self would be a reference to the array
<BlaXpirit> rolha, best i can do https://carc.in/#/r/1exk
<rolha> this could work, I just need to keep one temp array instead of 3
<rolha> thanks!
soveran has quit [Remote host closed the connection]
gloscombe has quit [Ping timeout: 250 seconds]
gloscombe has joined #crystal-lang
gloscombe has quit [Ping timeout: 244 seconds]
gloscombe has joined #crystal-lang
rolha has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
bcardiff has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
vivus-ignis has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
muelleme has joined #crystal-lang
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
gloscombe has quit [Remote host closed the connection]
vivus-ignis has joined #crystal-lang
<FromGitter> <bogdanteleaga> Is there a way to use the &.<method> syntax with functions?
<BlaXpirit> bogdanteleaga, not entirely sure what you mean. to level functions? no
<BlaXpirit> top*
<FromGitter> <bogdanteleaga> yes, a top level function
<Papierkorb> That wouldn't make much sense anyway, were you looking for the &->method syntax instead?
<Papierkorb> bogdanteleaga
akwiatkowski has joined #crystal-lang
soveran has joined #crystal-lang
bcardiff has quit [Ping timeout: 260 seconds]
muelleme has quit [Ping timeout: 252 seconds]
bjz has joined #crystal-lang
bcardiff has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #3577: Refactor interpret '==' and '!=' of MacroId (master...fix/macroid-eq-neq) https://git.io/v1fxL
bcardiff has quit [Client Quit]
ponga has quit [Quit: Connection closed for inactivity]
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
<FromGitter> <jwoertink> @bogdanteleaga do you mean something like what ruby has where you can do `some_collect.each(&method(:puts))`?
soveran has joined #crystal-lang
Philpax has joined #crystal-lang
muelleme has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philpax has quit [Ping timeout: 260 seconds]
mussela has joined #crystal-lang
<mussela> hey everyone!
<mussela> another night of Crystal coding :D
<mussela> how can I create a byte array literally? like, I want to create an array containing [0x0b, 0x11, 0xef, 0xec]
soveran has quit [Remote host closed the connection]
<RX14> mussela, append _u8 to every constant in what you have there and it should work
<RX14> are you sure you don't want a slice though?
<mussela> cool, thanks
<mussela> I am not :D
<mussela> is a Slice better?
<FromGitter> <bcardiff> > pp UInt8.slice(0x0b, 0x11, 0xef, 0xec)
<FromGitter> <bcardiff> but it is essentially the same.
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
<mgarciaisaia> A slice would be what C calls an array, right? Like, contiguous memory with one element next to the other, period. Versus a Crystal Array - an object that links to it's elements bla bla?
<RX14> mgarciaisaia, not really
<RX14> they both are arrays in the traditional sense
<RX14> contiguous memory
<RX14> array isn't a linked list
<RX14> but array is resizable and more friendly for use as a collection
<mussela> I'm working on a file format that is basically a filesystem-in-a-file - is using Slices adequate to serialize info?
<RX14> slice is basically pointer + size in an immutable struct
<RX14> Slice is much more of a "this describes a piece of memory"
<RX14> whereas array is "this is an indexed list of items"
<RX14> many different slices can point to one bit of memory, and it's subsets
<RX14> however array manages it's own memory entirely
<mussela> RX14: could you tell me if the gist is going in the right direction?
<RX14> you can use write_byte
<RX14> but yes it seems to be a good start
<mussela> wow, even has endianness! :D thanks
<RX14> yup
<RX14> crystal's IO is pretty great once you get used to it
bjz has joined #crystal-lang
<FromGitter> <spalladino> You can also just use https://crystal-lang.org/api/0.20.0/Bytes.html. It's no more than an alias for `Slice(UInt8)`, but certainly more readable.
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<mgarciaisaia> Thanks for the correction, RX14 :)
<mgarciaisaia> mussela, you may want to use a struct that describes your filesystem's fields instead of doing it byte-per-byte
<mgarciaisaia> This is part of an "academic" FS we're building at uni - https://github.com/sisoputnfrba/osada-utils/blob/master/osada.h
<RX14> well yes you might want to read/write from a struct
<RX14> but don't try and cast memory to structs
<mussela> hmmm yeah mgarciaisaia that seems a bit more readable
<mgarciaisaia> You define a struct - so the layout of the bytes are well defined -, and you refer to those field names everywhere instead of doing it byte-per-byte
Nik736 has quit [Quit: Textual IRC Client: www.textualapp.com]
<mgarciaisaia> I bet it would read _waaaaaay_ better in Crystal :D
<RX14> yes, use structs
<mussela> ok, will do
<RX14> no, don't cast memory to structs
<mussela> ?
matp_ has joined #crystal-lang
<RX14> basically, don't try to take a memory location and cast it to packed structs without copying
<RX14> create normal structs and have an initialize method which takes IO or Slice
<mussela> so the way I'm trying to get this to work is to read a bunch of files into Slice(UInt8) and then write said slices to a file
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mussela> with markers in the middle for filesystem bookeeping
matp has quit [Ping timeout: 246 seconds]
<mussela> creating the normal struct and .new-ing them was how I wanted to go about this
<mussela> "normal"
<RX14> yep
vivus-ignis has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<RX14> In C you might create a packed struct and get the compiler to treat the same memory in the slice as the struct, but in crystal (or C honestly) you shouldn't do that
soveran has quit [Remote host closed the connection]
<mussela> RX14: ah, I see
<mussela> so how can I convert a string into a byte array?
<mussela> (or better, where is this mentioned in the docs?(
<mussela> lol #bytes
<mussela> that was easy to find :D
mgarciaisaia has quit [Ping timeout: 252 seconds]
<mussela> thanks for all the help, see ya soon hopefully :D
mussela has quit [Quit: Page closed]
<FromGitter> <spalladino> @mussela note you can also ask for the String's bytes as a slice of bytes via `to_slice`, that way you'd get a *view* of the string's byte representation. `bytes`, on the other hand, will allocate a new array and copy the string's bytes into it.
muelleme has quit [Ping timeout: 246 seconds]
<BlaXpirit> gone unfortunately
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi