|
kind of need the right type of task for prolog also, hard to see the point or understand what is happening if you don't have a reasonably large interesting logical task. often introductions don't reach that point though. and i now realize that i need to invent such a task that can be presented in sufficiently few lectures, suggestions are welcome
|
# ? Mar 4, 2013 20:12 |
|
|
# ? Jun 11, 2024 17:04 |
|
FamDav posted:prolog is sw8, though i have no idea if somebody's written some real rear end poo poo innit I got exposure to Prolog in school (like everyone else). The way I learned more about it was by writing an embedded interpreter . Right now the main thing I use it for is modelling a control system. It was a nice way for me to get a rules-based engine that can model certain engineering processes and then callback to another, more familiar, language (C++ in this case). I'm really glad I went back to working with Prolog after school, even just for a side project. It's a nice break from thinking in the "j/p/c lang" way.
|
# ? Mar 4, 2013 20:13 |
|
tef posted:prolog I've got part of a DSL in scala that behaves like prolog written now. It's still pretty hacky at the moment though.
|
# ? Mar 4, 2013 20:13 |
|
are we still bemoaning/advocating type safety?
|
# ? Mar 4, 2013 20:18 |
|
trex eaterofcadrs posted:also, one thing that helped me was writing a unification program. it's not too hard to make a simple unifier if you've already written a primitive compiler and it will go a long way in explaining how prolog goes about its business yeah this is what made it click for me
|
# ? Mar 4, 2013 20:20 |
|
Condiv posted:I've got part of a DSL in scala that behaves like prolog written now. It's still pretty hacky at the moment though. the full on backtracking, unification and logic variables?
|
# ? Mar 4, 2013 20:20 |
|
rotor posted:are we still bemoaning/advocating type safety? is this still the PL thread?
|
# ? Mar 4, 2013 20:21 |
|
rotor posted:are we still bemoaning/advocating type safety? strong typing is nice, but just like factoring large numbers and evaluating boolean expressions, it's nicest when the computer does it for you
|
# ? Mar 4, 2013 20:22 |
|
more like dICK posted:The way I learned more about it was by writing an embedded interpreter . trex eaterofcadrs posted:make sure you get a very recent copy, mine had all sorts of errata in it that was hand edited in tef posted:yeah this is what made it click for me Prolog is neat this way, I don't see a lot of this pattern with other languages.
|
# ? Mar 4, 2013 20:23 |
|
Cybernetic Vermin posted:kind of need the right type of task for prolog also, hard to see the point or understand what is happening if you don't have a reasonably large interesting logical task. often introductions don't reach that point though. and i now realize that i need to invent such a task that can be presented in sufficiently few lectures, suggestions are welcome scheme interpreter without call/cc you start with a simple evaluator, and then add some definite clause grammars and you have something that can parse it too. its probably about 20-30 lines of prolog.
|
# ? Mar 4, 2013 20:23 |
|
rotor posted:are we still bemoaning/advocating type safety? no no no type safely nothing like getting new wrists at 35
|
# ? Mar 4, 2013 20:32 |
|
tef posted:the full on backtracking, unification and logic variables? Not even close yet. That's why I said a part.
|
# ? Mar 4, 2013 20:34 |
|
Tiny Bug Child posted:is this still the PL thread? k so type safety isn't worth the effort imho. the bugs introduced by having "true" instead of True or whatever are just not errors i find myself making, and they're usually easy to spot. the only place where they're useful imho is as helpers to your IDE for code autocompletion. ymmv &c.
|
# ? Mar 4, 2013 20:38 |
|
yeah if you have absolutely no skill at encoding your specifications into the type system, then you'll think about types as just "true" vs True or 5 vs "5" and never Get It it's not entirely your fault though, many programming languages don't have the tools you really need in their type systems
|
# ? Mar 4, 2013 20:40 |
|
tef posted:scheme interpreter without call/cc hmm, this is good thinking, dcg at the very least is a persuasive prolog trick, might want to swap out scheme for something more dsl'ish though, will ponder. ty
|
# ? Mar 4, 2013 20:41 |
|
my friend just posted on facebook: "I'm getting way too excited about VBA" is this how conservative parents when their gay kids come out of the closet.
|
# ? Mar 4, 2013 20:43 |
|
JewKiller 3000 posted:yeah if you have absolutely no skill at encoding your specifications into the type system, then you'll think about types as just "true" vs True or 5 vs "5" and never Get It yeah i just dont get it jewkiller3k
|
# ? Mar 4, 2013 20:43 |
|
rotor posted:yeah i just dont get it jewkiller3k seriously you don't. i don't care how old and "experienced" you are, if that's your seriouspost about type systems, try reading a book about them published after 1970
|
# ? Mar 4, 2013 20:45 |
|
type systems are for people who make mistakes, imo
|
# ? Mar 4, 2013 20:45 |
|
yaoi prophet posted:type systems are for people who make mistakes, imo Programmers then
|
# ? Mar 4, 2013 20:49 |
|
why can't you guys leave tbc alone, he just wants to be able to multiply his database connection with "false", is that so bad
|
# ? Mar 4, 2013 20:51 |
|
JewKiller 3000 posted:seriously you don't. i don't care how old and "experienced" you are, if that's your seriouspost about type systems, try reading a book about them published after 1970 i dont really find myself needing to "encode" my "specifications" into code because I dont write libraries any more. back when i did, I didn't find that "byte, int, char*, char*, byte" was significantly clearer that "var, var, var, var, var", you either have them descriptively named or you have docs.
|
# ? Mar 4, 2013 20:54 |
|
oh, we're not having an argument, we're conflating implicit vs implicit type conversions vs compile time type checks vs runtime type checks and assuming p langs means implicit, runtime (doesn't), and np langs means explicit, compile time (doesn't) carry on
|
# ? Mar 4, 2013 20:54 |
|
tef posted:oh, we're not having an argument, we're conflating implicit vs implicit type conversions vs compile time type checks vs runtime type checks This isn't an argument; this is just mindless contradiction.
|
# ? Mar 4, 2013 20:56 |
|
more like dICK posted:Prolog is neat this way, I don't see a lot of this pattern with other languages. the closest thing to prolog is probably sql or regex, and they only have a little bit of similarity it's just that there aren't many logic/relational programming languages, and most of the declarative world thinks functional + hm-types are the entirety
|
# ? Mar 4, 2013 20:57 |
|
yaoi prophet posted:type systems are for people who make mistakes, imo type systems are for people who think if they handle errors at compile time they won't need to handle them at runtime
|
# ? Mar 4, 2013 20:58 |
|
y'all can tell your compiler what kinds of things should or should not go in a particular slot all day long, i dont care, whatever makes you happy. I'm just sayin that overall I tend to spend more time twiddling types between this or that than I do fixing bugs resulting from invalid types or bad type conversions. if you find the opposite, well, maybe strongly typed languages are for you! there are enough languages these days that everyone can have what they want.
|
# ? Mar 4, 2013 20:58 |
|
more like dICK posted:Prolog is neat this way, I don't see a lot of this pattern with other languages. eval(X,O) :- defined(X,A), eval(A,O). eval([X|T],O) :- defined(X,A), eval([A|T],O). eval(X,X) :- number(X); X = t ; X = []. eval([quote,X],X). eval([lambda|X],[lambda|X]). eval([define,X,Y],t) :- \+ defined(X,_), asserta(defined(X,Y)). eval([cond],_) :- !, fail. eval([cond,[H,A]|_],Z) :- eval(H,O), \+ O = [],!, eval(A,Z). eval([cond,_|T],Z) :- eval([cond|T],Z),!. eval([F|A],X) :- eval_list(A,Ae), apply(F,Ae,X),!. eval_list([],[]). eval_list([H|T],[Ho|To]) :- eval(H,Ho), eval_list(T,To). apply(add,[X,Y],Z) :- Z is X + Y. apply(add,[X,Y|T],Z) :- I is X + Y, apply(add,[I|T],Z). apply(mul,[X,Y],Z) :- Z is X * Y. apply(mul,[X,Y|T],Z) :- I is X * Y, apply(mul,[I|T],Z). apply(sub,[X,Y],Z) :- Z is X - Y. apply(div,[X,Y],Z) :- Z is X / Y. apply(mod,[X,Y],Z) :- Z is X mod Y. apply(pow,[X,Y],Z) :- Z is X ** Y. apply(eq,[X,Y],t) :- X = Y. apply(eq,[X,Y],[]) :- \+ X = Y. apply(atom,[X],t) :- atom(X); X = []. apply(atom,[[_|_]],[]). apply(cons,[X|[Y]],[X|Y]). apply(car,[[X|_]],X). apply(cdr,[[_|T]],T). apply([lambda,[],E],[],O) :- eval(E,O). apply([lambda,[A|Ta],E],[L|Tl],O) :- subst(A,L,E,E2), apply([lambda,Ta,E2],Tl,O). subst(_,_,[],[]). subst(A,B,[A|T],[B|L]) :- subst(A,B,T,L). subst(A,B,[H|T],[H|L]) :- subst(A,B,T,L). subst(A,B,A,B). subst(_,_,X,X). % gprolog :- predicate_property(defined,dynamic). % swi prolog :- dynamic defined/2. defined(_,[]) :- !,fail. anyway ?- eval_list([[define,square,[lambda,[x],[mul,x,x]]],[square,4]],X). X = [t, 16]
|
# ? Mar 4, 2013 21:00 |
|
|
# ? Mar 4, 2013 21:01 |
|
that's pretty sexy, ain't gonna lie
|
# ? Mar 4, 2013 21:02 |
|
would i be making myself an object of ridicule if i said that it kinda reminds me of makefiles?
|
# ? Mar 4, 2013 21:02 |
|
that's pretty sexy, gonna lie
|
# ? Mar 4, 2013 21:02 |
|
tef posted:
You're my favourite
|
# ? Mar 4, 2013 21:06 |
|
fivre posted:my friend just posted on facebook: my wife used to make 150 USA dollars per hour writing Excel VBA for Big Business and their Big Business Problems in terms of programming complexity it was something a first year CS grad with a month of learning Excel could handle don't knock it
|
# ? Mar 4, 2013 21:08 |
|
rotor posted:y'all can tell your compiler what kinds of things should or should not go in a particular slot all day long, i dont care, whatever makes you happy. I'm just sayin that overall I tend to spend more time twiddling types between this or that than I do fixing bugs resulting from invalid types or bad type conversions. words of wisdom from a lifetime of experience
|
# ? Mar 4, 2013 21:15 |
|
JewKiller 3000 posted:yeah if you have absolutely no skill at encoding your specifications into the type system, then you'll think about types as just "true" vs True or 5 vs "5" and never Get It the only person who doesn't Get It is you for thinking it's always necessary to "encode your specifications into the type system", rather than have the magic thinking machine do it for you
|
# ? Mar 4, 2013 21:17 |
|
fivre posted:my friend just posted on facebook: vba is the language used by the most powerful software tool on the planet.
|
# ? Mar 4, 2013 21:17 |
|
Internaut! posted:my wife used to make 150 USA dollars per hour writing Excel VBA for Big Business and their Big Business Problems Back when I was an industrial engineering major we had a data analysis course that taught VB macros for Excel. It's certainly possible to do "useful" things with it in the absence of more specialized skills/tools. Like you'd expect, the course difficulty was completely broken for the two of us who had programed before, and a tough C-wall for some who hadn't.
|
# ? Mar 4, 2013 21:23 |
|
i used prolog to prototype an algorithm one time it worked pretty great
|
# ? Mar 4, 2013 21:33 |
|
|
# ? Jun 11, 2024 17:04 |
|
Shaggar posted:vba is the language used by the most powerful software tool on the planet. vba and ssis both could have been so much better, maybe we'd actually be in a golden age by now loving mikkkroshaft
|
# ? Mar 4, 2013 22:01 |