6 ms·
The Little Schemer Exercises in Elixir
- rozap 11y agoReading through this it becomes very apparent very quickly how concise, expressive, and elegant elixir is. The elixir versions seem to be on average 2/3 of the length of scheme, which is already fairly terse. These exercises are great for anyone curious about the language. While I drank the elixir koolaid a while ago, it continues to be a really pleasant language to write stuff in.
- davexunit 11y agoNote that modern Scheme implementations have pattern matchers that eliminate much of the car/cdr'ing done in the Little Schemer, making it much shorter.
- alvatar 11y agoYes, or just use match.scm which provides this functionality as well. The point of Scheme is not the features it has, but how it allows you to build the features yourself. Try doing logic programming in Elixir, probably it won't work that well (just probably, I don't know Elixir).
- rubiquity 11y agoErlang is greatly influenced by Prolog. The first Erlang implementation was actually written in Prolog. Erlang and Elixir are just fine for logic programming.
- asolove 11y agoThere's a good Elixir implementation of MicroKanren: https://github.com/lyons/ExKanren https://github.com/lyons/ExKanren
- juliangamble 11y agoThere is a whole bunch of implementations of The Little Schemer (and other great Lisp books) in Clojure here: http://juliangamble.com/blog/2012/07/13/amazing-lisp-books-living-again-in-clojure/ http://juliangamble.com/blog/2012/07/13/amazing-lisp-books-l...
- r0naa 11y agoI am completely unfamiliar with Elixir but I love the aesthetics of the language. That's a really neat piece of work, thank you for sharing. I often wonder what are some good usecases for Elixir? What kind of problem do you solve using Elixir?
- adrusi 11y agoIt runs on BEAM, the erlang vm, and has essentially the same usecases as erlang. Good for distributed systems, including web applications, bad for cpu bound tasks, for systems programming. Not great for scripting but usable if you want.
- rubiquity 11y ago> bad for cpu bound tasks Just to elaborate on this: Elixir is slower at CPU work than C/C++/Java but still significantly faster than Ruby/Python/etc. not to mention a lot easier to do work in parallel due to SMP and the BEAM's concurrency model.
- MCRed 11y agoPlus, if you have a big task it's a whole lot easier to add CPUs to do additional work in Elixir/Erlang than in any of those languages-- C/C++/Java/Ruby/Python/etc. If your work requires more than one node, Elixir is a lot faster than trying to create distributed system in another language-- you can just spread the work over many machines almost trivially by comparison. Literally just tell other nodes to run the function.
- troyk 11y agoI hear about the distributed properties of the vm often, but every example seems naive in that the work is passed to a named node, where in practice it seems the need would be to load balance between nodes available nodes. For example, I have a system in Go that uses redis to pull jobs, each process I spin up uses a buffered channel allowing 20 concurrent requests. I looked at elixir because I liked having a the process isolation and the dynamic nature of the language (the jobs scrape data from the interwebs), but I couldn't find a simple way to distribute jobs to nodes unsuring each node is capped at 20 concurrent jobs.
- scardine 11y agoLast week I picked up Fabio Mascarenhas (of Lua fame) at the airport for an event. I was surprised when he told me that like Lua, elixir also has Brazilian roots. Few Brazilians know that.
- ffn 11y agoSpeaking of this, just how did Elixir's Jose Valim (who I assume is Polish) wind up working at the Brazilian Plataformatec? Last I checked, Brazil is a quite a bit more than a stone's throw away from Poland, and I would imagine even the tele-commute must be hell much less the physical commute.
- nelmaven 11y agoYou assume wrong, José Valim is Brazilian.