freenode/lisp - IRC Chatlog
Search
10:19:38
rnmhdn
I don't know how I should exactly approach this problem and what I should do with the missing nodes exactly
10:19:56
no-defun-allowed
It'd probably be easier to go edge by edge, but you might have multiple solutions in some graphs.
10:20:11
rnmhdn
I don't wanna just start coding and then have to rewrite the whole thing because I have a structural problem in my approach
10:20:42
no-defun-allowed
You'd likely need some backtracking to make sure you test every possible solution, and you may end up with multiple solutions which satisfy all of the constraints.
10:21:46
pjb
rnmhdn: backtracking means that you will need to generate families of results (lazily) and filter out the bad ones.
10:22:42
pjb
rnmhdn: so for example from the graph: (2)----<from>=to>=0L>---->[x] you must return { (2)----<from>=to>=0L>---->[0], (2)----<from>=to>=0L>---->[1], (2)----<from>=to>=0L>---->[2] }
10:25:24
pjb
So if you have (2)----(<= 0 to from)---->[x]<----(< from to)----(1), the above step will return: { (2)----(<= 0 to from)---->[0]<----(< from to)----(1), (2)----(<= 0 to from)---->[1]<----(< from to)----(1), (2)----(<= 0 to from)---->[2]<----(< from to)----(1) }, and the following step, will prune it to:
10:26:04
pjb
{ (2)----(<= 0 to from)---->[2]<----(< from to)----(1) } because the second constraint cannot be fulfilled for the fisrt two tries.
10:30:31
pjb
You generate one, and go on with the rest of the process, until you backtrack (or you never backtrack, having found a solution).
10:31:21
pjb
Well, it's strange that you want to do it functionnaly, using lisp which doesn't have lazy evaluation natively.
10:31:22
rnmhdn
the two way arrow between black node and b means they should be null at the same time
10:32:05
pjb
You're combining 3 or 4 difficulties at the same time. They're not extraordinarily difficult, but you have to know each of those problem and their solution well first, and then you may try to combine them in a lisp program.
10:32:10
rnmhdn
so I have to see if there is any possible solution for the black node that would satisfy all constraints
10:33:39
pjb
for example, I have a constraint solver here: https://github.com/informatimago/lisp/blob/master/common-lisp/cesarum/constraints.lisp
10:37:11
pjb
Once you get your algorithm running correctly, you can check the access pattern, and optimize the data structure used to represent your graph, keeping the same functional abstraction.
10:39:05
pjb
Well, if you want to walk the graph, what can be useful is to use adjacency lists. Ie. from a given node, have the list of edges starting from that node.
10:42:18
pjb
And since you want it functional, you will need (graph-replace-node-label graph node new-label) -> graph ; ie., you will generate a whole new graph just because you updated the label of a node.
10:42:42
pjb
of course, since it's functional, you won't use mutation, so you can actually share structure between the new and the old graph.
10:43:13
pjb
Also, when you use backtracking, it's a good thing, since then you can use again the old graph, to generate another new graph with another value for the node label.
10:44:00
pjb
(mapcar (lambda (possible-label) (graph-replace-node-label graph node possible-label)) (all-possible-labels-for-to-nodes graph node))
10:44:39
pjb
You need also "labels" one edges to store the constraints. (add-edge graph from-node to-node edge-label) -> edge (edge-label edge) -> label
10:48:54
pjb
What people look for in GUI, you can find it in genera and oberon (and MPW, and of course in emacs). It's basically that any text buffer can contain commands, and you can "click" or type C-x C-e with the cursor on that command to execute it. It's a variation of the REPL, basically.
10:52:26
pjb
So, in this talk Alan Kay presents half a dozen big idea. The main one here would be that to educate children, you need to put them in the world they will have to live 20-30 years later. To teach them French, put them in France. To teach them maths, put them in a Math World. To prepare them for their adult life, put them in the world as it will be in the future (which is the whole difficulty). We can try with sci-fi, but
10:52:26
pjb
unfortunately, we're getting more of 1984 and Brave New World, than Have space suit, will travel or Star Trek.
10:56:39
aeth
pjb: Well what everyone's being exposed to now is a lot of just-barely-not-gambling on iPads/etc. so the future is probably more like Las Vegas than 1984 or BNW.
10:57:41
aeth
Not even just the game loot box stuff that you may have heard about. Lots of not-game apps have random reward stuff to increase engagement.
10:57:57
pjb
No, everyone is exposed to the fake news from CNN et al. and siris, alexa and samsung smart tvs. This is pure 1984.
10:58:37
aeth
pjb: You were talking about the software UIs children are exposed to. Children don't care about CNN.
10:59:02
pjb
Everyone is exposed to assisted reproduction, surrogacy motherhood, artificial wombs; this is pure BNW.
11:01:11
verisimilitude
Erik Naggum put it well when he remarked how professionals use the same hardware and software others are expected to use and by noting how math would be if there were some need to dumb it down to train armies of unintelligent math workers.
11:01:59
verisimilitude
A tall person can have stunted growth, but a midget will always be a midget.
11:02:36
pjb
The migrations promoted by the ONU (Marakech pact), have the effect of displacing low IQ white people (they become homeless, and die or at least don't reproduce), by low IQ black people. Ie. this increase the discrimination, the society becoming quickly BNW like.
11:03:22
pjb
For a time, people thought that they could compenate IQ by education, and they realized how wrong they were; education benefit proportionnaly more to more intelligent people!
11:04:36
verisimilitude
So, I've not bothered to prove this yet, but FORMAT seems trivially non-turing-complete.
11:05:23
pjb
verisimilitude: notice for example, that sed(1) is not turing complete, but while true do sed … ; done is turing complete.
11:05:55
pjb
verisimilitude: so it looks like FORMAT is not turing complete, but it also seem very close to be it. And anyways, there's ~/ so you have a hook to CL anyways.
11:06:36
verisimilitude
I am always displeased when I MACROEXPAND something and find that LOOP may as well expand to SPECIAL-LOOP-PACKAGE:SPECIAL-LOOP-KEYWORD-DONT-TOUCH-FUCK-YOU; I'd prefer macros be written to expand to other symbols in CL as much as is possible.
11:08:01
aeth
verisimilitude: I definitely agree with you, though. Seeing the final resulting tagbody/go in the iteration helps sometimes
11:08:14
TMA
pjb: sed(1) is turing complete; you have conditions and conditional branches in sed (as well as unconditional branches), you can loop inside sed as well
11:08:23
verisimilitude
I'd be interested in a FORMAT that always wrote the minimal needed. A trivial example is using PRINC and friends wherever something more complex isn't necessary, rather than always delegating to subfucntions that implement the full model.
11:08:30
pjb
For example (defmacro IF* (test then &optional else) `(if* ,test (lambda () ,then) (lambda () ,else)))
11:10:08
verisimilitude
I'd be interested in giving LOOP a similar treatment; these are a nice starting point for my own implementation of Common Lisp I want to write, since you can simply implement them in terms of everything else in CL.
11:11:53
MichaelRaskin
I think most macros are technically allowed to be expanded to an implemetation-specific special form (with a string parameter, just to be mean)
11:13:21
aeth
well if you were going to implement Lisp in hardware, you might not have a lower (software) level
11:26:11
|3b|
MichaelRaskin: the implementation-specific special form would have to have a valid macroexpansion, but /that/ could just be a call to a function with a string parameter :)
11:27:25
MichaelRaskin
|3b|: I don't think so; cl:loop must have an expansion. but nobody prohibits this expansion being ext:loop-impl (special form)
11:30:31
|3b|
"An implementation is free to implement any macro operator as a special operator, but only if an equivalent definition of the macro is also provided. ", so that would be stretching things a bit
11:36:12
MichaelRaskin
The standard macros should have expansions, but nobody says they should be standard
11:36:57
MichaelRaskin
… and defun has a high chance to be indeed expanded to something interesting.
11:37:40
|3b|
i'd argue that "expands to a special form" should be included in "implement .. as a special operator", but it is poorly phrased there
11:39:04
MichaelRaskin
|3b|: I agree that it would be better if it was explicitly specified that all standard-defined macros used in portable code should expand into portable code
12:06:38
phoe
I love that thing when I need to operate on some body of code, like, wrap every element of that code with a list
12:06:54
phoe
And I just copy it, jump to the REPL, do a quick MAPCAR, copy the result, paste it back into the code.
12:19:03
|3b|
similarly C-- C-x C-e evals last expression and saves result to kill ring so you can paste it elsewhere
12:57:49
pjb
phoe: I don't even go to the REPL, I do that in the lisp buffer in emacs, wrap a pprint around it, and type C-u C-x C-e
14:13:36
jackdaniel
afaik he is now busy with his game, you may track its development progress here: http://techsnuffle.com/
14:41:06
devon
Optima, Trivia and other pattern matching libraries have does-this-node-match-this-pattern but seem to lack find-a-match-at-or-below-this-node, am I missing some wild-inferiors or similar feature?
16:14:00
pjb
(destructuring-bind (car . cdr) '(a b (c . d) e f) (list :car car :cdr cdr)) #| --> (:car a :cdr (b (c . d) e f)) |# yep, it matches.
17:49:56
Josh_2
can someone tell me if there is a better way to do what I'm doing here. https://plaster.tymoon.eu/view/1100#1100 ?
18:07:19
Josh_2
_death: well it wasn't originally, it was always 4 but then I ran into issues where just bit shifting and logioring the values would work, until there were trailing 0's
18:07:51
Josh_2
if there were trailing 0's I'd get outputs I don't want as the bytes are being sent from a Java client
18:14:37
_death
from the transcript at the bottom I am guessing the issue is little endian vs. big endian
18:22:36
Josh_2
I saw this https://stackoverflow.com/questions/21973387/casting-8-bit-int-to-32-bit obviously C but still
18:24:25
Josh_2
Well it showed me the issue, because I do have to flip the order on 4 byte sequences like #(1 0 0 0) or I end up with huge numbers instead of just 1
18:25:34
Josh_2
or reverse it. And then when I get an input like #(0 0 34 45) it has to be #(34 45 0 0) not #(45 34 0 0)
18:32:45
Josh_2
then if I bytes-to-int it without stripping the trailing 0's I get 70778880 (27 bits, #x4380000)
18:33:54
_death
forget bytes-to-int.. first verify in the Java program that the array you get is #(56 4 ...)
18:39:04
phoe
in order to verify it, don't send it over the network, print it to console from the Java side
18:40:09
_death
Josh_2: are you saying that you printed the array in the Java program and it showed 4 as the first byte?
18:41:11
phoe
_death: I guess so. big-endian is the "natural" order of writing digits where little-endian is the inverse
18:41:27
phoe
so the number 123456 in big endian would be 123456 and in little endian would be 654321
18:42:35
Josh_2
usocket:socket-recieve requires that you either give it a buffer or a length of a buffer it will create
18:46:33
Josh_2
and the buffer you give it has to be a specific size already, you can't make it extendable so it'll fit just right
18:48:41
phoe
yes, bigintegers can be arbitrarily large so Java can send you something that is 9001 bytes long
18:50:10
phoe
if you want to go this way, then you'll likely never get a screen that's larger than 65535x65535
20:58:07
pjb
puchacz: you can put reader macros on [-+0-9] so that you can read 1_000_000 ; also on _, because I would admit _123_456.
21:25:15
no-defun-allowed
are there any fancy (human) language parsers like prolog-talk in quicklisp?
21:48:15
no-defun-allowed
i'd like to take some english text, make it into a parse tree, and possibly turn it back later
21:54:38
no-defun-allowed
is there anything on using cl-nlp? i found tokenizing but just doing apropos on variable names doesn't seem too efficient
21:59:35
fiddlerwoaroof
margaritamike: using lquery, it would be something like this: (lquery:$ (initialize "<html><!--foo--></html>") (children) (contents) (filter #'plump:comment-p))
22:00:17
fiddlerwoaroof
lquery is a little dsl wrapper around plump that makes traversing xml a lot nicer