ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<hightower3> Papierkorb, gonna add @signal#name to Cute?
<Papierkorb> hightower3: just did. don't wanna put out a new version just for that though - especially not at this time of day.
<hightower3> Sure, I always use the checkout, not versions.
<hightower3> All good
<FromGitter> <bew> btw @oprypin @Papierkorb, WDYT about the idea? (not the implementation details)
<Papierkorb> bew, haven't found a use-case for that yet. Macros are really powerful as they are already.
<FromGitter> <bew> for the use-cases I have some, but nothing to explain now (and not "at this time of day" too)
<oprypin> these ideas sounded like the implementation of an actual interpreter
<oprypin> but then i thought about it and i dont see a big breakthrough from such an idea
<hightower3> Papierkorb, also, still open for suggestions on how to implement a one-time trigger, since the awesome-if-worked idea of def once( ..., &block) on( ...) { yield } doesn't work in Crystal.
astronavt has joined #crystal-lang
<FromGitter> <bew> hmm currently don't have thought a lot about that (@oprypin). I was thinking it as a thinking draft on remote processes that could have access to some internal data of the compiler, without having to embed it by require-ing it. this could leads to compiler plugins (in a looong time ^^), or other stuff
<FromGitter> <bew> probably
<hightower3> Papierkorb, do I see it right that in Cute middleware listeners are conveniently collected in @listeners, yet for basic signals (no middleware) there is no such list?
<hightower3> Oh not, looks like everyone is in @listeners, all good
snsei has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
Poeticode has quit [Ping timeout: 248 seconds]
Poeticode has joined #crystal-lang
Poeticode has quit [Changing host]
Poeticode has joined #crystal-lang
sp4rrow has joined #crystal-lang
sp4rrow_ has joined #crystal-lang
sp4rrow has quit [Ping timeout: 258 seconds]
pabs has quit [Ping timeout: 246 seconds]
hightower2 has quit [Ping timeout: 246 seconds]
pabs has joined #crystal-lang
sp4rrow_ has quit [Quit: The Internet needs a break and I need a cookie]
_whitelogger has joined #crystal-lang
kali_ is now known as kali___
astronavt has quit [Remote host closed the connection]
<FromGitter> <codenoid> hi, how to load 100% of javascript rendered website using HTTP::Client,
sp4rrow has joined #crystal-lang
byteflame has joined #crystal-lang
ryanf has quit [Remote host closed the connection]
<FromGitter> <codenoid> and how i can make http::client render 100% loaded web data
<watzon> You need `HTTP::Server` not `Client` http://devdocs.io/crystal/api/0.23.0/http/server
<watzon> Look at the docs
<watzon> Or you can use a framework like Kemal http://kemalcr.com/
<FromGitter> <codenoid> i want to scrap a javascript website, not serve a javascript website :/
<FromGitter> <codenoid> i want to scrap a javascript website, not serving a javascript website :/
<watzon> Ok then. http://devdocs.io/crystal/api/0.23.0/http/client#get(path,headers:HTTP::Headers?=nil,body:BodyType=nil):HTTP::Client::Response-instance-method
<watzon> If it's 100% javascript rendered though you're SOL
<FromGitter> <codenoid> what SOL ? '-'
<watzon> You'd need something like Selenium
<FromGitter> <codenoid> yup
<watzon> Shit Out of Luck
<FromGitter> <codenoid> woh
<watzon> Not sure what the status is on it, but it was developed by ysbaddaden so it's probably pretty good
<byteflame> Using `crystal-db` with `crystal-pg` `db.query_one("select * from foo where bar = ?", "value")` sends the query as-is (including question-mark)
<byteflame> Issue is I'm stupid and forgot postgres' `?` is `$n`
Guest31091 has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <codenoid> `pretty good` If he still takes care of it 😟
<watzon> That’s the case with any shard though codenoid. I’m sure it’s good
Guest31091 is now known as alex```
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
olbat has quit [Quit: Bye ...]
alex``` has quit [Quit: WeeChat 1.9]
alex`` has quit [Quit: WeeChat 1.9]
alex` has joined #crystal-lang
alex` is now known as Guest27960
<FromGitter> <LuckyChicken91_twitter> is someone here having a good program idea?
<FromGitter> <LuckyChicken91_twitter> im bored
<FromGitter> <bew> A good program idea is yours to find out. A good/interesting program for me might not be good for you. Also, "a good program" is a very wide subject: do you want to do a fun thing? A useful thing? A mini game? A never-been-done thing? ...
<FromGitter> <LuckyChicken91_twitter> maybe a game
<FromGitter> <bew> Also I'm sure there are websites full of ideas of programs to do
<FromGitter> <LuckyChicken91_twitter> do you know one?
A124 has quit [Remote host closed the connection]
<FromGitter> <bew> I do, but you should find one that motivates you, there are plenty of mini games you can take inspiration from
<FromGitter> <bararchy> @LuckyChicken91_twitter Try to do a soduko\soliter\etc.. game with Crystal and maybe crSFML
A124 has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> i never understanded soduko or soliter ;D
<FromGitter> <bew> Look at the answers, there are good ideas: https://gamedev.stackexchange.com/questions/854/what-are-good-games-to-earn-your-wings-with
<FromGitter> <LuckyChicken91_twitter> ooh now im having an game idea again
bmcginty has quit [Ping timeout: 258 seconds]
bmcginty has joined #crystal-lang
bmcginty has quit [Ping timeout: 246 seconds]
bmcginty has joined #crystal-lang
bmcginty has quit [Ping timeout: 255 seconds]
bmcginty has joined #crystal-lang
greengriminal has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> can I change the terminal background color with crystal? or with an command?
<oprypin> LuckyChicken91_twitter, you cannot do that directly, what you can do is set the background color for a character and overwrite the whole screen with that characta
<oprypin> but dont do that probably?
<FromGitter> <LuckyChicken91_twitter> hm. If crystal whould support windows then i could easily use the windows command "color f0"
<oprypin> or you could just stop using the damn terminal
<oprypin> in crazy ways, anyway, because now i realize it's your only option on windows
<FromGitter> <LuckyChicken91_twitter> i could just stop using the damn terminal?! you mean i should use GUI? theres still no GUI framework
<FromGitter> <LuckyChicken91_twitter> this is the problem
<oprypin> LuckyChicken91_twitter, but you're not using a GUI framework in the terminal either, so what's the advantage?
<FromGitter> <LuckyChicken91_twitter> how should i use gui in the terminal?
<FromGitter> <bararchy> Wasn't there someone working on QT bindings ?
<FromGitter> <LuckyChicken91_twitter> i hope so
<oprypin> bararchy, that'll take months, in the best case
<oprypin> (not me working on it, btw)
<FromGitter> <bararchy> There is Crystal ncurses
<FromGitter> <bararchy> Can be used also
<FromGitter> <bararchy> Better then terminal , and has more control
<FromGitter> <LuckyChicken91_twitter> i prefer the terminal
<FromGitter> <LuckyChicken91_twitter> The good old terminal.
<oprypin> how can terminal be better than terminal and how can a framework for terminal have more control than terminal?
<FromGitter> <LuckyChicken91_twitter> i dont know
<oprypin> ncurses only provides a convenient wrapper for what crazy things you're already doing (for some definition of convenient)
<watzon> What he said
<oprypin> in fact i'm sure it supports background color by automating and persisting the character background color
<oprypin> not that i condone making UIs in terminal
<FromGitter> <bararchy> Can't crSFML be used for UI?
<FromGitter> <bararchy> Even though it might be an overkill
<oprypin> yes, it can. surely better make GUIS in that without a GUI framework than a terminal without a GUI framework
<oprypin> but it's Windows, remember
<watzon> Really at this point if you want good GUI support either make the bindings yourself (long project) or use something like Rust which already has bindings to just about everything including QT
<watzon> Especially if you're developing on Windows. WSL isn't going to be able to give you good GUI support
<oprypin> yeah i can imagine the great successes LuckyChicken91_twitter achieves when using Rust
<watzon> 🀣
<watzon> It would be fun to see the #rust:matrix.org group light up
<watzon> I've found them to be a little less helpful
<FromGitter> <bararchy> lol
<FromGitter> <LuckyChicken91_twitter> i think i could use crsfml on windows
<oprypin> you could use it with a fork of crystal and be on the minefield with the possibility of anything crashing at any point
<FromGitter> <LuckyChicken91_twitter> oh thats sounds interesting
<FromGitter> <bararchy> oprypin did a guide on how to do that
<FromGitter> <bararchy> But... Why use windows ?
<watzon> Seriously. Windows + Crystal + GUI is just asking for trouble
<FromGitter> <codenoid> lol
<FromGitter> <bararchy> Yeha lol
<dom96> ...or use something like Nim which has first-class Windows support ;)
<FromGitter> <bararchy> I'll take a swing at basic UI using crSMFL , maybe a port scanner or something similar
<FromGitter> <codenoid> πŸ˜†
alibby has quit [Quit: Leaving.]
Guest27960 is now known as alex``
<FromGitter> <Val> Hello, does a `@[Link(ldflags: "-lfoo")]` line in source provide the same behaviour than `crystal build --link-flags="-lfoo"` ?
HTTP_____GK1wmSU has joined #crystal-lang
HTTP_____GK1wmSU has left #crystal-lang [#crystal-lang]
<oprypin> i think so. but why would you use link ldflags and not just link
farmannndhgh has joined #crystal-lang
<farmannndhgh> hii
<farmannndhgh> what the fucky fuck
<farmannndhgh> ?
<farmannndhgh> heyyooo
<farmannndhgh> πŸ•΅πŸ½β€β™€οΈ
<farmannndhgh> πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘
farmannndhgh has quit [Client Quit]
<Papierkorb> with that in mind, who in here has mod privileges?
<Papierkorb> *op
<oprypin> RΠ₯14
<oprypin> even so, gitter is still wild west
<Papierkorb> And only one op isn't that great either
<oprypin> technically there are more but yeah........
<RX14> how did that not ping me oprypin
<RX14> also i think i am OP in gitter
<oprypin> oh cool
<RX14> well, i'm pretty sure i am since i can edit the topic
<oprypin> RX14, lol that was intentional R{CYRILLIC CAPITAL LETTER HA}14
<RX14> thing is people are always long gone by the time I notice they need a ban
<RX14> oprypin, it's better to use a zwsp
<RX14> RX<zwsp>14
<oprypin> yeah but i dont have it handy
<RX14> i only use that trick in bots
<oprypin> gitter bridge bot uses zwsp when u type :) etc
<RX14> yeah i forgot you would know about that
<FromGitter> <muhajirframe> can we actually run crystal on windows? I mean the compiled crystal?
<FromGitter> <bararchy> We need easy to use template for answers :)
<FromGitter> <bararchy> "/template windows"
<FromGitter> <bararchy> that would be cool in a bot context
<oprypin> muhajirframe, there is a fork of crystal that supports producing Windows binaries, with most of the standard library not working
<oprypin> bararchy, DeBot has that, except it's inactive and doesnt care about Gitter
<FromGitter> <bararchy> Oh
<FromGitter> <Val> @oprypin (sorry for the lag) because I found that `@[Link(ldflags: "-lfoo")]` doen't work, see https://github.com/datanoise/mongo.cr/issues/22 . When using `--link-flags` it works :-/
<oprypin> Val, what does yajl have to do with anything?
<oprypin> man
<FromGitter> <Val> (I'm in a train, connection will hangs)
<FromGitter> <bararchy> Is there a Dir.random kinda interface ? Can't find in docs
greengriminal has quit [Quit: This computer has gone to sleep]
<oprypin> bararchy, what's that even supposed to mean
<FromGitter> <bararchy> Sorry, I meant Dir.mktmpdir or Dir.tmpdir
<FromGitter> <bararchy> like that
<oprypin> i don see any built in way to create a temporary directory
<RX14> thats now what you want though oprypin
<RX14> not*
<oprypin> no, i did not mean to refute my previous statement with this link
<RX14> yeah i did notice the lack of atomic tempoary directory creation
<RX14> not sure if it's required as much though
<FromGitter> <bararchy> TBH the tmpfile does answer my needs
<FromGitter> <bararchy> So, for my usecase that's enough :)
<oprypin> just got bitten so hard by this - missed a comma at the end
<RX14> i think i'd consider disallowing assignment in subexpressions
<RX14> assignment in if and while is a good thing, but not nested
<oprypin> that's not the problem here
<Yxhuvud> I guess the counterexample would be x = y = z = 1. which people will try.
<RX14> hmm
<RX14> that's fine though
<RX14> that counts as just multiple assignment to me
<oprypin> i think trailing commas should be a syntax error
<oprypin> that's all
<Yxhuvud> oprypin: that should be handled by the formatter, no?
<Papierkorb> Trailing comma is common for multiline expressions.
<RX14> ^
<Yxhuvud> or discovered through
<RX14> like args to a function
<RX14> that's like one of the most common ways to continue a line
<oprypin> Papierkorb, show me an example for such a multiline expression
<RX14> foo("bar",
<oprypin> I say you must wrap it in brackets to use multiline expressions
<RX14> "baz")
<oprypin> i don't include such a case as trailing comma
<RX14> yeah but perhaps thats easier said than done
<Papierkorb> oprypin: Pretty much all `record` macro uses
<RX14> maybe we should just accept that sometimes your typos will have unintended consequences
<Papierkorb> Yes please.
<RX14> maybe some time in the future we should spend effort in making more typos be compile errors
<Papierkorb> Well that's what a linter can do at edit time
<RX14> but really, just fix it and move on
<Yxhuvud> my pet peeve in the area is what happens if you miss a space in the type declaration for a field of a Record
<RX14> anyway
<RX14> as Yxhuvud said
<RX14> the formatter formats that
<RX14> format on save solves this
<RX14> although it still looks wrong
<RX14> a = 5, b = 6
<RX14> what's a here
<RX14> without thinking, 5
<Yxhuvud> weird code looking wrong is ok! it is an incentive to write good code
<oprypin> this is not ok
<RX14> no i agree it's not ok
<RX14> but is there anything we can really do about it without introducing bunches of weird rules
<RX14> it's complexity, and that has it's own cost
<oprypin> i always put assignment inside brackets (if it's not top level), would be nice to enforce that
<Papierkorb> ..?
<RX14> actually yeah we should do that in the formatter
<oprypin> also allowing `a = 5, 6` is bad
<oprypin> Papierkorb, i never write if a = some_expr, i write if (a = some_expr)
<RX14> perhaps 5, 6 is bad
<RX14> is it too bad that swaps have to be a, b = {b, a}
<Papierkorb> oprypin: I don't :+1:
<RX14> why else do we have the a, b = b, a syntax
<RX14> if a = some_expr is perfectly clear
<oprypin> look i have no idea why we have that syntax, it's just copying from other languages
<Papierkorb> RX14: Are swaps that common? I didn't need it yet. You wouldn't hear me complaining about changing (or not changing) that.
<RX14> yeah perhaps removing that syntax is good
<oprypin> right, these all weirdnesses are directly from ruby
<RX14> maybe do a quick remove and see if there are any legit usecases in the stdlib
<oprypin> python has it exactly the same though T_T
<RX14> by making it compile again
<oprypin> RX14, if a = some_expr is not clear because it could be an equality check
<RX14> well i'd be against requiring brackets on that
<RX14> it seems that if we did that we'd just get style guides enforcing if(expr) for everything
<Papierkorb> One of the theoretic issues I never had.
<RX14> which is ugly
<oprypin> RX14, that's entirely different, please don't derail it like that
<RX14> if expr = @nillable_ivar is common for me
<oprypin> well you write that and formatter will change it
<Papierkorb> RX14: sometimes it feels like 50% of if's are exactly that
<oprypin> a = (5, b = 6) would come naturally with such a rule
<RX14> i wouldn't put it anywhere near 50% myself...
<RX14> oprypin, wouldn't that be {}
<oprypin> doing this but not doing it in an if is an exception
<RX14> since it creates a named tuple
<RX14> wait a sec why isn't that a named tuple
<oprypin> named tuple uses :
<RX14> no but in the case of `a, b = b, a`
<RX14> doesn't the carc.in result mean that that allocates an array?
<oprypin> this is `a = 5, 6`
<oprypin> it creates an array
<oprypin> also putting b=6 while it's at it
<RX14> no but it's the same syntax on the rhs
<Yxhuvud> probably a rubyism, but perhaps necessary. Is it always possible to know the count?
<oprypin> rhs shouldn't allow bare commas
<RX14> a, b = b, a is just the same as z = b, a but with destructuring
<RX14> right?
<oprypin> RX14, maybe, or maybe it's a special case
<oprypin> i'd disallow that and make formatter turn this into a = {5, (b = 6)}
<RX14> oprypin, i agree but i'm just confused as to why bare comma is creating arrays not tuples
<oprypin> cuz ruby
<RX14> *sigh*
<oprypin> it's probably older than tuples themselves
<RX14> oops a ibroke it
<RX14> i don't know where the rhs assignment is parsed though
<RX14> i get the crystal lexer
<RX14> but the parser is just foreign to me
mezoni has joined #crystal-lang
mezoni has quit [Client Quit]
<RX14> oops, L532
<oprypin> RX14, but the special case is for lhs, not rhs
<RX14> there are 3 cases
<oprypin> rhs here gets taken as an expression and then indexed as an array
<RX14> 1 lhs, 1 rhs, lhs.size == rhs.size
<RX14> if there's 1 lhs the right is treated as an array literal
<oprypin> 3rd case is not what you just called it
<oprypin> lhs size doesnt have to equal rhs size
<oprypin> wait, it does have to, sorry
<RX14> yup, you're thinking of 1 rhs
<RX14> which is expanding an expression into multiple vars
<oprypin> so uh delete this branch?
<RX14> which branch?
<RX14> the targets being 1 ?
<oprypin> yeah a = 1, 2, 3 should be an error
<RX14> i agree
<oprypin> or at the very least tuple
vegai has quit [Ping timeout: 240 seconds]
thelonelyghost has quit [Ping timeout: 240 seconds]
sija[m] has quit [Ping timeout: 240 seconds]
jplatte has quit [Ping timeout: 240 seconds]
Renich[m] has quit [Ping timeout: 264 seconds]
byteflame has quit [Ping timeout: 255 seconds]
TheGillies has quit [Ping timeout: 246 seconds]
watzon has quit [Ping timeout: 240 seconds]
olbat[m] has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] RX14 opened pull request #4824: Remove bare array creation from multi assign (master...feature/remove_auto_array) https://git.io/v7HmR
rizo[m] has quit [Ping timeout: 276 seconds]
<RX14> oprypin, done
braidn[m] has quit [Ping timeout: 255 seconds]
<Papierkorb> > while requiring "prelude": can't find file 'prelude' relative to '.../src/<Project>'
<Papierkorb> Looks like the linter in atom is drunk
liosha has joined #crystal-lang
<liosha> <Papierkorb> prelude problems happen when CRYSTAL_PATH is not set properly
liosha has left #crystal-lang [#crystal-lang]
d20master has joined #crystal-lang
<d20master> "warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking .build/crystal.o"
<d20master> I'm trying to cross compile the crystal compiler statically and I
<d20master> am one step away from complete it seems
<Papierkorb> Tried it compiling non-static? That is an artifact of static linking.
<d20master> I have not tried it non-static yet, but I am confident that would work non-static
<d20master> I know there is a way to specify that the glibc objects get dynamically linked; but I forget how
<d20master> here
<d20master> is the cc command I am running
<d20master> cc '.build/crystal.o' -o '.build/crystal' -static -rdynamic /root/git/crystal/src/llvm/ext/llvm_ext.o `/usr/bin/llvm-config-3.8 --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread /root/git/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib
<Papierkorb> cross-compiled to which platform?
<d20master> --cross-compile --target "x86_64-unknown-linux-gnu"
<d20master> ideally alpine linux
<Papierkorb> Why not use a normal dynamically linked compiler?
<Papierkorb> The compiler, or LLVM, might use dlopen() for various things. Though, have you tried simply removing '-ldl'?
<d20master> removing `-ldl` yields the same messaging
<d20master> as for a normally dynamically linked compiler - I have not tried that yet. maybe I am overcomplicating it
<d20master> I was anticipating there being issues between a compiler built in debian flavored linux vs running that compiler in alpine linux ( moby )
<Papierkorb> Yes. Just use a dynamically linked compiler. Everything else will be a world of pain
<Papierkorb> Why? Just recompile the compiler for different operating systems
<RX14> there's a compiler package for alpine
<RX14> just use that
<d20master> oh? do you have a link I can read more about that @RX14 ?
bazaar_ has quit [Quit: Reconnecting]
bazaar has joined #crystal-lang
<d20master> I am a stickler for security :-( @RX14 do you know the maintainer of that site? Do you think they would be willing to go forward with submitting the package to pkgs.alpinelinux.org ?
<RX14> yes
<RX14> the maintainer is a core developer of crystal
<RX14> ysbaddaden
<d20master> AWESOME! Thanks a bunch!
<RX14> the source files are on github
olbat[m] has joined #crystal-lang
bastelfreak has quit [Ping timeout: 258 seconds]
bastelfreak has joined #crystal-lang
vegai has joined #crystal-lang
byteflame has joined #crystal-lang
rizo[m] has joined #crystal-lang
Renich[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
TheGillies has joined #crystal-lang
watzon has joined #crystal-lang
jplatte has joined #crystal-lang
thelonelyghost has joined #crystal-lang
sija[m] has joined #crystal-lang
w-p has joined #crystal-lang
d20master has quit [Quit: Page closed]
hightower2 has joined #crystal-lang
sz0 has quit []
D33P-B00K has joined #crystal-lang
D33P-B00K has left #crystal-lang [#crystal-lang]
alex`` has quit [Quit: WeeChat 1.9]
greengriminal has joined #crystal-lang
_tsound has joined #crystal-lang
<_tsound> trying to cross-compile gave me [while requiring "c/dlfcn": can't find file 'c/dlfcn' relative to '/usr/lib/crystal']
<RX14> _tsound, what command did you use
<_tsound> [crystal build main.cr --cross-compile --target "i386-pc-elf"]
<RX14> we don't support that target
<RX14> that triple is only used for compiling for no OS
<RX14> use i386-linux-gnu
<_tsound> yeah i know i wanted to make an .img out of it
<RX14> oops, i686-linux-gnu
<RX14> you wanted to run it without an OS?
<RX14> then you need to remove the stdlib and start from scratch
<RX14> and you don't want to do that
<RX14> really
<_tsound> probably going to have to do that anyway
<_tsound> thanks though RX14
<RX14> removing the stdlib isn't as easy as just passing --prelude=empty
<RX14> the crystal compiler is strongly linked to the current stdlibn
<RX14> and you're going to end up stubbing out loads of different functions to get anything working
<RX14> _tsound, if you really want to do it, at least use this as a resource: https://github.com/TheKernelCorp/NuummiteOS
<_tsound> ohey that looks like what i want \
<_tsound> more or less
alex` has joined #crystal-lang
alex` is now known as Guest41613
sp4rrow has joined #crystal-lang
<FromGitter> <bararchy> Does this error makes sense to anyone ? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=598f74cc210ac2692079659d]
greengriminal has quit [Quit: This computer has gone to sleep]
<oprypin> bararchy, well seems like someone tries to convert that actual string to_i
<FromGitter> <bararchy> Well ... that's in the Core HTTP::Client, so.... a bug ?
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<oprypin> bararchy, i'd just really like to see what reproduces the bug
<FromGitter> <bararchy> I get it reproduced 100% of the times, against a specific application
<FromGitter> <bararchy> let me see how I extract the code the blows it out
<oprypin> seems to me more like a bug in traceback impl
<oprypin> bararchy, do you have macro run involved anywhere? perhaps ECR?
<FromGitter> <bararchy> Nope, just calling the Client with some wierd headers
_tsound has quit [Quit: WeeChat 1.9]
braidn[m] has quit [Ping timeout: 240 seconds]
jplatte has quit [Ping timeout: 240 seconds]
byteflame has quit [Ping timeout: 240 seconds]
thelonelyghost has quit [Ping timeout: 258 seconds]
TheGillies has quit [Ping timeout: 258 seconds]
Renich[m] has quit [Ping timeout: 255 seconds]
watzon has quit [Ping timeout: 240 seconds]
rizo[m] has quit [Ping timeout: 255 seconds]
sija[m] has quit [Ping timeout: 264 seconds]
vegai has quit [Ping timeout: 264 seconds]
olbat[m] has quit [Ping timeout: 255 seconds]
<oprypin> I have a function accepting one integer input, returning some output (monotonically increasing) and i want to find the output that's the closest to some value
<oprypin> i can use bsearch to find the smallest output that's >= the value
<oprypin> but it is possible that the largest output that's <= the value is the closer answer
<oprypin> so uh how can i do this without calling bsearch twice or something?
<Papierkorb> oprypin: just find the value first (or the nearest available), and then compare to the values 'around' it.
<Papierkorb> Err, just the one left/right to it
<Papierkorb> if you find the value itself, the difference is 0 anyway lul
<oprypin> the function is expensive
<Papierkorb> what, the comparison?
<Papierkorb> You only need one additional comparison over a bsearch
<oprypin> no, the function. you're saying compare the values around it which assumes recomputing or storing them
<Papierkorb> You said bsearch, thus I assumed you have all data, or at least, enough
<oprypin> Papierkorb, i have all inputs (0..size) and can compute outputs
<oprypin> i think i have a better idea. ignore the output of bsearch, and find the optimum manually, only relying on bsearch to limit the number of calls
greengriminal has joined #crystal-lang
<oprypin> yep
<oprypin> solution https://carc.in/#/r/2iqs cc Papierkorb
sp4rrow has joined #crystal-lang
<oprypin> can be done without the storage but boy is it ugly
sp4rrow has quit [Client Quit]
<oprypin> https://carc.in/#/r/2iqv yep totally ugly
<Papierkorb> and much more space efficient
<oprypin> i actually cant deal with this ugly solution, don't care Β―\_(ツ)_/
sp4rrow has joined #crystal-lang
olbat[m] has joined #crystal-lang