Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Cybernetic Vermin
Apr 18, 2005

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

Adbot
ADBOT LOVES YOU

more like dICK
Feb 15, 2010

This is inevitable.

FamDav posted:

prolog is sw8, though i have no idea if somebody's written some real rear end poo poo innit

the past 3 pages look like a bipolar aspie's diary btw

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.

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


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.

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
are we still bemoaning/advocating type safety?

tef
May 30, 2004

-> some l-system crap ->

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

tef
May 30, 2004

-> some l-system crap ->

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?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

rotor posted:

are we still bemoaning/advocating type safety?

is this still the PL thread?

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

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

more like dICK
Feb 15, 2010

This is inevitable.

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

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

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.

tef
May 30, 2004

-> some l-system crap ->

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.

JawnV6
Jul 4, 2004

So hot ...

rotor posted:

are we still bemoaning/advocating type safety?

no no no type safely

nothing like getting new wrists at 35

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


tef posted:

the full on backtracking, unification and logic variables?

Not even close yet. That's why I said a part.

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome

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.

JewKiller 3000
Nov 28, 2006

by Lowtax
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

Cybernetic Vermin
Apr 18, 2005

tef posted:

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.

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

Qtotonibudinibudet
Nov 7, 2011



Omich poluyobok, skazhi ty narkoman? ya prosto tozhe gde to tam zhivu, mogli by vmeste uyobyvat' narkotiki
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.

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome

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

JewKiller 3000
Nov 28, 2006

by Lowtax

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

Opinion Haver
Apr 9, 2007

type systems are for people who make mistakes, imo

more like dICK
Feb 15, 2010

This is inevitable.

yaoi prophet posted:

type systems are for people who make mistakes, imo

Programmers then

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock
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

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome

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.

tef
May 30, 2004

-> some l-system crap ->
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

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

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

and assuming p langs means implicit, runtime (doesn't), and np langs means explicit, compile time (doesn't)

carry on

This isn't an argument; this is just mindless contradiction.

tef
May 30, 2004

-> some l-system crap ->

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

tef
May 30, 2004

-> some l-system crap ->

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 :v:

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
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.

tef
May 30, 2004

-> some l-system crap ->

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]


:toot:

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
:confuoot:

Catalyst-proof
May 11, 2011

better waste some time with you
that's pretty sexy, ain't gonna lie

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
would i be making myself an object of ridicule if i said that it kinda reminds me of makefiles?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
that's pretty sexy, gonna lie

more like dICK
Feb 15, 2010

This is inevitable.

tef posted:


?- eval_list([[define,square,[lambda,[x],[mul,x,x]]],[square,4]],X).

X = [t, 16]


:toot:

You're my favourite :3:

skeevy achievements
Feb 25, 2008

by merry exmarx

fivre posted:

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.

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

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

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

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

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

Shaggar
Apr 26, 2006

fivre posted:

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.

vba is the language used by the most powerful software tool on the planet.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Internaut! posted:

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

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.

raminasi
Jan 25, 2005

a last drink with no ice
i used prolog to prototype an algorithm one time it worked pretty great

Adbot
ADBOT LOVES YOU

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply