Fork me on GitHub
#off-topic
<
2017-06-05
>
bherrmann00:06:26

if you wanted to verify that someone was good a clojure / clojurescript - how would you do it?

noisesmith00:06:41

have them read some clojure code and explain what it's doing

noisesmith00:06:57

and have them suggest what improvements they would make

bherrmann00:06:01

wow, this channel has 9k subscribers

bherrmann00:06:37

I was wondering if checking their github account is likely (mine is something of a shambles of project started and lost)

bherrmann00:06:04

I was also wondering if people take the completion of all of the 4Clojure problems as a proxy for knowlege

noisesmith00:06:37

I haven't done all of them - I'd be more likely to evaluate their answers for quality rather than just counting their answers

bherrmann00:06:46

@noisesmith having them review describe and enhance some code - thats a good idea

bherrmann00:06:43

One of the “benefits” of having a certification program - is you can be sure that the person has been exposed to a survey of important ideas

bherrmann00:06:11

I kinda like the idea of these programs, J2ee architecture certification is something I worked towards

bherrmann00:06:29

I understand the negative undertow of certifications

bherrmann00:06:53

aka people plow through it to get the resume fodder, but skipped the deep learning

bherrmann00:06:06

Still without some kind of external individual assessment, it is hard to tell where you really stand … rockstar or cargo culter being the extremes

mobileink02:06:58

@bherrmann ask them about the Y combinator. If they have no idea, no prob, but if they do, they can do clojure no prob.

qqq03:06:17

Is it impolite for the Interviewer to tell the Interviewee: We are a Clojure shop. Since you are a "fast learner", can you learn Clojure on your own?

akiroz04:06:08

For the record, I've only used the Y once in my entire life and that's when I was trying to recur a lambda in erlang (since it can't call itself without a name)... and that was just a random fun thing I did on my own 😂

joelsanchez15:06:08

I didn't complete all of 4Clojure, jumped straight into CLJS and Om, more fun that way

joelsanchez15:06:36

I got a cljs job by showing clojure/clojurescript code I wrote, probably a good idea to request the interviewee to show code and explain it

joelsanchez15:06:44

Explaining the decisions behind the code and why it's structured the way it is structured sounds like a good idea

jsa-aerial17:06:06

Given you can't make them at runtime (well, not w/o really weird herculean efforts), they probably shouldn't be considered first class things

noisesmith17:06:48

so would you say classes in java are not first class then?

noisesmith17:06:24

because clojure needs to do some pretty crazy stuff to make classes at runtime

joelsanchez17:06:35

"t treats functions as first-class citizens. Specifically, this means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures"

joelsanchez17:06:40

Is this all true in C?

joelsanchez17:06:53

Then they are first class

joelsanchez17:06:29

Although that's not probably what one wants to say when saying "first-class", maybe another term would be better

joelsanchez17:06:43

For example in php I can return "callables"

captainlexington17:06:52

Yeah, C supports function-passing in the worst possible way

joelsanchez17:06:55

But....not the same as in JS or Scheme you know

noisesmith17:06:08

I’m not saying C is so great - rather I’m saying that “first class functions” is a relatively low bar and what we really mean is different. For example late binding, and the fact that the runtime can extend the type system and compile new code.

joelsanchez17:06:14

Maybe anonymous functions would be better for this, since that's what allows the whole thing - making them at runtime, assigning them to vars, returning them from other functions..

joelsanchez17:06:53

Indeed anonymous functions allow functions to be values (not just references)

captainlexington17:06:21

The last time I used C, I got the impression that you couldn't call a function pointer with arguments - it had to be a void function with no parameters, and if it needed state, it would capture globals you'd have to mutate

captainlexington17:06:25

Is this not the case?

akiroz17:06:44

I remember implementing a naive task scheduler in C that passes fns around.... xD

akiroz17:06:36

nah, you can call them just like any other function, just cast it to the correct type to get pass the compiler.

captainlexington17:06:04

Hmmm. Is there some other reason that GLUT has such an awful API?

akiroz17:06:35

never written a line of GPU code in my life but I'd presume legacy and hardware limitations?

joelsanchez17:06:08

But anonymous functions...not so much

akiroz18:06:12

reminds me of the days of setting registers at hard-coded memory addresses and hoping for the best.... but then some JS APIs feels exactly like this.

mobileink19:06:34

@joelsanchez i don't agree with that article. by its reasoning even machine language has first-class functions. but that drains the meaning from "function" and "first class"

mobileink19:06:48

computationally a fn is a lambda abstraction. if your language lack a lambda op, it lacks first-class functions.

joelsanchez19:06:45

Yeah that's what I always thought, but there seems to be a lack of consensus around the term "first-class function"

akiroz19:06:44

It really depends on interpretation IMO.... arguably most languages' functions aren't even lambda abstractions (in the designer's mind) but subroutines.

joelsanchez19:06:28

Functions as independent values == first-class functions would be better

joelsanchez19:06:38

The closer they are to strings, the better

joelsanchez19:06:48

You can make arbitrary strings at runtime

joelsanchez19:06:56

Return them, etc

noisesmith19:06:06

so haskell doesn’t have first class functions

akiroz19:06:22

in the mind of a purist, there's no such thing as a "pure function" because functions are by definition, pure.

noisesmith19:06:39

so clojure doesn’t have functions

akiroz19:06:17

inc is a function, print is a subroutine

noisesmith19:06:46

@joelsanchez the set of functions is closed upon compilation though, it can’t create new ones at runtime

joelsanchez19:06:23

That's a good point

joelsanchez19:06:01

Since every language puts different constraints around functions, there's a set of dichotomies around functions, and a given language may implement only a subset of those

joelsanchez19:06:09

For example, "can make them at runtime?"

joelsanchez19:06:23

"can take them as arguments?"

joelsanchez19:06:28

Kind of like that wikipedia article

akiroz19:06:16

well...... that's also quite a tough question... the C compiler is written in C so if your program has a compiler, what's runtime and compile time?

joelsanchez19:06:23

There's the runtime of the compiler, the runtime of your program, the runtime of the compiler inside your program...

akiroz19:06:41

but if your program has a C compiler, does that count as the C language being about to create functions at runtime?

mobileink19:06:58

fwiw i find it useful to think in terms of computational models. FP languages are based on the lambda calculus, whose central concept is "function". Languages like C are based on a different computational model, Turing or maybe von Neuman or something like that. Where the basic concept is "machine", or maybe "effective procedure". if course they're all equivalent, but the conceptual structure is very different.

akiroz19:06:07

I personally like to think of the computation models as mental models as you try to write code and different languages provide different levels of support for each mental model.

mobileink19:06:33

so FP languages like Haskell or Clojure "have" first-class fns, which really just means they provide the abstractions that help the peogrammer think in lambda terms, which makes reasoning more reliable. It takes a lot more work to do that in C or Assembler. Such languages force one to think first in machine terms - concrete procedures rather than lambda abstractions.

mobileink19:06:03

telling C or Java programmers new to FP that their languages already have first-class fns will only lead to confusion, imho.

mobileink19:06:54

(P.S. it is not true that "anonymous" fns have no names. They are names of the functions they denote.)

mobileink19:06:57

(fn [x] (+ 1 x)) is the name of the fn that increments its arg. inc is just a different name for the same function.

joelsanchez19:06:14

@akiroz If it were an interpreter, maybe, but a compiler does not execute the program. Anyway, a Lisp interpreter written in C may be able to execute the program but the C part of it does not know about the functions on the Lisp program, only performs the computation. Being able to compute a result does not equate to creating a function, just because that computation was defined in a language that is being interpreted

akiroz19:06:25

A compiler doesn't execute, but you can just set the CPU's program counter to the address of the newly compiled code to run it in a C program.

joelsanchez19:06:26

@mobileink Well the problem is that in some languages (with no anonymous functions) you can't do that, you can only refer to the functions using a name that does not describe the function itself (like inc)

mobileink19:06:37

right. such languages do not support 1st-class functions, by definition. well, by my definition. 😉

joelsanchez20:06:43

@akiroz In a similar spirit to the interpreter remarks, that's "another program" so you aren't really creating new functions at your runtime

joelsanchez20:06:12

They are not functions to your program

mobileink20:06:33

i'm leaning toward the following simple definition: a language has 1st-class functions iff it has a lambda ("anonymous" function) operator. Everything else (passing and returning fn vals, etc.) follows from that.

joelsanchez20:06:31

As I see it, in the interpreter case, you execute computations but those computations are not functions in your program, but functions in the programs you are interpreting, and in the compiler case it's another program and nothing in that program is anything in your program

joelsanchez20:06:02

@mobileink That's very similar to the comment I made in this same thread, so I agree 🙂

mobileink20:06:29

firehose, sorry. simple_smile

joelsanchez20:06:39

"Maybe anonymous functions would be better for this, since that's what allows the whole thing - making them at runtime, assigning them to vars, returning them from other functions.. [7:50] Indeed anonymous functions allow functions to be values (not just references)"

akiroz20:06:56

but since the C compiler is basically written in C itself, you could copy & paste the sourse code of a C compiler into your code base so it's part of your program...

joelsanchez20:06:35

I think that the "compiler inside my program" case just makes new runtimes, or environments if you prefer

joelsanchez20:06:17

In the case of cljs, is js actually creating any clojure vars, clojure maps, etc.? No, just js objects who wrap values that js does not understand to be anything

joelsanchez20:06:35

Although those are different languages, but the point is similar I believe

akiroz20:06:36

How does having a compiler inside your program creates a new runtime...? It's the same process (OS-wise).

akiroz20:06:57

It would be like saying every 3rd party lib in your program creates a new runtime.....

joelsanchez20:06:07

Not process or thread or that stuff, just a conceptual runtime

joelsanchez20:06:46

Well the "world" for the program inside the compiler in your program looks really different than what it looks like to your program

mobileink20:06:00

compiler != runtime.

joelsanchez20:06:43

A runtime results from executing a program that (in this case) a compiler generated

akiroz20:06:51

How so...? :thinking_face:

joelsanchez20:06:09

The child program does not have access to the compiler, for example

akiroz20:06:09

There is no child program, the compiler outputs machine code to a memory region in your program that you could tell the CPU to execute

mobileink20:06:11

you could embed a C compiler, written in Clojure, inside your Clojure application. but you could not run the code it compiles unless you also embed a C runtime, which is a different animal.

noisesmith20:06:59

mobileink: are you suggesting there is a jvm that exists today that doesn’t include the c stdlib as a dependency already?

mobileink20:06:48

no. i have no idea. do jvms always includ a c runtime?

noisesmith20:06:33

they are all written in c++

mobileink20:06:35

ok. but that's inessential, jvm does not necessarily imply a c runtime.

joelsanchez20:06:36

And when you execute that C program you get a runtime, the fact that your program embeds a C runtime does not mean that your program can make C functions

mobileink20:06:00

unless you're doing very low-level embedded programming, no OS, no language runtime - but then you would never embed a compiler in an app.

akiroz20:06:36

picture this: - your program calls a compile function that takes a string (C code) as arg and returns machine code (array of bytes) - you set the CPU's program counter to that array of bytes and it will execute.

joelsanchez20:06:19

Yes, but will it have access to the compile function?

akiroz20:06:27

yes it will

akiroz20:06:44

it's the same runtime.

joelsanchez20:06:29

I think I'm not experienced enough in low level programming to refute this

akiroz20:06:32

as long as the compiled output knows the physical memory address of the compile function, it can called

akiroz20:06:27

Well.... you could consider Clojure's case. It's also a compiled language and it could create new JVM byte code at runtime & execute those in the same runtime

akiroz20:06:23

for the JVM target, clojure's compile function outputs .class files and you can load them into your runtime via JVM's classloader

joelsanchez20:06:31

Yes, I guess...guess it counts as a really inconvenient way to "create new functions in my program at runtime"

mobileink20:06:35

like including asm code in a C program?

joelsanchez20:06:25

It is like the Y combinator: in this case you are creating new functions at runtime for a language that does not support it, in the case of the Y combinator it is recursion without named functions

mobileink20:06:28

anything is possible in assembler. 😉

akiroz20:06:29

anything's possible if it's turing-complete.... even PDF files 😂

mobileink22:06:49

akiroz: howsabout TeX, the programming language, not the typesetting system? you wanna see something genuinely "insanely great" check out https://en.m.wikipedia.org/wiki/PGF/TikZ. the best vector graphics language in existence, written in TeX. I'm not making this up.

akiroz22:06:10

I've been using LaTeX as my main typesetting software since 2012 😉

akiroz22:06:32

pretty much drew all the diagrams for my college assignments in TikZ.... and I have to say, I'm not a big fan of it.

mobileink22:06:00

akiroz: i didn't say "easiest". ;) but how 'bout all those crazy coordinate systems. geek love at first sight.

joelsanchez20:06:58

With the "it's a new runtime" point I was considering the case where you generate JVM bytecode and execute the program in a new JVM

joelsanchez20:06:06

But I see that was not your idea

joelsanchez20:06:21

Talking about Turing-complete things....

joelsanchez20:06:36

If you haven't heard of it already....

akiroz20:06:39

Haha, nice~

akiroz20:06:36

I remember listening to a talk about the origins of FP with S K I notations

joelsanchez20:06:53

Yes, that's one of the things that blew my mind back in the day

joelsanchez20:06:19

The first one (related to FP) being Church numerals

joelsanchez20:06:00

(I was reading SICP and knew nothing about FP, you can imagine the shock)

akiroz20:06:03

always leave it to the mathematicians to come up with amazing yet impractical stuff

mobileink20:06:04

unlambda - some people have way too much free time.

joelsanchez20:06:32

Looking at you Category theory...

akiroz20:06:34

and speaking of which I still haven't read SICP (shame on me)

joelsanchez20:06:42

(Even though Haskell managed to make practical use of it)

mobileink20:06:56

combinatory logic is way cool. no variables.

joelsanchez20:06:29

I haven't fully read SICP, left half way through to learn (in a more practical spirit) Scheme, then Common Lisp, then Clojure...never returned to SICP, what a shameful human I am

joelsanchez20:06:10

That being said, I bought a physical copy, I like having it

dpsutton20:06:17

if you like web reading. super well done version

dpsutton20:06:31

i own a physical copy and much prefer the online version

dpsutton20:06:04

the less famous name for curried functions right?

joelsanchez20:06:07

I will read it on a flight I have in some hours, I recommend the version of that McCarthy paper that defined Lisp that includes comments by Paul Graham

joelsanchez20:06:15

Or something like that, it was amazing

dpsutton20:06:23

haven't heard of that one

joelsanchez20:06:33

Time to use my Google-fu

mobileink20:06:49

they really should call it "schonfinkeling" instead of "currying". very tragic life. but you csn find his one paper online, it's totally brilliant.

mobileink22:06:49

akiroz: howsabout TeX, the programming language, not the typesetting system? you wanna see something genuinely "insanely great" check out https://en.m.wikipedia.org/wiki/PGF/TikZ. the best vector graphics language in existence, written in TeX. I'm not making this up.