Fork me on GitHub
#off-topic
<
2017-01-04
>
cfleming00:01:18

@notanon You can check for nulls on your own, but Tony Hoare has a billion dollars that says you won't

notanon00:01:48

if i had a dollar for every time i've written if ( blah != null)

cfleming00:01:51

The null-safe type system is a thing of beauty

notanon00:01:07

i'd have a billion dollars

notanon00:01:03

ill never forget how disappointed i was when java introduced for each syntax

notanon00:01:11

but they didnt *#@(ing null check the list

fellshard07:01:19

Exactly one meaning for a null value, or none at all

qqq18:01:50

(map-filter
 (lambda (x)
   (= (substring x 0 4) "(def"))
 '("hello" "(defn" "(deftest" "world"))

^^ what is wrong with this piece of elisp code?

qqq18:01:02

I'm trying to find all lines that start with (defn or (deftest or (defmacro

tbaldridge18:01:04

So how does Kotlin handle nils around Java Interop? Seems like it would still be a problem there

qqq18:01:37

figured it out, the emacs function is "-filter", not "map-filter"

fellshard18:01:07

If a type comes from Java code, I believe it's considered to be nullable by default. I suspect JB has integrated their existing Nullable/NotNull annotations, though, to cover the vast majority of existing core Java code.

bja19:01:03

@qqq I'd also probably use string-prefix-p for that test

bja19:01:32

(string-prefix-p "(def" x)

baptiste-from-paris20:01:21

hello guys, I am reading “Paradigms of Artificial Intelligence Programming”, this book => https://www.amazon.com/Paradigms-Artificial-Intelligence-Programming-Studies/dp/1558601910

baptiste-from-paris20:01:39

case studies are in Common Lisp, which I know nothing about ^^

baptiste-from-paris20:01:43

I don’t mind learning but I was looking for an IDE or a simple emacs plugin, my goal is not to be a professional Common Lisp programmer but read this book

dpsutton20:01:58

have you heard of slime?

dpsutton20:01:24

as i understand it, it is the canonical common lisp interaction

bja20:01:26

afaict, slime is the go-to environment for common lisp

dpsutton20:01:36

i've used it

bja20:01:41

although maybe someone with a LispWorks subscription would disagree

dpsutton20:01:50

the problem is common lisp is really weird with packages and other things

dpsutton20:01:07

and there's asdf and quicklisp

baptiste-from-paris20:01:12

Clojure syntax looks a lot like Common Lisp from what I’ve seen

dpsutton20:01:16

yeah it does

dpsutton20:01:29

but loading files and its dependenices and ensuring the repl is ready to go is a pain in the ass

dpsutton20:01:41

i wish there was an easy way to make the package files and asdf files and load it all

bja20:01:57

@baptiste-from-paris if you're looking for something that isn't emacs, I've heard good things about this: http://www.lispworks.com/products/lispworks.html

dpsutton20:01:03

also, from reading that norvig book, there were some ommissions of code

dpsutton20:01:13

so if you're following along there were some small gaps

baptiste-from-paris20:01:41

@dpsutton do you think I can read this book while using clojure , ?

baptiste-from-paris20:01:09

from my point of view it’s always good to learn a new langage

baptiste-from-paris20:01:20

but my focus is on AI not Common Lisp ^^

bja20:01:34

you can probably get by with extra references to the hyperspec and one of the clojure docs sites open

bja20:01:06

i.e. if you don't understand how some function works, look it up in the hyperspec and see if you can apply that to clojure

dpsutton20:01:18

it would be tough to make clojure work like CL

dpsutton20:01:26

but you can do it

dpsutton20:01:40

there are some style things that clojure doesn't like, like actually using lists

dpsutton20:01:54

but you can probably get quite a far way down the road

dpsutton20:01:12

its big on dynamic vars

dpsutton20:01:46

in CL, you can just regularly bind a *dynamic-var* whereas clojure you have to (binding ...

dpsutton20:01:20

but give it a shot

baptiste-from-paris20:01:55

so I guess with SLIME I can get a REPL as in clojure ?

dpsutton20:01:22

and there are some nice things there

dpsutton20:01:57

some good stuff to watch there

dpsutton20:01:35

for sure. have fun

dpsutton20:01:48

i've done a few of them

dpsutton20:01:17

ah. i remember now seeing the multiple-values-bind from CL, a form that i really like

baptiste-from-paris20:01:17

how did you like the book ?

dpsutton20:01:31

this auxfns is really important to have

dpsutton20:01:37

its a collection of helpers and some other things

dpsutton20:01:47

i'll read norvig any time

dpsutton20:01:59

i put it down halfway because life, ya know

dpsutton20:01:09

but if CL were easier to load modules/files, etc, I would pick it back up

baptiste-from-paris20:01:01

It looks like it’s a book where you need 6 months of time to read it

donaldball21:01:36

I have kind of an oddball UNIX/JVM process problem, thought I’d see if anyone has an inspired take. I have a process that needs to interact with the operator at startup via stdin and stdout (to receive secrets) but thereafter it needs to run as a daemon. I’ve thus far been faking it by running it in a screen process, but hit a snag over the holidays when, apparently, the stdout buffer hit its limit, blocking the process for several days.

donaldball21:01:47

Any ideas for a better way to manage such a process? Neither screen nor tmux seem to offer a dropping-buffer stdout.

geoffs21:01:01

I would write a shell wrapper to handle the initial input, then have the bash process fork and background the JVM process and pass the secrets in the environment... but then if you pass the secrets in the environment to begin with, you could just get rid of the bash process...

donaldball21:01:04

yeah, my concern there is that they’re exposed in the /proc fs

donaldball21:01:49

I can stop the process from logging foo to stdout and sidestep at least this manifestation of the problem, but I’m curious if there’re any alternate approaches I haven’t considered

geoffs21:01:16

@donaldball oooh, a pseudo-tty might help!

geoffs21:01:34

same idea, but on startup, the wrapper program (I would use python, because it has a pretty nice interface to pseudo-ttys) is connected to your jvm process, and passes through the stdin, then the wrapper process quits, and the other program keeps running in the background

donaldball22:01:40

hmm, yeah, that might do. You’re essentially writing a bespoke replacement for screen/tmux for this special case...

donaldball22:01:24

thanks, I’ll look into that!

geoffs22:01:39

here's the python module that deals with them https://docs.python.org/3.6/library/pty.html