A few days ago, I published an article about Moon, a fundamental building block of a decentralized browser that aims to solve many of Mist's problems. I've showed up some fancy features such as its decentralized package manager and a generalized monadic notation. I guess that made some people angry, wondering why the hell I made yet another programming language when we have so many of them. If you're on that group: you're right. I'm sorry. Believe me when I say I'm as tired of new languages as you, and I'm as pissed with myself as you are. But I'd not have done this if I didn't have a very good reason. Give me, thus, a chance to justify my sins. For one, I didn't actually invent a programming lang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createRandomArray( lenght, max ) { | |
return Array.apply( null, Array ( lenght ) ).map( function( _, i ) { | |
return Math.round( Math.random() * max ); | |
}); | |
} | |
console.log( createRandomArray( 20, 300 ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//how to implement CRUD with F# and entityframework and TypeClasses | |
//transform this into an highorder type | |
type Customer with static member queryId = <@ fun ( λ : Customer ) -> λ.Id @> | |
//just a helper | |
type entity<'T> = ('T -> int) | |
//our highorder context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////// | |
// first try, trying to generalize over overloading, nope, cant generalize over | |
// two overloads | |
let inline backend<'M, 'C, 'VM when 'C : (new : unit -> 'C) | |
and 'C : (member Get : unit -> 'M seq) | |
and 'C : (member Get : int Nullable -> 'M seq) | |
and 'C : (member Get :'M Selector -> 'M seq)> () = | |
let getGet0 ( controller : ^C ) () = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarElement | |
def accept(visitor) | |
raise NotImpelementedError.new | |
end | |
end | |
module Visitable | |
def accept(visitor) | |
visitor.visit(self) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns new object without specified properties. | |
* @param {Array.<string>} keys | |
* @param {Object.<string, *>} object | |
* @returns {Object.<string, *>} | |
*/ | |
const without = ( | |
[ key, ...keys ] = [], | |
{ [key]: _, ...object } = {} | |
) => keys.length ? object : without(keys, object); |
Today, in Ruby, if I want to make a network request, I block
response = Net::HTTP.get("/post/1")
If I want to do multiple requests in parallel, I can use a thread per request
responses = ["/post/1", "/post/2"].map do |url|
Formality é uma linguagem de programação funcional em desenvolvimento, e que será lançada oficialmente ainda esse ano. Ela é uma linguagem bem "hardcore", com tipos dependentes e provas formais, inspirada em Haskell/Agda/Coq, mas com uma série de diferenciais, principalmente no que diz respeito ao runtime (optimal reductions, paralelismo, runtime fusion, etc.), visando combinar todo esse alto nível matemático com o potencial de ser realmente eficiente na prática. Essa é a carinha atual dela:
// Datatypes estilo Haskell
// O tipo de números naturais
T Nat
| succ {pred : Nat}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get existing queries results | |
users = get_query_result(132) # this one has {id, name} | |
events_by_users = get_query_result(131) # this one has {user_id, events count} | |
# actual merging. can be replaced with helper function and/or some Pandas code | |
events_dict = {} | |
for row in events_by_users['rows']: | |
events_dict[row['user_id']] = row['count'] | |
for row in users['rows']: |
OlderNewer