Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
tell application "System Preferences" | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
tell application "System Events" | |
click checkbox 1 of tab group 1 of window 1 of application process "System Preferences" | |
end tell | |
end tell | |
if application "System Preferences" is running then | |
tell application "System Preferences" to quit | |
end if |
/** | |
* Same workflow but using Cascading, output fields in Parquet file are obviously fine and not prepended with '?' | |
*/ | |
package cascading.sandbox; | |
import cascading.flow.Flow; | |
import cascading.flow.FlowDef; | |
import cascading.flow.hadoop.HadoopFlowConnector; | |
import cascading.pipe.Pipe; | |
import cascading.property.AppProps; |
; it's a bit cumbersome to set up and there's the unfortunate need to ignore the tag | |
; in the individual methods, but this allows you to leave the interpretation of open | |
; variants, well, *open* for extension by multimethod. | |
; dispatch off the first argument, which will be the tag | |
(defmethod command-multi (fn [tag & data] tag)) | |
; the first argument to the *method* is still the tag | |
(defmulti command-multi :print [_ val] (println val)) | |
(defmulti command-multi :read [_ fname] (slurp fname)) |
This talk was given by Gregor Kiczales of Xerox PARC at OOPSLA ’94, 10/26/94. © 1994, University Video Communications. A transcript, with point- and-click retrieval of the slides, is available at http:/www.xerox.com/PARC/spl/eca/oi/gregor-invite/gregor- transcript.html
I think our field will go through a revolution. We will fundamentally change the way we think about and use abstraction in the engineering of software.
The goal of this talk is to summarize the need for and the basic nature of this abstraction framework.
The change is not new problems or new systems, but a new way of thinking about existing problems and existing systems.
class HyperLogLogStoreUDAF extends UserDefinedAggregateFunction { | |
override def inputSchema = new StructType() | |
.add("stringInput", BinaryType) | |
override def update(buffer: MutableAggregationBuffer, input: Row) = { | |
// This input Row only has a single column storing the input value in String (or other Binary data). | |
// We only update the buffer when the input value is not null. | |
if (!input.isNullAt(0)) { | |
if (buffer.isNullAt(0)) { |
object TypeclasseDemo { | |
// The parts of the type class pattern are: | |
// | |
// 1. the "type class" itself -- a trait with a single type parameter; | |
// | |
// 2. type class "instances" for each type we care about, | |
// each marked with the `implicit` keyword; | |
// | |
// 3. an "interface" to the type class -- one or more methods |
package org.keycloak.authentication.authenticators.browser; | |
import org.keycloak.authentication.AuthenticationFlowContext; | |
import org.keycloak.models.RoleModel; | |
import org.keycloak.models.UserModel; | |
import javax.ws.rs.core.MultivaluedMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.regex.Pattern; |
The other day, I was wondering why Clojure fits my brain so well. I think I was relaxing on my old couch, drinking cheap beer, eating a gas station pastry, and drawing doodles on a stack of overdue bills I forgot to pay. Little did I realize, these things are all connected.
I have a hypothesis that people choose programming languages based on their personality. For the purposes of this write-up, I’ll use the well-known distinction between type A and type B people. This may be pop psychology stuff, but it’s convenient for my point so in the spirit of American politics I will treat it as fact.
Type A people are very organized, competitive, punctual, and like to plan ahead. When I was a kid, these were the ones who had perfect grades, competed in track or swimming, and on top of that they were nice people so I couldn't even hate the fuckers. Type B people, on the other hand, are laid back and like to do things spontaneously. Like The Dude from The Big Lebowski, they are comfortable with
/* | |
Java Datalog Engine with Stratified Negation | |
Copyright 2016 Werner Stoop | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |