These are chat archives for got-lambda/expression

5th
Dec 2017
Jean-Louis Giordano
@Jell
Dec 05 2017 08:57
today's AoC was interesting :)
got a 2x speedup from using transient in Clojure
looking forward to trying out the PureScript and Idris version
Magnus Therning
@magthe
Dec 05 2017 08:58
Transient?
Jean-Louis Giordano
@Jell
Dec 05 2017 09:00
safe thread local update-in-place, bypassing the immutability by default
(the algorithm for today is clearly faster when implemented mutably)
on the other hand, it's only 2x slower with immutable datastructures in Clojure which I think is quite impressive
jolod
@jolod
Dec 05 2017 09:05
I'm lagging: Here's my solutions for yesterday. perl -nE'$invalid += /\b(\S+)\b.+?(\b\1\b)/; END { say $. - $invalid }' < day4.txt
(Part 1)
Magnus Therning
@magthe
Dec 05 2017 09:07
What kind of problem is it today, and what algorithm did you settle on?
jolod
@jolod
Dec 05 2017 09:32
And here's part two (yes I registered). perl -nE'my $is_invalid; my %words; $words{$_}++ && $is_invalid++ for map join("", sort(split //)), split; $invalid++ if $is_invalid; END { say $. - $invalid }' < day4.txt
It's a bit fun to brush up on my Perl.
Jean-Louis Giordano
@Jell
Dec 05 2017 09:32
I've hit a hurdle in purescript because I did not manage to use Lazy lists (the head doesn't get properly released when doing lookups, tried for a couple of days then gave up and went the eager way)
(on day 3)
Idris is really really fun though :) I've got to prove 2 != 0 so that I could have a total versions of Day 1 & 2
I also got to use type providers in day 4
will have to try quasiquoting in idris at some point
Jean-Louis Giordano
@Jell
Dec 05 2017 09:40
(can't run the idris code at the repl though because it's too slow without type erasure, but the REPL works awesome for writing the code and the proofs, then build & run to get the answer)
(of course type erasure in Idris given gradual typing means also unused proof erasures, that's why the speedup)
Jean-Louis Giordano
@Jell
Dec 05 2017 09:52
also for future reference: https://yourlogicalfallacyis.com
Veit Heller
@hellerve
Dec 05 2017 09:58
i solved today using carp, and it was a breeze
Erik Svedäng
@eriksvedang
Dec 05 2017 09:58
sweet! I'm on it...
Jean-Louis Giordano
@Jell
Dec 05 2017 09:59
nice! right today should be the perfect fit for carp!
Veit Heller
@hellerve
Dec 05 2017 10:00
it was damn fast, too
Magnus Therning
@magthe
Dec 05 2017 10:00
@Jell is that a reference for yesterday?
Veit Heller
@hellerve
Dec 05 2017 10:01
time gives me 0.005s in total (with user and system both being 0)
Jean-Louis Giordano
@Jell
Dec 05 2017 10:01
epic @hellerve
Veit Heller
@hellerve
Dec 05 2017 10:02
the second one, on the other hand, takes almost a second
Jean-Louis Giordano
@Jell
Dec 05 2017 10:06
yes it is @magthe, that was not an attempt at passive aggressiveness or reviving the topic though
just thought it was useful info to share so that we have a common vocabulary in the futur
Magnus Therning
@magthe
Dec 05 2017 10:08
@Jell no worries... it as a similar sight I looked at to figure out that you were talking about the logical fallacy called appeal to authority (or, as it's also known appeal to false authority)
if you had slipped in the words logical fallacy I would have understood you sooner
magthe @magthe deleted stuff to not dampen the mood
Magnus Therning
@magthe
Dec 05 2017 10:39
So, how many of you are doing AoC?
Should there be a got-lambda leader board?
Marco Zocca
@ocramz
Dec 05 2017 10:43
I kinda got bored with it, rather work on my own projects
jolod
@jolod
Dec 05 2017 10:43
@magthe I did not even register (so I didn't realize that there was a part two until someone said it and then still didn't find part 2...), because I have absolutely no interest in leaderboards or collecting stars.
Magnus Therning
@magthe
Dec 05 2017 10:44
Haha, OK
I won't do it this year. I got enough of it last year, it was quite a lot of "more of the same", and I suspect this year to rather similar.
jolod
@jolod
Dec 05 2017 10:50
I haven't done it previous years, and probably won't do many this year, unless I can use regexes ;-), but I think it's a good way to practice in a new language. Or refresh an old one.
Magnus Therning
@magthe
Dec 05 2017 10:51
@jolod yes, and fun... well, at least more fun than many other ways
Jean-Louis Giordano
@Jell
Dec 05 2017 10:55
yeah I don't care much for leaderboards, but I'm interested in discussing various solutions!
also finally gives me something to work on in Idris and PureScript
Magnus Therning
@magthe
Dec 05 2017 10:57
After I finished last years AoC I was considering putting together a presentation on my solutions, they fell into a fairly small set of types. That petered out though.
Jean-Louis Giordano
@Jell
Dec 05 2017 10:58
ah! that could be interesting for after christmas!
jolod
@jolod
Dec 05 2017 10:58
Actually, this could be a neat meetup.
Jean-Louis Giordano
@Jell
Dec 05 2017 10:58
yeah!!
jolod
@jolod
Dec 05 2017 10:59
@Jell I'm all for postponing the component/system meetup in favor of an AoC meetup.
Jean-Louis Giordano
@Jell
Dec 05 2017 10:59
we should maybe announce it asap then? so that people have the time to walk through the problems if they want to present
Erik Svedäng
@eriksvedang
Dec 05 2017 11:00
great idea!
Magnus Therning
@magthe
Dec 05 2017 11:00
@Jell good idea
jolod
@jolod
Dec 05 2017 11:00
Either we can do presentations, but perhaps an even more interesting approach would be to take a few of them that are extra interesting, and do a workshop?
Magnus Therning
@magthe
Dec 05 2017 11:00
@jolod also a good idea!
Jean-Louis Giordano
@Jell
Dec 05 2017 11:00
yep also good!
jolod
@jolod
Dec 05 2017 11:00
Would be useful for people that perhaps don't know how to approach the problems functionally.
Jean-Louis Giordano
@Jell
Dec 05 2017 11:01
yes!!
jolod
@jolod
Dec 05 2017 11:01
So they can do the imperative approach using their favorite language, and then work together with someone that knows how to do it functionally.
Magnus Therning
@magthe
Dec 05 2017 11:01
Yes, and by picking a bit carefully it will be possible to cover a few different / common types of solutions
jolod
@jolod
Dec 05 2017 11:01
Right. Both "this fits perfectly for functional" and "this is perhaps not so nice for functional".
Jean-Louis Giordano
@Jell
Dec 05 2017 11:02
ok I'm off for lunch now, I'll check for availabilities later today and make an annoucement for a meetup sometime in january?
Magnus Therning
@magthe
Dec 05 2017 11:02
@jolod yes, and even within the fit-for-functional, we could have one that "shouts out for a state machine" another for a tree-building / traversal (with state, without state) and a third for an evaluator (with state / without state)
jolod
@jolod
Dec 05 2017 11:03
I'm sure we'll have a few good ones by December 24. :-)
Magnus Therning
@magthe
Dec 05 2017 11:03
@jolod and maybe one that calls for RE? ;)
jolod
@jolod
Dec 05 2017 11:04
Obviously!
RE is a declarative language, so I think it fits...
Honstly, if anyone does it in Prolog that would be cool as well.
Magnus Therning
@magthe
Dec 05 2017 11:06
There was a group that looked at mini kanren, maybe that'd be a reasonable Prolog replacement?
jolod
@jolod
Dec 05 2017 11:07
Clojure's core.logic would also work I guess. And it's in an anotherwise FP language, so that's good.
Magnus Therning
@magthe
Dec 05 2017 11:07
:thumbsup:
jolod
@jolod
Dec 05 2017 11:08
Btw, @magthe , yesterday I started writing my own Regex library in PS. Global is not a flag. The only flag left is case sensitivity.
(Or rather, all RegExp objects are compiled with global, but I use exec() so I can manually control it.)
Magnus Therning
@magthe
Dec 05 2017 11:09
Is there a reason why case sensitivity still is a flag?
Veit Heller
@hellerve
Dec 05 2017 11:09
i wrote a little grep library in carp, but then mutual recursive functions stopped me
jolod
@jolod
Dec 05 2017 11:09
That's how the JS object works.
Veit Heller
@hellerve
Dec 05 2017 11:09
i’d love to see your ps lib
Magnus Therning
@magthe
Dec 05 2017 11:09
Oh, so you are still tying it to the built-in JS RE?
jolod
@jolod
Dec 05 2017 11:10
@magthe I'd be crazy otherwise.
Magnus Therning
@magthe
Dec 05 2017 11:10
@jolod Oh, why?
jolod
@jolod
Dec 05 2017 11:10
I'm not going to write my own engine or parser.
magthe @magthe is thinking that what react does used to be labeled "crazy" too ;)
Magnus Therning
@magthe
Dec 05 2017 11:11
Constraints on developer time is a good reason.
jolod
@jolod
Dec 05 2017 11:11
I'm not saying that it would be crazy to not use it in general. It would be crazy for me to not use it.
Magnus Therning
@magthe
Dec 05 2017 11:12
:thumbsup:
jolod
@jolod
Dec 05 2017 11:12
I also realized that there's also this unicode flag left.
I don't think I want them to be flags though.
I'd prefer to have like data Pattern = Pattern String | UnicodePattern String or something. Case insensitive can perhaps be a flag. But then it's just a single boolean so it's less of a flag really.
Marco Zocca
@ocramz
Dec 05 2017 12:18
is Carp indentation sensitive?
Erik Svedäng
@eriksvedang
Dec 05 2017 12:20
Yuck, no :)
Marco Zocca
@ocramz
Dec 05 2017 12:20
so what's happening in square brackets here:
(defn answer [ints f]
  (let [pos 0
            len (count &ints)
            steps 0]
in the original, pos len and steps are in column
Erik Svedäng
@eriksvedang
Dec 05 2017 12:21
Someone forgot to press the auto indent button it seems!
Veit Heller
@hellerve
Dec 05 2017 12:21
bind pos to 0, len to (count &ints), and steps to 0`. the indentation helps to understand it visually
Erik Svedäng
@eriksvedang
Dec 05 2017 12:22
Ah, now I see what you mean, sorry
Marco Zocca
@ocramz
Dec 05 2017 12:22
so you could also write them on the same line
Veit Heller
@hellerve
Dec 05 2017 12:22
you could also put it all in one line, and i sometimes do for small lets, but it’s weird
yup
Marco Zocca
@ocramz
Dec 05 2017 12:22
right
but square brackets are not so lispy
is it a Clojure thing?
Veit Heller
@hellerve
Dec 05 2017 12:22
tell that to clojure and racket
it is
Marco Zocca
@ocramz
Dec 05 2017 12:23
right, I used to be a Common Lisp crank
before turning to the One True FP Language
joking joking
Veit Heller
@hellerve
Dec 05 2017 12:23
perl?
Marco Zocca
@ocramz
Dec 05 2017 12:23
: D
Veit Heller
@hellerve
Dec 05 2017 12:24
racket is even weirder: it doesn’t matter whether you use square brackets or parens
they have to match though
and the rest is just convention, but there are a lot of them
jolod
@jolod
Dec 05 2017 13:45
Seriously though, Perl is relatively good for FP. Well, not really, but list context, which is a pretty unique feature, optional parenthesis, and block syntax make for an interesting combo. They play together quite well.
Jean-Louis Giordano
@Jell
Dec 05 2017 13:56
ok sharing here because this is really cool: https://www.maria.cloud/intro
Magnus Therning
@magthe
Dec 05 2017 14:26
Isn't Maria the name of the FOSS fork of MySQL?
It's nice!
Is there evidence that this sort of learning tool is effective for self-studies? (I suspect it is.)
Jean-Louis Giordano
@Jell
Dec 05 2017 14:42
this tool in particular is also used as part of some curriculum, but the authors of the tool have gotten empirical results with self-studies as well from non-coders, and it's kind of part of their intent / belief to see if that work
I think things like Elm are another empirical result that self-studies on a platform that requires no setup with human-like feedback is really efficient (tons of people moving to FP through Elm)
jolod
@jolod
Dec 05 2017 14:45
@Jell Tons? Really? :-)
Jean-Louis Giordano
@Jell
Dec 05 2017 14:45
well if you count body weight maybe :p
that's like, 100 people?
ok hyperboling, just within my bubble I suppose
jolod
@jolod
Dec 05 2017 14:46
That is an excellent user statistic.
Jean-Louis Giordano
@Jell
Dec 05 2017 14:46
yeah we have tons and tons of users
as in, like, 200
jolod
@jolod
Dec 05 2017 14:49
Yeah. Bubbles are deceiving. When I was in the Clojure bubble I thought Clojure was "pretty big now" a couple of years ago. But then I saw how many users compared to other tiny languages. It wasn't pretty big. :-(
Jean-Louis Giordano
@Jell
Dec 05 2017 14:50
yeah :p it's deceiving.
Veit Heller
@hellerve
Dec 05 2017 14:52
"tons of interesting people" might be closer to the trtuh, at least with my personal take on "interesting"
jolod
@jolod
Dec 05 2017 14:52
But Clojure is cool because while the community is small it attracts "the right kind of people".
@hellerve :-)
Veit Heller
@hellerve
Dec 05 2017 14:53
jinx’d ya
Jean-Louis Giordano
@Jell
Dec 05 2017 14:53
confirmation bias is hard to circumvent :p
jolod
@jolod
Dec 05 2017 14:54
At the latest conj keynote you can tell, even though it's off camera, that Clojure generally do not attract new programmers. Rich started at "who here can be programming longer than five years" and I got the impression that that was pretty much everyone. He went up to 20 I think.
He was not asking about programming Clojure. Just programming in general.
Jean-Louis Giordano
@Jell
Dec 05 2017 14:56
btw, another useful source of info around biases: https://yourbias.is/
jolod
@jolod
Dec 05 2017 14:56
No, looked at the transcript. He ended with that.
"It may be an indictment of Clojure as a beginner's language or may be that Clojure is the language for cranky, tired, old programmers. [audience laughter and applause]"
jolod
@jolod
Dec 05 2017 19:27
Does anyone here know what the u flag really means in JS RegExp objects? MDN says 'The "u" flag enables various Unicode-related features. With the "u" flag, any Unicode code point escapes will be interpreted as such, for example.'
What are these other various features?
Marco Zocca
@ocramz
Dec 05 2017 19:43
don't know js señor
jolod
@jolod
Dec 05 2017 20:00
@ocramz I found a blog post about it. It makes a lot of difference to char classes.