OvermindDL1

OvermindDL1

Coding challenge: Force non-equality - runtime

I’m curious if anyone would be interesting in giving and trying an occasional coding challenge (perhaps a new tag or category could be made if it gets popular). These would not be ones like Exercism has or so, but strictly challenges to try to solve language-specific tasks that you may never run across in real-life. Let’s do a simple task as an example:

Force non-equality - runtime

Given this code:

defmodule Testing do
  def f() do
    # Put 1-expression
  end

  def test() do
    false = ( f() == f() )
    true
  end
end

Fill in the # Put 1-expression here with code to make the test pass where calling Testing.test() returns true.

Most Liked

JEG2

JEG2

Author of Designing Elixir Systems with OTP

This code challenge is making me have impure thoughts. :laughing:

Qqwy

Qqwy

TypeCheck Core Team

The weird thing about anonymous functions, is that each definition creates a new anonymous function object. But if you assign an anonymous function to a variable, or compile a module that contains it in one of its functions, then this will only create one anonymous function object, and so it will be equal to itself.

gregvaughn

gregvaughn

:erlang.monotonic_time

Last Post!

OvermindDL1

OvermindDL1

True, just recently I added ocaml and rust to an Elixir Ports benchmark on a github repo recently. I like the test to see how things go. ^.^

Where Next?

Popular in Discussions Top

PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement