<FromGitter>
<elorest> <BlaXpirit> @fridgerator lenticular printing currently only seems to support 10 frames so this is what I have so far. Will probably work on it a bit more. http://giphy.com/gifs/crystal-lang-logo-l1BgSYVQGMWjATwwo
<FromGitter>
<Sija> regarding “baking” in files inside the exec
<FromGitter>
<will> I have part some json that is array pairs of floats. Is there any easy way to parse that into a NamedTuple or Tuple? Right now I'm using my own struct with an initializer that uses the pull parser, but curious if there is a simpler way
<FromGitter>
<elorest> @will maybe not as performant but it might be simpler to use an array or hash.
<FromGitter>
<Sija> passing `{Float64, Float64}` as `type` argument works for me
<FromGitter>
<elorest> <BlaXpirit> @fridgerator lenticular printing currently only seems to support 10 frames so this is what I have so far. Will probably work on it a bit more. https://isaacsloan.com/crystal-fast.gif ⏎ Gif might be useful for a talk at crystal code camp too so here it is.
<FromGitter>
<faustinoaq> I have seen the first one in many shards
_whitelogger has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 240 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
_whitelogger has joined #crystal-lang
vegai_ has joined #crystal-lang
unshadow has joined #crystal-lang
Qchmqs has joined #crystal-lang
jfontan has quit [Ping timeout: 240 seconds]
bungoman has joined #crystal-lang
<FromGitter>
<Sija> @faustinoaq I’d go for 1st option since it allows you to override `INSTANCE` property if needed and scopes data to given object instead of class
<FromGitter>
<Sija> quite new, it has been added in v0.20.3
foxxx0 has quit [Quit: WeeChat 1.7]
n0r1x has joined #crystal-lang
<n0r1x>
Hello :) Question: is it normal that my version of Crystal can't find the "crc32" library?
<BlaXpirit>
n0r1x, kinda normal, if you have an old version of crystal
<FromGitter>
<bew> What version do you have?
<n0r1x>
I'm using the one from the arch repos, that might be the problem
<BlaXpirit>
added in version 0.21 - check yours with `crystal -v`
<n0r1x>
crystal -v Crystal 0.20.5 (2017-01-25)
<BlaXpirit>
n0r1x, oh yeah, arch currently has the biggest delay that i've ever seen
<n0r1x>
yup, thanks :)
<n0r1x>
Do you mean that nobody is updating the official repos? I don't use my arch that much and installed it as a hobby system so I'm not really on top of the news
<BlaXpirit>
n0r1x, can use https://aur.archlinux.org/packages/crystal-git/ or to more easily follow the development (aur package redownloads and runs all unittests, bleh), download and compile manually, it's easy
<BlaXpirit>
n0r1x, well yeah, someone close to arch development decided to take up this package that used to be maintained by users, and now they're not updating it for whatever reason
<n0r1x>
yeah, I have pacaur since I had to install android studio, I'm gonna pacman -R it and packaur -S that one
<n0r1x>
I've noticed a tendency from the arch contributors to take "in" programming languages into the pacman repos and leave all the tools you'd want to use with them into the AUR
<n0r1x>
ok strange, my pacman auto quits out of the y/n prompts
<BlaXpirit>
n0r1x, ayyup that's actually a bug caused by crystal, believe it or not
<BlaXpirit>
something that crystal does affects the terminal session consequently
<BlaXpirit>
you can restart your terminal window/whatever
<n0r1x>
It's trying to block its certain removal
<BlaXpirit>
:>
<n0r1x>
It's becoming conscious :O
<unshadow>
n0r1x: Arch user here, jhass is mainatinig the crystal-git version in the AUR and it's almost allways one or two days from release to package update, you can also pinghim anytime XD
<BlaXpirit>
unshadow, because it's a -git package, you can just reinstall it anytime without any need to update it in aur
<unshadow>
BlaXpirit: It's not realy a git package, jhass is following with compile from git to a certain tag where the tag is the version , you can see it in the PKGBUILD, also here: https://aur.archlinux.org/packages/crystal-git/ where it was discussed
<BlaXpirit>
unshadow, no, i'm pretty sure it installs latest commit
<BlaXpirit>
no need to copypaste this here, easier to just install it and then check the version
<n0r1x>
It's compiling right now
<unshadow>
I think this clearly show it's "hardcoded" to 0.21.1-1
<n0r1x>
Was making a silly tool that (hopefully) prints out an image to terminal via ansi character codes
bungoman has quit [Quit: Leaving]
<BlaXpirit>
welp crystal-git is compiling way too long, that is not normal
n0r1x has quit [Ping timeout: 260 seconds]
<BlaXpirit>
it is in fact broken
<unshadow>
:\ I'll try to build too
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
n0r1x has joined #crystal-lang
<n0r1x>
ok, pacaur crystal git didnt work i guess
<unshadow>
n0r1x: It seems that yaourt is handeling it better :)
<n0r1x>
really?
<n0r1x>
Hmm, I don't like installing too many managers
<n0r1x>
but where would the difference between the two lie?
<n0r1x>
Because I figured that it took so long because it had to swap with the hard drive
<n0r1x>
(and then crashed)
<RX14>
n0r1x, just downloading the linux distribution is probably your best bet
<RX14>
that or using crenv to downloadint for you
<unshadow>
n0r1x: How much RAM do you have ? also, how much space you got in /tmp/ ?
<RX14>
hopefully crane, the version manager i'm working on, will be finished soon...
<n0r1x>
6 gigs in ram
<BlaXpirit>
unshadow, i have a ton of ram and it didnt do anything in 30 minutes
<RX14>
yeah compiling with LLVM 3.5 is broken in release mode
<RX14>
upgrading to llvm 3.8+ fixes it
<BlaXpirit>
except it's 3.9.1
<unshadow>
BlaXpirit: just n0r1x said the machine was swapping, so ...
<RX14>
BlaXpirit, except the bundled version of llvm with crystal is 3.5 still
<RX14>
and if you download the linux package from the github releases it uses llvm 3.5
<RX14>
which sucks
<n0r1x>
I think it was swapping since the computer basically got stuck, i was playing a youtube video (song) in the background and it kept stopping and starting
<n0r1x>
and my mouse didnt work
<RX14>
yeah
<RX14>
you need 8gb ram minimum for a release compiler
<BlaXpirit>
i have 16 and it doesnt compile
<RX14>
but you're not running out of memory BlaXpirit
<BlaXpirit>
no, it's just stuck for very long
<RX14>
you're hitting the llvm 3.5 release bug
<RX14>
which hangs release builds forever
<BlaXpirit>
anyway... n0r1x, i have to suggest compiling from source yourself
<BlaXpirit>
you have crystal from repos installed which should be good but also download source from github and run make
<RX14>
you'll probably have to build a debug compiler if you only have 6gb ram
<n0r1x>
debug compiler?
<RX14>
meaning non-release build
<RX14>
that's all
<n0r1x>
aka just git pull and install it manually?
<RX14>
yes
<BlaXpirit>
n0r1x, do not *install* it, use it from the directory
<RX14>
n0r1x, in the crystal repo there's a file called bin/crystal which you can use from anywhere
<RX14>
you can probably symlink it from /usr/local/bin/ if you want
<n0r1x>
ok
<n0r1x>
huh, so I need to have crystall installed to run it ...
<n0r1x>
so my best bet is reinstalling the pacman version
<n0r1x>
compiling the debug version
<n0r1x>
and 'swapping out' the pacman exec with the debug one?
<BlaXpirit>
n0r1x, pls no
<n0r1x>
*to run make
<BlaXpirit>
indeed, install the one from pacman, download crystal source code and run make there, that's it
<n0r1x>
Took about 10 secs to compile this time
<n0r1x>
running the spec
<n0r1x>
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
<n0r1x>
Is there a way to find out what type a function returns? The compiler finally got past the 'crc32' thing, but now it's asking me to infer the type of a class member
<RX14>
you can execute puts typeof(thing)
<BlaXpirit>
n0r1x, typeof(some_function(asdf))
A124 has joined #crystal-lang
<FromGitter>
<bjeanes> @RX14 no worries, it's not a big deal at the moment. It'd just be nice to make an invalid piece of data unrepresentable here. tl;dr using a Hash(K, Array(K)) as a DAG for tsort-ing. Hash(K, V) where V != Array(K) is incoherent
<RX14>
yeah
A124 has quit [Quit: '']
<FromGitter>
<bjeanes> @RX14 you said "right now". Is this something that is otherwise planned/discussed?
<RX14>
maybe...
A124 has joined #crystal-lang
<RX14>
i don't know
<RX14>
i could see it being implemented
<FromGitter>
<bjeanes> It's one of the very nice parts about Rust's traits+generics interaction IMO
<FromGitter>
<bjeanes> The implications could be surprising to some but welcome to others. For example, methods being defined on Foo(T) but not on Foo(V)
<FromGitter>
<dreyks> this can actually be done as a shard using the same macros technic
<RX14>
i'd be +1 for it being implemented given a nice syntax and semantics
<RX14>
and i can'
<RX14>
t think why ary would be against it
jfontan has joined #crystal-lang
<FromGitter>
<bjeanes> @RX14 is there an issue tracking anything adjacent to this? If not, do you think I should open one with my use case as context? Admittedly, it wouldn't happen till tomorrow anyway as it's almost midnight here so I need to sleep soon
<RX14>
yeah, open an isue if there isn't already one
<n0r1x>
I have a two dimensional array of Int32 that suddenly changes values to a constant
<n0r1x>
wut
n0r1x has quit [Ping timeout: 260 seconds]
n0r1x has joined #crystal-lang
<n0r1x>
It's like my array suddenly changes value without anything leading to it
<RX14>
n0r1x, can you show code?
<FromGitter>
<bew> is there a shorter way to do something like: `caller.each {|c| puts c}` ?
<RX14>
@bew no
<FromGitter>
<bew> ok ty
n0r1x has quit [Ping timeout: 260 seconds]
n0r1x has joined #crystal-lang
<n0r1x>
It's like my array suddenly changes value without anything leading to it (excuses if this is a double post since my internet keeps falling out)
<FromGitter>
<schoening> I've used the three.js library in javascript quite a lot. Any recommendations for crystal? Something that supports loading 3d models and animate them? Or is there no such thing yet
<RX14>
there's probably nothing like it yet
<FromGitter>
<l3kn> @n0r1x: Swapping lines 22 and 23 should fix the rotation, you need to iterate over each line (y) first, then over each pixel in the line (x)
Guest84346 has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
unshadow has quit [Quit: leaving]
<FromGitter>
<l3kn> @schoening: Rendering the model to a gif file should be possible without too much work
<FromGitter>
<schoening> Nah I want full on 3d 😊
<n0r1x>
FromGitter, already fixed that one, but thank you :)
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest99943
Guest99943 has quit [Client Quit]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
splitty__ has quit [Quit: Leaving]
splitty_ has joined #crystal-lang
Qchmqs has quit [Ping timeout: 260 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
domgetter has joined #crystal-lang
<domgetter>
Is it possible to pass a "lambda" to map?
<domgetter>
The compiler says "cannot be used as a Proc argument type yet, use a more specific type", but I don't know what it means by 'more specific type'
<BlaXpirit>
domgetter, why dont you show code
<domgetter>
(0..5).map(-> (n : Int) { n.even?})
<domgetter>
I know in this case I can just do &.even?, but I was trying to learn for the general case of passing procs to map
<BlaXpirit>
uh good that you know then
<domgetter>
BlaXpirit: for the record, I'm only 3 days into Crystal, so I apologize for wasting time on something that might appear silly
<BlaXpirit>
i don't think this even works. if it expects a block, then it expects a block
<domgetter>
Ah okay, so it's not like Ruby where I can pass a proc as a block?
snsei has joined #crystal-lang
<RX14>
domgetter, you can
<domgetter>
One iteration of my code was (0..5).map(&-> (n : Int) { n.even?})
<RX14>
you can use &proc to pass a proc as the block
<domgetter>
That should have been the one I pasted when you asked, BlaXpirit
<RX14>
the error is that you can't use Int as an argument
<RX14>
you have to be more specific
<RX14>
i.e. Int32
<domgetter>
ahh
<RX14>
for the proc
<domgetter>
I thought it was referring to the proc itself
<domgetter>
thank you for the clarification
<RX14>
it kind of is referring to the proc itself
<RX14>
not it's usage
<BlaXpirit>
yeah it works then, sorry
<domgetter>
It works!
<RX14>
nice
<BlaXpirit>
I would guess that this & internally is equivalent to { |n| (->(n : Int32){ n.even? }).call(n) }
<RX14>
yup
<RX14>
says almost exactly that in the docs
<BlaXpirit>
not easy to find these docs, if you're not already reading through all of it
<domgetter>
I'm loving the way that Crystal deals with parameters and the &.method(args) syntax
<FromGitter>
<KCreate> If I have an enum `enum Reg : UInt8`, how can I use the enum values in places where a UInt8 is expected?
<RX14>
enum.value iirc
<FromGitter>
<KCreate> Thanks
<FromGitter>
<KCreate> BTW, what's the rationale behind not allowing `enum : UInt8` values in places where UInt8 values are expected?
balduin has joined #crystal-lang
balduin has left #crystal-lang [#crystal-lang]
greengriminal has joined #crystal-lang
<domgetter>
FromGitter: I can see an argument that enums are supposed to un-magicify magic numbers, so their type is the type of the enum, not of the type of the number it's wrapping, since that was the confusion in the first place
<FromGitter>
<elorest> Ok. I would have asked it here but I've seen @asterite mention a few times in git issues that I would be good to flesh out the Stack-Overflow crystal-lang tag.
<RX14>
i should write a nice shell script to open emacs and automatically gist it on close and copy the link to the clipboard
<RX14>
so I could just keyboard shortcut a code scrathpad
<FromGitter>
<elorest> Yeah that's a pretty good idea. I'm still on vim but should do the same thing.
<RX14>
I can SPC g g B to gist a buffer already... I guess just a keyboard shortcut to a acratch file would be nice
<FromGitter>
<elorest> @RX14 Do I need to use Channels for anything here with sockets? I guess you're using spacemacs?
<RX14>
i'm using spacemacs, yes
<RX14>
no channels needed
<RX14>
i'll flesh you out a full stackoverflow ansewer after i've had my dinner, BRB
<FromGitter>
<elorest> @RX14 Thanks a lot. We need to make crystal the next big thing. I've been doing ruby for 11 years and it's frustrating to see elixir, node, rust, and random js libraries that don't even fill the same use case to replace it.
<FromGitter>
<sdogruyol> @elorest hell yeah!
<domgetter>
elorest I think you're just missing conn = server.accept; message = conn.gets
<FromGitter>
<elorest> Thanks. That's what I gathered from what @RX14 posted above. I'll have to reread the difference between accept and accept?
<domgetter>
elorest one returns UNIXSocket, the other returns UNIXSocket or Nil
<domgetter>
Should the docs be changed for UNIXServer to show that a connection needs to be created first?
<FromGitter>
<elorest> I think so because that was confusing to me.
bjz has joined #crystal-lang
<FromGitter>
<renich> Hello, I'd like to have a yaml file with multiple levels for configuration, but would love to access the values in *settings.credentials.key* form
<FromGitter>
<renich> how should I read the file to map this?