Intro to Elixir

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ม.ค. 2025

ความคิดเห็น • 15

  • @mattwidmann6069
    @mattwidmann6069 9 ปีที่แล้ว +17

    Erlang does not create multiple OS processes. It all runs in a single OS process which will create multiple schedulers which are native OS threads.
    Just wanted to correct that statement because it was slightly off...

  • @timatinterwebs
    @timatinterwebs 9 ปีที่แล้ว +10

    In your pmap function the send statement should be 'send(me, {self, func.(elem)})'. That will work.

  • @aion2177
    @aion2177 7 ปีที่แล้ว +1

    i love this language :) ! The inline tests + documentation are a beast! Wish i started learning it sooner :))

  • @przadka
    @przadka 9 ปีที่แล้ว +3

    i am quite new to Elixir, but think the problem in the pmap function is related to the fact that your are not pattern mathing against messages you want to receive. earlier in the tutoral you say, that send should return tuple like {:hello, "hello"} which you could pattern-match against {:hello, str}. in the pmap function your are not sending a tuple back - you are just sending a result of the funtion call. and you are trying to match that against {pid, result} which seems to fail. here is a corrected version that worked for me:
    def pmap(list,func) do
    me = self
    list
    |> Enum.map(fn(elem) -> spawn(fn -> send(me,{:result, func.(elem)}) end ) end )
    |> Enum.map(fn(pid) ->
    receive do
    {:result, result} -> result
    end
    end)
    end
    again, im new to this, so sorry if i am saying something stupid. just trying to learn new stuff :)

  • @victorb9503
    @victorb9503 9 ปีที่แล้ว

    this really is somewhat similar to prolog and to another language I had back at the university, called maude. very nice

  • @RonierisonMaciel
    @RonierisonMaciel 10 ปีที่แล้ว

    which editor you use?

    • @petebroderick
      @petebroderick 10 ปีที่แล้ว

      Sublime Text 3 with the Twilight color scheme

    • @RonierisonMaciel
      @RonierisonMaciel 10 ปีที่แล้ว

      Pete Broderick thank you

    • @petebroderick
      @petebroderick 10 ปีที่แล้ว

      Ronierison Maciel you're very welcome

    • @RonierisonMaciel
      @RonierisonMaciel 10 ปีที่แล้ว

      Pete Broderick grateful

  • @fernandoschuindt1665
    @fernandoschuindt1665 8 ปีที่แล้ว +1

    The pmap function didn't worked at IEx (just runs for ever) because the IEx has a different PID itself. Use "$ elixir misc.exs" and it will work just fine.

  • @sp1n3team
    @sp1n3team 9 ปีที่แล้ว

    haha, even the guy who is doing the lecture can't get the syntax right :D

  • @kalit001
    @kalit001 9 ปีที่แล้ว +1

    Feels a bit like you sat with it for an hour and then wrote the talk. Spend a bit more time before you do presentations in the future.

    • @thomaswhelton8864
      @thomaswhelton8864 8 ปีที่แล้ว +1

      One thing I really hate about a lot of tech talks. Sounds like he wrote down a list of topics to talk about rather than really designing the presentation- writing a presentation should take more time than writing an article on the topic, not less. It's a fundamentally different activity than casually taking a few minutes at work to show a coworker the ropes with something. At least he didn't just make 45 minutes worth of powerpoint slides and read them.